|
From: Manuel T. <ma...@sp...> - 2000-11-04 12:58:20
|
Hi Clemens
> But it seems not the 'unknown:with-list' method, yes?
Nope, not yet....
> This IS really nice ... what a coincidence. :-) I want to propose that
> idea also (seen in Perl and Tcl). BTW: How do I load/require a certain
> module right now? 'system load:' will abort if I try to load a script,
> and there is no 'system require'.
The normal ways to load modules/scripts etc should be.
"module" load
or
system load: "module"
or
"module" import
or
system import: "module"
The difference between load and import is that import will only load the file
the first time and cache it's result, and then just give the return value of the
module to further requests. load on the other hand will load and execute the file
each time, and then return the value. (Right now though they both behave like load,
because I haven;t done the hashtable object yet, which will be used for caching).
I will also do a 'load-config:' or whatever I will call it. This will load a file
execute it and return a hashtable of all the top level identifiers and their values.
This should be used to load configuration files.
The autoloading is kind of a trick to load stuff one demand that 'logically' is
already considered 'imported'. (Some examples are in the last lines of prelude.brn)
The aborting thing is a bug...
> variable = system object new;
> method: #<- is: { |v| self delegate: #value is: v };
> method: #get is: { self slot: #value };
> .
>
> But unfortunately the #get seems not to return the right thing!
Oops! Sorry, I forgot to tell you that the delegates/prototypes have a different
namespace from normal slots, and that I haven't done yet the method which
allows you to read the value of a parent.
BTW. Do you think it is better to have one namespace for both delegates and prototypes
or should each of them have it's own namespace?
> And here I will fit in. Let me tell you some thoughts of mine. Let me
> assume you could accept the ':word' syntax for symbol fetching
> ... For me the '#...' is a kind of special syntax, something special
> happens here: object will created with #(); comments will indicated
> via #!, ... Only (* ... *) and #symbol will not fit here too smooth
> IMHO. But let (* ... *) remain as it fits too well so we could take
> this as exception here. But if we would use ':symbol' we would free
> the '#' token for other, futural use.
>
> Do you remember, you want (probably) implementing the parser/compiler
> into Brain. Why not allow to install special handlers (written in
> Brain) that could handle arbitrary #... construct? How this?
After some thought I think I like your idea. Allthough the Smalltalkish
syntax of brain should be flexible enough for expressing nice interfaces to
a variety of things, we might aswell provide a 'metaprogramming handler'
feature like the one you propose, for the sake of completeness and because
sometimes it may be usefull (but hopefully not overdone).
I don't like the 'use:' feature you propose, because it would be
compicated to implement, and would break the semantics of brain.
But no problem :-) Instead we can have two much simpler solutions.
1> For programs with many files we can have the main file let's say do:
.....
"compiler-extension1" load. #! Load and install handler
"my-file-using-extension1" load. #! Load and run program that uses new syntax
.....
2> For single file scripts we can have a command line argument that loads and
executes some files before running our main file:
#! /usr/bin/brain --load extension1 my-program.brn
#! Rest of script next:
.....
I don't have time now, so I will tell you more later. In another mail I will
send something like a TODO list, and some info about hacking brain.
But if you have any questions, or something you think I should talk about in
the 'hacking guide', tell me so that I know what to talk about :-)
Manuel
|