Re: Array Questions

2003-01-17 Thread Damian Conway
Michael Lazzaro wrote: Great -- then I have only one more question, I think. In the words of a certain cartoon character, what's *this* button do? my $b is $a; Syntax error, I'd expect. Though the desired effect could probably be achieved with the Cprop meta-property: my $b is

Re: Array Questions

2003-01-17 Thread Damian Conway
Jonathan Scott Duff wrote: will this: my $a $b; be illegal? I certainly hope so! Damian

Re: Array Questions

2003-01-17 Thread Damian Conway
Piers Cawley observed: BTW, Cmy Foo $a is Foo is just sick! (i.e. I'll *definitely* be using it ;-) Surely anyone who does C my Array @foo , or C my Scalar $foo will be using it, albeit indirectly. Of course, but without the brain-twisting effect of the repeated classname. ;-) Damian

Re: Array Questions

2003-01-15 Thread Simon Cozens
[EMAIL PROTECTED] (Michael Lazzaro) writes: Great -- then I have only one more question, I think. In the words of a certain cartoon character, what's *this* button do? my $b is $a; I think at this stage it's probably worth reminding everyone that not every string of characters *needs* to

Re: Array Questions

2003-01-14 Thread Piers Cawley
Michael Lazzaro [EMAIL PROTECTED] writes: On Thursday, January 9, 2003, at 03:24 AM, Damian Conway wrote: Michael Lazzaro asked: class FileBasedHash is Hash { ...stuff... }; my %data is FileBasedHash('/tmp/foo.txt'); Yes. my $path = '/tmp/foo.txt'; my %data is

Re: Array Questions

2003-01-14 Thread Piers Cawley
Damian Conway [EMAIL PROTECTED] writes: Michael Lazzaro wrote: Which, in turn, implies that the lines: my Foo $a; # (1) my $a is Foo; # (2) my Foo $a is Foo; # (3) are all subtly different. (2) and (3) (auto)instantiate a Foo, but (1) does not. Correct. Though the

Re: Array Questions

2003-01-14 Thread Michael Lazzaro
On Tuesday, January 14, 2003, at 02:24 AM, Piers Cawley wrote: Michael Lazzaro [EMAIL PROTECTED] writes: Great -- then I have only one more question, I think. In the words of a certain cartoon character, what's *this* button do? my $b is $a; Compile time error. 'is' is a compile time

Re: Array Questions

2003-01-14 Thread Dan Sugalski
At 9:23 AM -0800 1/14/03, Michael Lazzaro wrote: On Tuesday, January 14, 2003, at 02:24 AM, Piers Cawley wrote: Michael Lazzaro [EMAIL PROTECTED] writes: Great -- then I have only one more question, I think. In the words of a certain cartoon character, what's *this* button do? my $b is

Re: Array Questions

2003-01-10 Thread Michael Lazzaro
On Thursday, January 9, 2003, at 03:24 AM, Damian Conway wrote: Michael Lazzaro asked: class FileBasedHash is Hash { ...stuff... }; my %data is FileBasedHash('/tmp/foo.txt'); Yes. my $path = '/tmp/foo.txt'; my %data is FileBasedHash($path); Indeed Great -- then I have only

Re: Array Questions

2003-01-10 Thread Jonathan Scott Duff
On Fri, Jan 10, 2003 at 10:28:49AM -0800, Michael Lazzaro wrote: Great -- then I have only one more question, I think. In the words of a certain cartoon character, what's *this* button do? my $b is $a; And no matter what that button does, will this: my $a $b; be illegal?

Re: Array Questions

2003-01-10 Thread Luke Palmer
From: Thom Boyer [EMAIL PROTECTED] Date: Fri, 10 Jan 2003 13:57:26 -0700 From: Michael Lazzaro [mailto:[EMAIL PROTECTED]] But I don't know if these two lines would really have the same result, ... $a = MyScalar; $a = 'MyScalar'; Hrmm. Didn't Larry decree that there are

Re: Array Questions

2003-01-09 Thread Damian Conway
Michael Lazzaro asked: OK, next question. Is _THIS_ possible? class FileBasedHash is Hash { ...stuff... }; my %data is FileBasedHash('/tmp/foo.txt'); Yes. Though we would need a syntax for specifying that string parameter for the generic CFileBasedHash class. And, of course, a

Re: Array Questions

2003-01-08 Thread Damian Conway
Michael Lazzaro wrote: my int @a; my @a returns int; my @a is Array of int; my @a is Array returns int; my int @a is Array; Those lines are all absolutely synonymous, and all declare an array of integers, right? Right. (This week, at least ;-) Likewise, Arrays have

Re: Array Questions

2003-01-08 Thread Damian Conway
Jonathan Scott Duff wrote: On Tue, Jan 07, 2003 at 10:04:09AM -0800, Michael Lazzaro wrote: Which, in turn, implies that the lines: my Foo $a; # (1) my $a is Foo; # (2) my Foo $a is Foo; # (3) are all subtly different. (2) and (3) (auto)instantiate a Foo, but (1)

Re: Array Questions

2003-01-08 Thread Luke Palmer
From: Deborah Ariel Pickett [EMAIL PROTECTED] Date: Wed, 8 Jan 2003 09:42:18 +1100 (EST) [...] But everybody has to learn Perl once. I agree with you entirely :) Luke

