Re: Spare brackets :-)

2003-01-29 Thread Smylers
Michael G Schwern wrote: > On Tue, Jan 28, 2003 at 12:11:18PM +1300, [EMAIL PROTECTED] wrote: > > > Has anyone considered removing with the syntactic distinction > > between numeric and string indexing -- that is, between array and > > hash lookup? > > PHP works this way. Well, for some definit

Re: Spare brackets :-)

2003-01-29 Thread Aaron Sherman
On Wed, 2003-01-29 at 05:29, Leopold Toetsch wrote: > John Williams wrote: > > > I think you are still overlooking the autovivification behavior. > > i.e. What is the difference between these: > > > >1) $a{1234567} = 1; > > > >2) $a[1234567] = 1; > > > > Answer: #1 creates 1 element

Re: Spare brackets :-)

2003-01-29 Thread Austin Hastings
--- Sam Vilain <[EMAIL PROTECTED]> wrote: > =head2 includes( [ I, ] [ I ]) Where the and/or are obviously junctions. if ($container.includes(any("ant", "beaver", "cow", "duck"))( ... This is *SO* cool. =Austin

Re: Spare brackets :-)

2003-01-29 Thread Leopold Toetsch
John Williams wrote: I think you are still overlooking the autovivification behavior. i.e. What is the difference between these: 1) $a{1234567} = 1; 2) $a[1234567] = 1; Answer: #1 creates 1 element. #2 creates 1,234,567 elements! Not currently: 2) does - generate a sparse hole be

Re: Spare brackets :-)

2003-01-29 Thread Sam Vilain
On Wed, 29 Jan 2003 18:04, Michael G Schwern wrote: > On Tue, Jan 28, 2003 at 12:11:18PM +1300, [EMAIL PROTECTED] wrote: > > This may sound like a silly idea but ... > > > > Has anyone considered removing with the syntactic distinction between > > numeric and string indexing -- that is, between arr

Re: Spare brackets :-)

2003-01-29 Thread martin
>> In particular, it would seem that >> %foo[$key] >> would be just as easy for the compiler to grok as >> %foo{$key} On Mon, 27 Jan 2003 15:39:19 -0800, Damian Conway <[EMAIL PROTECTED]> wrote: > Sure. But then is this: > > $ref[$key] > > an array or hash look-up??? Yes, well I suppose t

Re: Spare brackets :-)

2003-01-29 Thread Michael G Schwern
On Tue, Jan 28, 2003 at 12:11:18PM +1300, [EMAIL PROTECTED] wrote: > This may sound like a silly idea but ... > > Has anyone considered removing with the syntactic distinction between > numeric and string indexing -- that is, between array and hash lookup? PHP works this way. http://www.php.net/m

Re: Spare brackets :-)

2003-01-29 Thread John Williams
On 28 Jan 2003, Aaron Sherman wrote: > I'm not sure I recall the sufficient, yet irrelevant technical reasons. > I certainly can't think of anything. It also helps in the case of > objects that are non truly arrayish or hashish: > > my SuperTree $foo; > $foo["Munge"]; # Returns the nod

Re: Spare brackets :-)

2003-01-28 Thread Adam Turoff
On Tue, Jan 28, 2003 at 09:24:50AM -0800, Austin Hastings wrote: > --- Dan Sugalski <[EMAIL PROTECTED]> wrote: > > At 8:47 AM + 1/28/03, Piers Cawley wrote: > > >> $ref[$key] > > >> > > >> an array or hash look-up??? > > > > > >Decided at runtime? > > > > How? People use strings as array ind

Re: Spare brackets :-)

2003-01-28 Thread Dan Sugalski
At 5:07 PM -0500 1/28/03, Aaron Sherman wrote: On Tue, 2003-01-28 at 16:34, Dan Sugalski wrote: At 4:17 PM -0500 1/28/03, Aaron Sherman wrote: > Now the question becomes, do you WANT them >for readability? Given that Larry's answer has been a resounding "yes" all along, I'm not sure that

