[Devel] Extension URI vs extension prefix (a compatibility vs nuisance decision)

David Robillard d at drobilla.net
Thu Nov 17 19:46:48 PST 2011


Hi all,

So, as probably many of you have encountered, there is a nuisance that
crops up writing LV2 code that stems from the fact that the URI for an
extension and the namespace prefix for that extension are not the same.

For example, an extension URI:

http://lv2plug.in/ns/ext/foo

and a thing defined in that extension:

http://lv2plug.in/ns/ext/foo#thing

i.e. the prefix is:

http://lv2plug.in/ns/ext/foo#

This was a screw up.  A convention in other vocabularies is to include
the trailing hash in the extension itself, so the extension URI and the
namespace prefix are the same.  That way, we can define in headers
something like

#define LV2_FOO_URI "http://lv2plug.in/ns/ext/foo#"

and use it as both the URI of that extension and a prefix, e.g.:

do_stuff(LV2_FOO_URI "thing")

There is only one define so the double-hash and missing-hash errors
should more or less go away.

I could update things to use this convention, but it would theoretically
be a compatibility break.  However, most things that actually use URIs
use something defined in the extension, and not the extension itself.
The few that do are usually using extension URIs that are doubling as
feature URIs, which is a bad practice anyway.

Basically, I'm just throwing out a feeler to see how people feel about a
change like this.  The conservative thing to do is, of course, leave
everything as-is.  Always doing the conservative thing to do gets you
Windows ME, though. :)

-dr (who wants to just stick all extensions in lv2plug.in/ns while we're
being crazy)




More information about the Devel mailing list