Demagicalizing pairs

2005-08-19 Thread Luke Palmer
We've seen many problems come up with the current special treatment of pairs. Here's what I can think of: * Pairs are restricted to a particular position in the argument list, which leads to confusion (why isn't this being passed named?) and poor end-weight in something like this:

Re: Demagicalizing pairs

2005-08-19 Thread Larry Wall
On Fri, Aug 19, 2005 at 10:31:34AM +, Luke Palmer wrote: : I propose that we move the magic out of the Pair type, and into a : syntactic form. That's kinda the direction we were already moving with the *%foo proposal, so I think I like it, but I'll need to steep my brain in a bit more

Re: Demagicalizing pairs

2005-08-19 Thread Yuval Kogman
On Fri, Aug 19, 2005 at 10:31:34 +, Luke Palmer wrote: In short, me too. Now some comments: foo($a, $b, $c) You *know* that you're passing three positionals. This is very very important for least surprise and all that. It's much less work for the runtime. You don't have to scan

Re: Demagicalizing pairs

2005-08-19 Thread Larry Wall
Hmm, if we take + away from named, it can become the required marker, so sub foo ($a,$b,?$c) is really short for sub foo (+$a,+$b,?$c) and required named parameters then become sub bar (+:$key) And, of course, that means that sub baz (+?$key) is a required optional

Re: Demagicalizing pairs

2005-08-19 Thread Yuval Kogman
On Fri, Aug 19, 2005 at 08:27:38 -0700, Larry Wall wrote: Plus I still think it's a really bad idea to allow intermixing of positionals and named. We could allow named at the beginning or end but still keep a constraint that all positionals must occur together in one zone. This is something

Re: Demagicalizing pairs

2005-08-19 Thread Larry Wall
On Fri, Aug 19, 2005 at 06:30:41PM +0300, Yuval Kogman wrote: : On Fri, Aug 19, 2005 at 10:31:34 +, Luke Palmer wrote: : : In short, me too. : : Now some comments: : : foo($a, $b, $c) : : You *know* that you're passing three positionals. : : This is very very important for least

Re: Demagicalizing pairs

2005-08-19 Thread Larry Wall
On Fri, Aug 19, 2005 at 08:39:24AM -0700, Larry Wall wrote: : Actually, that's an argument that : is in a different class than the regex : quantifiers, and required named should be : : sub bar (+$:key) : : as I speculated earlier. Maybe we just force that to bind to $key instead : of $:key.

Multidimensional hyper

2005-08-19 Thread Luke Palmer
What is the resulting data structure in each of the following: - [1, 2] - [[1,2], [3,4]] - [[1,2], 3] [[1,2], 3] + [[4,5], 6] [1, 2, [3]] + [[4,5], 6] Luke

Re: Multidimensional hyper

2005-08-19 Thread Larry Wall
On Sat, Aug 20, 2005 at 04:13:02AM +, Luke Palmer wrote: : What is the resulting data structure in each of the following: : : - [1, 2] [-1, -2] : - [[1,2], [3,4]] [[-1,-2], [-3,-4]] This is assuming that AoA is treated as a two dimensional shape, of course. One could imagine

Synopsis 3 Update

2005-08-19 Thread Luke Palmer
Here is an update to Synopsis 3 incorporating recent additions. If any of this is wrong or disagreeable, this is the time to say so. Luke S03.pod.diff Description: Binary data