Re: Spare brackets :-)

2003-01-28 Thread Aaron Sherman
On Tue, 2003-01-28 at 16:34, Dan Sugalski wrote: > At 4:17 PM -0500 1/28/03, Aaron Sherman wrote: > > Now the question becomes, do you WANT them > >for readability? > > Given that Larry's answer has been a resounding "yes" all along, I'm not sure that this specific case was brought up. I rememb

Re: Spare brackets :-)

2003-01-28 Thread Dan Sugalski
At 4:17 PM -0500 1/28/03, Aaron Sherman wrote: Now the question becomes, do you WANT them for readability? Given that Larry's answer has been a resounding "yes" all along, the technical reasons (Which are, themselves, sufficient) are pretty irrelevant. --

Re: Spare brackets :-)

2003-01-28 Thread Aaron Sherman
On Tue, 2003-01-28 at 11:49, Dan Sugalski wrote: > At 8:47 AM + 1/28/03, Piers Cawley wrote: > >Damian Conway <[EMAIL PROTECTED]> writes: > > > Sure. But then is this: > >> > >>$ref[$key] > >> > >> an array or hash look-up??? > > > >Decided at runtime? > > How? People use strings as arra

Re: Spare brackets :-)

2003-01-28 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > At 8:47 AM + 1/28/03, Piers Cawley wrote: >>Damian Conway <[EMAIL PROTECTED]> writes: >> > Sure. But then is this: >>> >>> $ref[$key] >>> >>> an array or hash look-up??? >> >>Decided at runtime? > > How? People use strings as array indices and i

Re: Spare brackets :-)

2003-01-28 Thread Austin Hastings
--- Dan Sugalski <[EMAIL PROTECTED]> wrote: > At 8:47 AM + 1/28/03, Piers Cawley wrote: > >Damian Conway <[EMAIL PROTECTED]> writes: > > > Sure. But then is this: > >> > >>$ref[$key] > >> > >> an array or hash look-up??? > > > >Decided at runtime? > > How? People use strings as array in

Re: Spare brackets :-)

2003-01-28 Thread Dan Sugalski
At 8:47 AM + 1/28/03, Piers Cawley wrote: Damian Conway <[EMAIL PROTECTED]> writes: > Sure. But then is this: $ref[$key] an array or hash look-up??? Decided at runtime? How? People use strings as array indices and ints/floats as hash indices, and count on autoconversion to Make It W

Re: Spare brackets :-)

2003-01-28 Thread Damian Conway
Sure. But then is this: $ref[$key] an array or hash look-up??? Decided at runtime? Doesn't help if $ref refers to a type that has both hash-like and array-like accessability. And that will be very common, since all Perl 6 regexes return such objects. Damian

Re: Spare brackets :-(

2003-01-28 Thread John Williams
ECMAscript already tried this. Bad idea. If your hash keys happen to look like large numbers (e.g. you have 7-digit product codes) as soon as you store one of them, it says: "Oh, this looks like a number, so we'll store it like an array" and happily creates a million empty array entries for you.

Re: Spare brackets :-)

2003-01-28 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> This may sound like a silly idea > > It's been suggested previously. > > >> Has anyone considered removing with the syntactic distinction between >> numeric and string indexing -- that is, between array and hash lookup? > > Yes. We rejected the idea. >

Re: Spare brackets :-)

2003-01-27 Thread Damian Conway
This may sound like a silly idea It's been suggested previously. Has anyone considered removing with the syntactic distinction between numeric and string indexing -- that is, between array and hash lookup? Yes. We rejected the idea. In particular, it would seem that %foo[$key] would b

Spare brackets :-)

2003-01-27 Thread martin
This may sound like a silly idea but ... Has anyone considered removing with the syntactic distinction between numeric and string indexing -- that is, between array and hash lookup? In particular, it would seem that %foo[$key] would be just as easy for the compiler to grok as %foo{$key}