in reply to Re^5: Prototype for constant items???
in thread Prototype for constant items???
I think you know that join was just an example to illustrate why I'm asking for an extended prototype mechanism. Confusion between scalar and list syntax are one of the main traps in perl.
I don't intend to break existing code nor to change CORE::join. I just want to discuss how to widen the possibilities of future code. And this without waiting another decade for the new perl6 "messiah"ยน.
It can't be to difficult to extend the perl5 parser to fill this gap in the prototype definitions. Actually the drawbacks of prototypes are so big that everybody is discouraged to use them.
(Anyway after further meditation I think it was a major design error not to map the scalar of an array on it's ref instead of it's length. An unintentional ref can be much easier spotted at runtime. )
BTW: Your example code won't work with swaped parameters: join @list,$delim since the join of a 1-element list has no delimiter.
Cheers Rolf
(1) don't get me wrong I like perl6, but significantly delaying the evolution of perl5 in consequence is close to osborning.
|
|---|