On Apr 4, 2006, at 7:27 PM, P T Withington wrote:

How about adopting the $ syntax as a shorthand for referencing a particular module?


Not sure what you mean here.


I was suggesting syntactic sugar -- static rather than dynaimc -- but it's two more characters than what you describe below. I'm happy with the prefix convention of using prefix + $.

In Dylan, when you import from another module, you can specify a prefix to avoid collisions with any of your own names.  The convention is to have the prefix end with $.  So for instance, if you wanted to use all of the lz module but have distinct names, you might import with 'lz$' as a prefix, so the name 'foo' in lz would be lz$foo in your module.  You don't have to have a prefix, and you can make the prefix as short as you want, so you could use '$' as a prefix.  This is what I plan for LZX.


It's not a good idea to have a general loophole that allows you to (dynamically) access names in other modules (as the $() function kind of does), because that leads to fragility and limits the compiler's optimization opportunities.  This is a problem with C++ namespaces -- in C++ only the linker knows when a class will not be further sub-classed.


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to