I hope that construct will be possible with the new compiler, if it isn't already possible to create in todays.
/ Mirar
Previous text:
2003-03-06 14:20: Subject: Re: negative indices in array ranges
Well, first, it's not particularly different from
int foo(int|void zot) { if (zero_type(zot)) zot=17; }
but then again, when I program Pike I rather have Pike think for me then me thinking for Pike. That's kind of the reason to use Pike. If I want to think a lot about what I do, I program in C.
Hence the construct
int foo(int zot=17) { }
would let Pike do the thinking, and I don't have to be even close to the ugly construct that zero_type is. The code also gets much clearer; it's easy to see that zot will be 17 if I don't specify it, instead of lurking around trying to find whatever default value there might be close to a zero_type.
It also better eliminates the chance that someone makes code like
int foo(int|void zot) { if (!zot) zot=17; }
where the function have the same behaviour for the argument 0 and no argument at all, where the behaviour doesn't really correspond to the argument, which is in my opinion rather ugly.
/ Mirar