Re: single element lists

2005-05-13 Thread James Mastros
Larry Wall wrote: : If yes, then (1)[0] means the same as 1.[0] and 1.[0][0][0]. If no, : (1)[0] is a runtime error just like 1.[0] -- i.e. unable to find the : matching .[] multisub under Int or its superclasses. Maybe we should just let someone poke a Subscriptable role into some class

Re: single element lists

2005-05-13 Thread Larry Wall
On Thu, May 12, 2005 at 11:52:38PM +0200, James Mastros wrote: : Larry Wall wrote: : : If yes, then (1)[0] means the same as 1.[0] and 1.[0][0][0]. If no, : : (1)[0] is a runtime error just like 1.[0] -- i.e. unable to find the : : matching .[] multisub under Int or its superclasses. : :

Re: single element lists

2005-05-11 Thread Thomas Sandlaß
Jonathan Scott Duff wrote: What does p6l think? (What does @Larry think?) I favor #3 as syntax error. But note $TSa == all( none(@Larry), one($p6l) ) or so :) -- TSa (Thomas Sandlaß)

Re: single element lists

2005-05-11 Thread Juerd
Jonathan Scott Duff skribis 2005-05-11 11:45 (-0500): 1. specialise ()[] to parse as (,)[] 2. scalars are singleton lists, so ()[] naturally 3. make (1)[0] die horribly. #2 implies that (1)[0][0][0][0] == 1 #1 means that (1)[0] == 1 and (1)[0][0] is an error #1 also means that ($aref)[0] is

Re: single element lists

2005-05-11 Thread Rob Kinyon
On 5/11/05, Juerd [EMAIL PROTECTED] wrote: Jonathan Scott Duff skribis 2005-05-11 11:45 (-0500): 1. specialise ()[] to parse as (,)[] 2. scalars are singleton lists, so ()[] naturally 3. make (1)[0] die horribly. #2 implies that (1)[0][0][0][0] == 1 #1 means that (1)[0] == 1 and

Re: single element lists

2005-05-11 Thread Craig DeForest
My perspective from PDL is that (1)[0][0][0]...[0] should evaluate to 1. The artificial distinction between a scalar and an array of length 1 (in each dimension) is the source of endless hassles, and it's a pretty simple DWIM to allow indexing of element 0 of any unused dimension. That makes

Re: single element lists

2005-05-11 Thread Aaron Sherman
On Wed, 2005-05-11 at 12:45, Jonathan Scott Duff wrote: We're discussing the proper semantics of (1)[0] on #perl6. Here's where we're at so far: 1. specialise ()[] to parse as (,)[] 2. scalars are singleton lists, so ()[] naturally 3. make (1)[0] die horribly. It may or may not help, but I

Re: single element lists

2005-05-11 Thread Larry Wall
On Wed, May 11, 2005 at 11:45:12AM -0500, Jonathan Scott Duff wrote: : : We're discussing the proper semantics of (1)[0] on #perl6. Here's : where we're at so far: : : 1. specialise ()[] to parse as (,)[] : 2. scalars are singleton lists, so ()[] naturally : 3. make (1)[0] die horribly. : : We

Re: single element lists

2005-05-11 Thread Autrijus Tang
On Wed, May 11, 2005 at 01:11:45PM -0700, Larry Wall wrote: On Wed, May 11, 2005 at 11:45:12AM -0500, Jonathan Scott Duff wrote: : : We're discussing the proper semantics of (1)[0] on #perl6. Here's : where we're at so far: : : 1. specialise ()[] to parse as (,)[] : 2. scalars are

Re: single element lists

2005-05-11 Thread Larry Wall
On Thu, May 12, 2005 at 04:19:02AM +0800, Autrijus Tang wrote: : Hm? Under #2, no matter whether @foo is (1) or (1,2), the construct : (@foo)[0] would always means @foo.[0]. Not sure how the length of @foo : matters here. Tell you what, let's require P5's (...)[] to be translated to [...][], so

Re: single element lists

2005-05-11 Thread Autrijus Tang
On Wed, May 11, 2005 at 02:12:41PM -0700, Larry Wall wrote: On Thu, May 12, 2005 at 04:19:02AM +0800, Autrijus Tang wrote: : Hm? Under #2, no matter whether @foo is (1) or (1,2), the construct : (@foo)[0] would always means @foo.[0]. Not sure how the length of @foo : matters here. Tell

Re: single element lists

2005-05-11 Thread Larry Wall
On Thu, May 12, 2005 at 05:19:11AM +0800, Autrijus Tang wrote: : Sure (and done). Now that #1 is eliminated, the question is now : whether a simple scalar can be treated as a small (one-element) array : reference, much like a simple pair can be treated as a small : (one-element) hash reference. :

Re: single element lists

2005-05-11 Thread wolverian
On Wed, May 11, 2005 at 11:45:12AM -0500, Jonathan Scott Duff wrote: We're discussing the proper semantics of (1)[0] on #perl6. Here's where we're at so far: 1. specialise ()[] to parse as (,)[] 2. scalars are singleton lists, so ()[] naturally 3. make (1)[0] die horribly. (1)[0] means