eval() macro as part of the nedit macro language
Bert Wesarg
wesarg at informatik.uni-halle.de
Tue Jan 23 14:06:03 CET 2007
> I once had a cooked up version that allowed any string value to be used
> as a function name, so that something like the following was possible:
> a = "length"
> len = a("string")
> I let it drop, because it really did seem like a can of worms! However,
> a way of loading a function into a variable would be great, giving us
> something like function pointers.
shouldn't this be that hard, an new variable of type MACRO_TAG (or
PROG_TAG), a function parse(string) that can return exacly that, and now
you can do:
func = parse("return 5")
five = func()
or, a little more intrusive (which is inspired by JavaScript, except with
'define' instead of 'function'):
func = define {
return 5
}
five = func()
But I know too little from the nedit macro internals.
> This involves serious language design
> and might impose changes like nedit's currently simplistic scoping
> rules. I believe it would also require a serious attack on the macro
> memory management system.
>
> Tony
Bert
More information about the Develop
mailing list