What a language!

Lähettäjä: benny <listen@marcrenearns.de>
Aihe: What a language!

just another ruby gotcha:

to prevent namespace pollution from abitrary loaded files with code in it, I
had the idea to evaluate the code in anonymous modules, that are saved in a
hash (key is the filename/path).

worked so far, no problem.

then I tried to include the anonymous modules to have comfortable access to
the classes and methods of the corresponding files and guess what... it
worked!

I'm curious, are you doing something different from Kernel#load?

include anonymous modules! whow! I am really impressed!
this language let me try things I would not think about in other languages.

thank you matz and the other developers for this great language!

benny

E

E S wrote:

I'm curious, are you doing something different from Kernel#load?

sure.
In my webapplication-framwork each project (=vhost) consists of different
components. each component is a file with the name of the component as a
filename and at least (capitalized) a class as subclass of components with
the method run. but in this component-file there may be other methods and
classes as well (maybe even moduls).
for each project there is a central controller who interprets the request of
the browser and collects all required results of all affected components.

but also a component may reuse methods of another component.

so the code of the components is collected in a hash (kind of
component-cache) where the key is the component-name (i.e. the filename)
and the value is the anonymous module with the code of the component.

so different programmers may work on different components and don't have to
care about collisions with the class names of other components.

if some component needs to call a method from another (e.g. for certain
database actions) it simply includes the anonymous module (as value of the
component-caching hash) and may comfortably instanciate objects and call
methods in there

benny

···

---------------------------------------------------------------------------------------------------
Don't crash when a filter changes the subject of a message which results
in the attempt to remove it from the tree of subject threading messages
failing and the detached child looking for a new parent finding the old
parent as the new parent, which in turn results in the child being deleted
with the old (and new) parent, which is not a good idea, since it is
still referenced.

(Till Adams commit on kdepim/kmail/kmheaders.cpp in HEAD, 6. Jan. 2005)