[gambit-list] Valid namespace prefix

Christian Jaeger christian at pflanze.mine.nu
Mon Jul 30 02:34:04 EDT 2007


As I've said before on this list, I consider the # based namespaces good
as lowlevel building blocks for your own module/namespaces handling. And
for this purpose it's *good* that not the : character has been chosen.
This leaves : free for your own purpose.

Two points:

- if you always fully qualify your identifyers, you don't need any
system support for namspaces at all (just use R5RS identifyers happening
to have colons in them).

- you usually want _short_ namespace prefixes if you're using them often
in user code to prevent having long identifyers (for less typing and
better readability). OTOH, you want _long_ namespace names to decrease
the risk of namespace clashes between different authors. The obvious
solution for this is to map globally unique namespace names onto short
local namespace prefixes. And, as I've said, for this the # syntax comes
in fine: you could, for example, have an identifyer being fully
qualified with a globally unique namespace name (directly accessed using
the lowlevel Gambit namespacing):

christianjaeger-foobar-subfu#foo

or maybe even, if you want,

org.apache.foobarproject.somemodule#foo

and then your importer aliases those to, for example,

(import christianjaeger-foobar-subfu as: subfu)

and use the foo value as

subfu:foo

(or directly as foo if no clashes occur)

or
(import org.apache.foobarproject.somemodule as: fb)
and use it's foo value as

fb:foo

just for the scope of the module where those import statements are being
used.

How exactly this mapping and import syntax should look is open for
discussion and implementation.

BTW you should maybe take a look at the "Snow!" packaging/module system.

Christian.


James Long wrote:
> How come Gambit enforces the module# syntax for namespaces?  I have
> just started using them, and have looked at many posts describing the
> system, but I don't remember anyone explaining the reason for this
> syntax.
>
> For example, trying anything different than module gives an error:
>
>   
>> (namespace ("foo:"))
>>     
> *** ERROR IN (console)@1.13 -- Ill-formed namespace prefix
>
> I would like to use the colon syntax as I find it much more readable,
> especially for user-land code.  I'm going to usually use fully
> qualified names, so this slight readability improvement is important.
> Is there a reason I shouldn't be able to do this?
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>   




More information about the Gambit-list mailing list