On Fri, Mar 26, 2004 at 08:59:36AM +0100, James Mastros wrote: : Larry Wall wrote: : >Yes, * was originally a no-op in list context, but I think now we can : >use it to deref a list that would otherwise not interpolate itself. : >It maps better onto how a C programmer thinks, and if in scalar : >context it also happens to defer the signature checking to use the : >interpolated values, that's just an extra bonus. : No! Please, God, no! I like perl, in no small part, because references : are less confusing then pointers. Pointers, in no small part, are : confusing because "*" means both "this is a pointer" (as in "int*"), and : "give me the thingy at" (as in "chr=*str"). : : It seems like this is creating the same confusion.
No, the confusion in C is because you never know whether * indicates a single item or the start of a list. In Perl it will only indicate that something should be considered listier than it otherwise would. : > $foo = 0...; # take ref to an infinite range : > @bar = $foo; # puts in the iterator as a reference : > say @bar.elems; # prints 1 : > @bar = *$foo; # puts in 0... : > say @bar.elems; # prints Inf : > @bar = **$foo; # throws exception: "Please install a lot more : > memory" : I hope that Perl will be intelegent enough to notice that the range is : infinite, and say "attempt to flatten infinite list" rather then : "ENOMEM" here. Er, that was a joke... : Also, how does the use of *$foo differ from @$foo here? Is the later : going away? (I'd think that horrible, for the same reason as above: C : is confusing because it's not always clear what you get when you *.) No, @$foo is not going away. You can write it that way when you think it's clearer. The primary use of * is still to defeat the signature, and @$foo doesn't do that. : By the way, I like say, but wonder if we're going to become a horrible : mix of APL and PHP. At least we don't have a Unicode alias for say : (yet, why do I suspect we're about to get a unary » operator for it? I will let other people define their own Unicode alias for "say". And I hope it takes them more than three keystrokes to type. :-) And "say" isn't in there because of APL or PHP. It's actually inspired by something worse in Ruby. : Perhaps I'm just pessimistic this morning.) Don't slit your wrists just yet... Larry