From: "Dave Mitchell" <[EMAIL PROTECTED]> > But perl5 already does this:
Dave gets the "First to Point Out the Feature Exists" award. I knew that out of three ideas I'd be lucky if just one of them was actually a new feature idea. I might still say that the parens don't make things quite obvious... what if I need to use parens for a complex regex but *don't* want the delimiters? But I'm not sure that it's worth changing if it already exists in some form. From: "Damian Conway" <[EMAIL PROTECTED]> [talking about the boolean representation thing] > Though I must say I can't see the real need for this. Especially when > you can prefix any boolean expression with unary + and ensure that > any ""s are converted to 0's anyway. .... what would "true" (the string) be converted to? Here's my point more explicitly: in a boolean context, there's no need to get any specific string (0, 1, "yup") as long as it correctly expresses true or false. It's when you convert a boolean into a string or number that it becomes convenient to define how they are represented by default. Yes, of course there are already ways to change a variable from [some representation of false] to 0, but by giving a slick way to default the string, a lot of ?? :: type stuff can be done away with. > { > temp sub false() {0} > # etc. > } That sounds like a great way to do it. A follow up question, then: would it be easy enough to accomplish that in a use-type format? I.e., something like I said earlier: use StrictBoolean TRUE=>1, FALSE=>0; or even just let it default: use StrictBoolean; > > @arr[] = $var; > > > I have to admit that don't find that syntax very intuitive. > Besides, in Perl 5 the same functionality just: > > $arr[@arr] = $var; > > In Perl 6, that would be: > > @arr[+@arr] = $var; > > or: > > @arr[@arr.length] = $var; > > or maybe just : > > @arr[.length] = $var; The issue of what is more intuitive is of course highly subjective, but I would argue that for several reasons the more concise version is more unituitive to the population at large: - Generally, shorter is better as long as it isn't ambiguous (maybe it is ambigous, what do you think?) - It doesn't get bogged down in what the stuff in the braces means - Those +s and ?s and _s are going to take some getting used to. People will probably learn this little shortcut faster than they learn the new casting symbols. - There's already a huge population of programmers out there who already use this notation. I frankly admit that I think of PHP as a great idea that wasn't done quite right. I'd love to see the PHPers of the world migrate to Perl. Oh, and sorry about the subject line in the previous email... my cut-n-pasting was off target. -Miko