Re: Array Questions

2003-01-08 Thread Michael Lazzaro
On Wednesday, January 8, 2003, at 02:17 AM, Damian Conway wrote: Jonathan Scott Duff wrote: On Tue, Jan 07, 2003 at 10:04:09AM -0800, Michael Lazzaro wrote: Which, in turn, implies that the lines: my Foo $a; # (1) my $a is Foo; # (2) my Foo $a is Foo; # (3) are all

Re: Array Questions

2003-01-08 Thread Michael Lazzaro
On Wednesday, January 8, 2003, at 02:13 AM, Damian Conway wrote: Michael Lazzaro wrote: The remaining big question, then, is whether you can truly subclass Array to achieve Ctie-like behavior: class MyArray is Array { ... }; my @a is MyArray; Oh yes, I would certainly expect that this

Re: Array Questions

2003-01-08 Thread Chris Dutton
On Wednesday, January 8, 2003, at 01:32 PM, Michael Lazzaro wrote: On Wednesday, January 8, 2003, at 02:13 AM, Damian Conway wrote: Michael Lazzaro wrote: The remaining big question, then, is whether you can truly subclass Array to achieve Ctie-like behavior: class MyArray is Array { ...

Re: Array Questions

2003-01-08 Thread Michael Lazzaro
On Wednesday, January 8, 2003, at 10:39 AM, Chris Dutton wrote: I would ask, if it's possible to inherit from Array or Hash, is it possible to inherit from one which has a constrained storage type? my WeirdHash is int Hash { ... } Yes, I think that was tentatively confirmed a while back.

Array Questions

2003-01-07 Thread Michael Lazzaro
I think this may be another case of it depends on what the word 'object' means, e.g. we're talking past each other. I hope. Let's operate from the assumption -- or somebody please CORRECT ME IF I'M WRONG -- that the following syntax is valid: my int @a; my @a returns int; my @a is

Re: Array Questions

2003-01-07 Thread Jonathan Scott Duff
On Tue, Jan 07, 2003 at 10:04:09AM -0800, Michael Lazzaro wrote: I think this may be another case of it depends on what the word 'object' means, e.g. we're talking past each other. I hope. Let's operate from the assumption -- or somebody please CORRECT ME IF I'M WRONG -- that the

Re: Array Questions

2003-01-07 Thread Mr. Nobody
--- Michael Lazzaro [EMAIL PROTECTED] wrote: Arrays have methods: my int @a = (1..100); print @a.length; # prints 100 my @b = @a.grep { $_ 50 }; # gets 51..100 .length is unneeded, since an array gives its length in numeric context, so you can just say +@a. grep

Re: Array Questions

2003-01-07 Thread Mark J. Reed
On 2003-01-07 at 11:31:13, Mr. Nobody wrote: .length is unneeded, since an array gives its length in numeric context, so you can just say +@a. Unneeded, but harmless. grep shouldn't be an array method either, it should be like the perl5 grep, as it is often used on lists, grep /foo/, keys %h

Re: Array Questions

2003-01-07 Thread Deborah Ariel Pickett
On 2003-01-07 at 11:31:13, Mr. Nobody wrote: .length is unneeded, since an array gives its length in numeric context, so you can just say +@a. Unneeded, but harmless. Getting off topic here (a bit), but I think it's a Mistake to have .length mean different things on an array [Number of

Re: Array Questions

2003-01-07 Thread Michael Lazzaro
On Tuesday, January 7, 2003, at 02:05 PM, Deborah Ariel Pickett wrote: On 2003-01-07 at 11:31:13, Mr. Nobody wrote: .length is unneeded, since an array gives its length in numeric context, so you can just say +@a. Unneeded, but harmless. Getting off topic here (a bit), but I think it's a

Re: Array Questions

2003-01-07 Thread Piers Cawley
Mark J. Reed [EMAIL PROTECTED] writes: On 2003-01-07 at 11:31:13, Mr. Nobody wrote: .length is unneeded, since an array gives its length in numeric context, so you can just say +@a. Unneeded, but harmless. grep shouldn't be an array method either, it should be like the perl5 grep, as it

Re: Array Questions

2003-01-07 Thread Deborah Ariel Pickett
Perhaps .size for number-of-elements and .length for length-of-string would work? sarcasm This would just cause them to Think About Things A Different But Equally Wrong Way: as assembly language objects whose SIZE in bytes is the determining component of their existence. /sarcasm I am