Re: init.e - standard library candidate

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
jimcbrown said...

However, altering routine_id() so it always uses the scope of the callee is not useful, as the callee has no way to compenstate and discover the real routine id that is meant to be called from just the string. Instead, the integer with the routine_id() call must be overriden everytime - most likely by another handwritten routine_id() call directly in the caller (as is typically done with setHandler() ). This makes embedding a routine_id() call inside of a defaulted parameter unconditionally useless.

So, yes, maybe it is technically broken, but if it can't be fixed, then breaking it in this way is better than the alternative.

I actually didn't think this would work when I first tried it, because I recall going to a bit of effort to make variables evaluate in the routine's scope. This is especially important if the routine refers to something local that isn't visible outside of the file.

I seem to recall that was actually a ticket for that.

mattlewis said...

Routine id calls are somewhat special in that they transmit their calling point. I think we could make them be evaluated in a similar fashion to everything else, but I'm not certain that we'd really want to, since this is a really handy thing. And it's easy enough to get a local routine id by simply calculating it at the top level as a constant and using that as the default value.

Matt

I said this already - in the part of my post that you quoted. You worded it better, though. tongue

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

Search



Quick Links

User menu

Not signed in.

Misc Menu