On Sun, Nov 09, 2008 at 08:00:03PM +0000, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
and then tail recurse (no need to do anything with the stack). Iirc it even gets optimized to an alias to the same function in the identifier table in sufficiently recent pikes (Grubba would know).
ah, nice. what about type checking?
And besides, lugging around variables in every object containing the same function pointers isn't exactly pretty.
how is that different from lugging around the wrapper function?
I can agree about readability, although I don't think it's worth the price.
in a big system with lots of people (and i am using my current job as an example where 30 developers work on a system for 4 years or more and every month a new developer joins the team) readability of the code can become critical.
The proper way to do it would have been a constant: constant `-> = `[];
well, except in the case of lib/modules/Calendar.pmod/Timezone.pmod is the if(names) check (which now happens every time) faster/better than the variable lookup?
But that currently doesn't work since the compiler doesn't consider `[] to be a constant expression. As long as it is in the same class it would be constant though, so it's probably not that difficult to fix.
hmm, if constant would take a type (constant function `-> = `[];) would that help the compiler to accept `[] as a constant expression?
also, is that specific to `[] similar functions or does that problem exist with any function?
greetings, martin.