Re: routine_id() Discovery

new topic     » goto parent     » topic index » view thread      » older message » newer message

c.k.lester wrote:
> 
> Maybe this is common knowledge, but I just discovered this...

You already knew about this, but you didn't realize it...

> A routine doesn't have to be global in order to call it from what would
> otherwise require a global definition.
> 
> For example, this would normally fail:
> 
> -- mylib.e
> func myfunc()
> end func
> 
> -- myprog.e
> x = myfunc()
> 
> with myfunc() is not defined (I think).
> 
> But, if I add the routine_id() of myfunc() to a global list, then I can
> call it from myprog.e with call_func().

Or add it to some local variable in myprog.e through some routine like, say,
myprog:set_event_handler().
 
> That means it can be exported but not made global... right?

Yes, but in an annoying way [for most purposes]. call_func/proc don't care 
about scope.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu