[Laszlo-user] [Laszlo-dev] Do datasets really have to be in 3 places at once?

P T Withington ptw at openlaszlo.org
Tue Apr 4 22:27:54 EDT 2006

On 2006-04-04 21:49 EDT, Jim Grandy wrote:

> On Apr 4, 2006, at 1:36 PM, P T Withington wrote:
>> On 2006-04-04 16:14 EDT, Oliver Steele wrote:
>>> OpenLaszlo should adopt the $(name) function that Prototype.js
>>> introduced and that is becoming popular is other DHTML frameworks
>>> such as JQuery.  (There's an implementation of this function in
>>> sandbox/domapi.js.)
>> $ is a shorthand for looking up names in another namespace, right?
>> Did you see my proposal to add (Dylan-like) modules to LZX?  I think
>> this could achieve the same benefit (short names without having to
>> pollute the global namespace), without the overhead of a function
>> call on your references.
> How about adopting the $ syntax as a shorthand for referencing a  
> particular module?

Not sure what you mean here.

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- 

More information about the Laszlo-user mailing list