Another thought on the difference between the two methods is that

ll_get_attribute(license_uri, LL_ATTRIBUTE_URI_CREATOR, 0)

would allow third-party attributes to be used, without altering the liblicense 
API.  However, I'm not sure it that's something we want to encourage or not.

I also think that ll_get_attribute should leave off the last parameter and we'd 
include another method, say, ll_get_attribute_localized.  The most common use 
of ll_get_attribute doesn't use the last parameter, so the API would be cleaner 
for the most common case.

Cheers,
Jason


> Today on #cc there was some discussion about the use of helper functions
> vs the use of named constant URIs.  This came about as a comment by
> paulproteus (sorry, don't know mapping from IRC handle to email address)
> on a recent commit by me (pmiller) of the ll_license_get_creator and
> ll_license_get_publisher functions.
>
> The question was: which of the following is better in the public API?
>
>     ll_get_attribute(license_uri, LL_ATTRIBUTE_URI_CREATOR, 0)
>
> or
>
>     ll_license_get_creator(license_uri)
>
> The second form is quite simply a wrapper function which uses the first
> form.
>
> My feeling is that both are desirable.  The first is great for
> generality and experts, when code wants to loop over every attribute in
> a license.  The second form simply has less for beginners to get wrong.
> Both forms can be made equally robust in the face of changes in the
> spelling of the actual attribute URIs.  We already had wrapper functions
> like this before ll_license_get_creator and ll_license_get_publisher
> were committed, so the API remains self consistent.
>
> We agree on something: neither of us likes the
> "http://creativecommons.org/ns#blah"; constant strings in the code.  They
> should appear exactly once, and replace uses with named constants.
>
>
> A second point of discussion: which of the following forms should be
> used to define the constants?
>
>     #define LL_ATTRIBUTE_URI_CREATOR "http://blah...";
>
> or
>
>     extern const char LL_ATTRIBUTE_URI_CREATOR[];
>
> we both like the second form, but for different reasons.  Robustness
> mentioned above would use the second form.
>
>
> Attached is a patch which implements what we were talking about, or at
> least what I *think* we were talking about.  I haven't committed it yet,
> I would like some discussion first.
>
>
> Regards
> Peter Miller <[EMAIL PROTECTED]>
> /\/\*        http://miller.emu.id.au/pmiller/
>
> PGP public key ID: 1024D/D0EDB64D
> fingerprint = AD0A C5DF C426 4F03 5D53  2BDB 18D8 A4E2 D0ED B64D
> See http://www.keyserver.net or any PGP keyserver for public key.
>
> "This is terribly unsatisfying."  "It's far more satisfying if you throw
> it at someone." -- Final Cut Pro easter egg
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> cc-devel mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/cc-devel

_______________________________________________
cc-devel mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/cc-devel

Reply via email to