Jo ich habe diese mail gekriegt
Alexander Burger wrote:
Hi all,
it is amazing how some simple and obvious ideas pop up so late.
Or not at all.
For example, the new 'script' function (lib.l:146).
As you know, you can put executable code either into a function, or
execute it directly from a source file via 'load'. In both cases a
sequence of expressions is evaluated, and the last value is returned.
The unfortunate thing is that you cannot pass arguments to 'load'. If
the expressions in that file need parameters, you have to put them into
global variables before you call 'load':
(setq *Str "abc" *Num 123)
(load "file.l")
Now, with 'script', you can say
(script "file.l" "abc" 123)
and the expressions can access these parameters just like in functions
with a variable number of arguments (i.e. with 'args', 'next', 'arg' and
'rest').
This is especially convenient for *.l files in application server URLs.
Now you can pass here the arguments directly
http://host?file.l&abc&+123
instead of
http://host?file.l&*Str=abc&*Num=+123
This was possible until now only for functions
http://[EMAIL PROTECTED]&abc&+123
And it is so simple:
(de script (File . @)
(load File) )
Thanks to dynamic binding! :-)
(how to do that with lexical binding?)
Cheers,
- Alex
--
*Robert Woerle
**Linux Development *
phone: +49 (0)821 4442253
mobile: +49 179 4744527
email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
web: http://www.linuxdevelopment.de
UStNr. 102/289/51264
This e-mail message and any files transmitted with it are confidential
property and are intended only for the person(s) to whom this e-mail is
addressed. If you have received this e-mail message in error, please
notify the sender immediately by telephone or e-mail and destroy the
original message without making a copy. Thank you.
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]