attriel wrote:
So ... with the discussion of "what if i really wanted to put an undef in
there b/c it's not just that i haven't defined it but rather that it
really isn't defined. I KNOW it's not defined, and i'm now explicitly
saying it's undefined as opposed to before when i was implicitly
sug
So ... with the discussion of "what if i really wanted to put an undef in
there b/c it's not just that i haven't defined it but rather that it
really isn't defined. I KNOW it's not defined, and i'm now explicitly
saying it's undefined as opposed to before when i was implicitly
suggesting that i di
Aaron Sherman wrote:
auto-vivification will have to happen in some cases. e.g. if foo
requires a lvalue parameter. You can't know if an actual write will
happen, so you have to auto-vivify in order to pass a reference.
Or did I miss something there?
I think the idea is to use a special object
Michael Lazzaro wrote:
2a) When a cell is explicitly re-undefined, does the default value take
effect?
my @a is Array( default => 'foo' ) = (1,2,3);
@a[1] = undef;
@a[1]; # undef, or 'foo'?
STRAWMAN ANSWER: 'foo'.
If C is a valid value for a cell, then I should be able
Michael Lazzaro wrote:
The next (oft-asked) question is whether or not C denotes
read-only, or if you can store to an C array.
my @a is computed { $^index**2 };
@a[4] = 'something completely different';
I'd expect that C and C would be orthogonal.
And things like this would be downri
On Tue, Jan 28, 2003 at 03:06:19PM -0800, Damian Conway wrote:
> Austin Hastings wrote:
>
> >--- Damian Conway <[EMAIL PROTECTED]> wrote:
> >
> >>my @a is default(666);
> >>
> >>print @a[2];# prints 666
> >>
> >>@a[4] = 1;
> >>
> >>print @a[2];# now prints undef :-(
>
> [t
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
On Tue, Jan 28, 2003 at 04:07:17PM -0500, Aaron Sherman wrote:
> I think this debate is easier if you think of defaults as overriding and
> auto-vivification method on a container.
Hmm. I don't :-)
I think it is easier if you think of defaults as overriding undef.
> On Tue, 2003-01-28 at 14:47
Nicholas Clark wrote:
> I'm not sure. I think I like the idea of
>
> @a[0] = undef;
>
> being a blip, but
>
> undef @a[0];
>
> resetting the value to the default.
That thought crossed my mind as well before I got to your message ...
> Conceptually perl5 already has a distinction between
Austin Hastings wrote:
--- Damian Conway <[EMAIL PROTECTED]> wrote:
my @a is default(666);
print @a[2]; # prints 666
@a[4] = 1;
print @a[2]; # now prints undef :-(
[typo in third line corrected]
I don't understand your example. Can you explain it again, using words
of less than one
On Tue, Jan 28, 2003 at 02:13:22PM -0800, Michael Lazzaro wrote:
> Hmm. I don't have a strong preference either way, but I'm not sure why
> (given C):
>
>@a[ undef ]
>
> C should be autoconverted to 0 with warning, but in:
>
>@a[0] = undef;
>
> C should _not_ be autoconverted to 0, b
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
>
> On Tuesday, January 28, 2003, at 01:01 PM, Nicholas Clark wrote:
> > On Tue, Jan 28, 2003 at 12:30:41PM -0800, Austin Hastings wrote:
> >> --- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
> >>> my int @a is Array( default => 5 );
> >>> @
Austin Hastings wrote:
> --- Austin Hastings <[EMAIL PROTECTED]> wrote:
>
> > No, undef. OTOH, deleting @a[1] would reset it to default.
>
> Ere someone flames my for using a hash keyword in an array context:
>
> s/deleting/absquatulating (e.g., via pop, shift, or splice)/
What's wrong with C
Michael Lazzaro wrote:
2) There is NO platform-dependent maximum array size. If it's not a
sparse array, you'll run out of memory long before you run out of
indexes, but using bigints as indexes for sparse arrays is OK.
Current: array size is limited to $arch's +INTVAL (2^31-1 / 2^63-1).
Arr
--- Damian Conway <[EMAIL PROTECTED]> wrote:
> Austin Hastings wrote:
> > --- Austin Hastings <[EMAIL PROTECTED]> wrote:
> >
> >
> >>No, undef. OTOH, deleting @a[1] would reset it to default.
> >
> >
> > Ere someone flames my for using a hash keyword in an array context:
> >
> > s/deleting/ab
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
On Tuesday, January 28, 2003, at 01:01 PM, Nicholas Clark wrote:
On Tue, Jan 28, 2003 at 12:30:41PM -0800, Austin Hastings wrote:
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
my int @a is Array( default => 5 );
@a[0] = undef;
This should cause a blip of some kind. If storing an e
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
On Tuesday, January 28, 2003, at 01:14 PM, Damian Conway wrote:
I'm not compelled by the counter-argument that this makes it
impossible to store an C in an array with a default. Because
the whole point of an array having a default is to prevent those nasty
out-of-range Cs from popping up in t
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.
--
On Tue, 2003-01-28 at 16:23, Leopold Toetsch wrote:
> Austin Hastings wrote:
>
>
> > Another question: If you ask for a value and get it, does the array
> > grow? Or does that happen only on assignment? (
>
>
> Arrays (or hashes) don't grow on reading - never.
Never say never. You're correct f
Austin Hastings wrote:
Another question: If you ask for a value and get it, does the array
grow? Or does that happen only on assignment? (
Arrays (or hashes) don't grow on reading - never.
And another anser from current low level (list.c & classes/Array.pmc)
*Return value
*---
Michael Lazzaro wrote:
Where is whatever the type-specific
...or user specified...
default is, typically C, C<0>, or C<''>.
Damian
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
On Tue, Jan 28, 2003 at 12:30:41PM -0800, Austin Hastings wrote:
>
> --- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
> > my int @a is Array( default => 5 );
> > @a[0] = undef;
>
> This should cause a blip of some kind. If storing an explicit undef (as
> opposed to "undef but 0" or C<$v
On Mon, Jan 27, 2003 at 01:02:28PM -0800, Austin Hastings wrote:
>
> --- Nicholas Clark <[EMAIL PROTECTED]> wrote:
> > On Mon, Jan 27, 2003 at 11:00:17AM -0800, Michael Lazzaro wrote:
> > > locked => 1, # read-only, can't store new values
> >
> > There was a discussion on p5p a
On Tue, Jan 28, 2003 at 09:17:36AM -0800, Damian Conway wrote:
> Errno. That's rather the whole point of C properties [*].
> [*] People, we just *have* to find better names for these things!
> I'd suggest we henceforth call them "value" properties (for C)
> and "referent" properties (f
Austin Hastings wrote:
--- Austin Hastings <[EMAIL PROTECTED]> wrote:
No, undef. OTOH, deleting @a[1] would reset it to default.
Ere someone flames my for using a hash keyword in an array context:
s/deleting/absquatulating (e.g., via pop, shift, or splice)/
Unfortunately, I don't think we
I think this debate is easier if you think of defaults as overriding and
auto-vivification method on a container.
On Tue, 2003-01-28 at 14:47, Paul Johnson wrote:
> Michael Lazzaro said:
> > 2a) When a cell is explicitly re-undefined, does the default value take
> > effect?
> >
> > my @a is
Corrected in accordance with design team member feedback. These should
be solid, now. Thanks much for the responses.
1) Edge cases in array indexing:
my @a = (1,2,3);
@a[0] # 1
@a[1] # 2
@a[2] # 3
@a[3] # (warning: index out-of-bounds
--- Austin Hastings <[EMAIL PROTECTED]> wrote:
> No, undef. OTOH, deleting @a[1] would reset it to default.
Ere someone flames my for using a hash keyword in an array context:
s/deleting/absquatulating (e.g., via pop, shift, or splice)/
=Austin
Michael Lazzaro wrote:
OK, here are the answers so far -- or more accurately, strawman
interpretations of those answers that should be objected to if they're
wrong.
1) Edge cases in array indexing:
my int @a = (1,2,3);
@a[0] # 1
@a[1] # 2
@a[2] # 3
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
> 1) What's the final decided syntax? Two possibilities:
>
> my @a is Array( default => 'foo' ); # attrib?
> my @a is default('foo');# property?
Since we want arrays (lowercase) to support them, too, it should be a
pro
Michael Lazzaro said:
>
> There has been discussion of allowing a "default" value for array cells
> -- that is, one aside from C or whatever the type-specific
> default is. Questions, in order of increased evilness:
1 and 2 seem fine to me.
> 2a) When a cell is explicitly re-undefined, does th
On Tue, Jan 28, 2003 at 01:30:54PM -0600, Jonathan Scott Duff wrote:
> On Tue, Jan 28, 2003 at 11:15:26AM -0800, Michael Lazzaro wrote:
> > 2) Assume the default value is a simple value, e.g. 'foo'.
> >
> > my @a is Array( default => 'foo' );
> > @a[5] = 'bar';
> >
> > @a[4]; #
--- Damian Conway <[EMAIL PROTECTED]> wrote:
>
> [*] People, we just *have* to find better names for these things!
> I'd suggest we henceforth call them "value" properties (for
> C) and "referent" properties (for C).
Hmm. According to this, C would therefore be a
malvalapropism, no?
=Austi
On Tue, Jan 28, 2003 at 11:15:26AM -0800, Michael Lazzaro wrote:
> 2) Assume the default value is a simple value, e.g. 'foo'.
>
> my @a is Array( default => 'foo' );
> @a[5] = 'bar';
>
> @a[4]; # 'foo'
> @a[5]; # 'bar'
> @a[6]; # 'foo'
>
> @a[-1];# '
There has been discussion of allowing a "default" value for array cells
-- that is, one aside from C or whatever the type-specific
default is. Questions, in order of increased evilness:
1) What's the final decided syntax? Two possibilities:
my @a is Array( default => 'foo' ); # attri
On Tue, 28 Jan 2003, Dan Sugalski wrote:
> At 10:13 AM -0800 1/28/03, Michael Lazzaro wrote:
>
> > @a[ Inf ] # undef (warning: can't use Inf as array index)
>
> I'd throw an exception here.
>
> > @a[-4]# undef (warning: index out-of-bounds)
> > @a[-Inf] # undef
On Tuesday, January 28, 2003, at 10:20 AM, Dan Sugalski wrote:
At 10:13 AM -0800 1/28/03, Michael Lazzaro wrote:
1) Edge cases in array indexing:
my int @a = (1,2,3);
@a[3] # undef (warning: index out-of-bounds)
Or a real 0, since you said @a can only return integers.
At 10:13 AM -0800 1/28/03, Michael Lazzaro wrote:
OK, here are the answers so far -- or more accurately, strawman
interpretations of those answers that should be objected to if
they're wrong.
I think some of this is incorrect which, because Damian thinks
otherwise, will need some hashing out f
OK, here are the answers so far -- or more accurately, strawman
interpretations of those answers that should be objected to if they're
wrong.
1) Edge cases in array indexing:
my int @a = (1,2,3);
@a[0] # 1
@a[1] # 2
@a[2] # 3
@a[3] # undef
Damian Conway <[EMAIL PROTECTED]> writes:
> Piers Cawley wrote:
>
>> Bugger. I was hoping that Perl 6 was going to make a Pixie like Object
>> database easier to write; looks like I'm wrong. One of the things
>> Pixie does is to attach its control data by magic to the object itself
>> (rather than
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
Dan Sugalski <[EMAIL PROTECTED]> writes:
> At 8:46 AM + 1/28/03, Piers Cawley wrote:
>>Bugger. I was hoping that Perl 6 was going to make a Pixie like Object
>>database easier to write; looks like I'm wrong. One of the things
>>Pixie does is to attach its control data by magic to the object it
--- 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
Piers Cawley wrote:
Bugger. I was hoping that Perl 6 was going to make a Pixie like Object
database easier to write; looks like I'm wrong. One of the things
Pixie does is to attach its control data by magic to the object itself
(rather than any particular variable pointing to it). This lets us do
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
At 8:46 AM + 1/28/03, Piers Cawley wrote:
Bugger. I was hoping that Perl 6 was going to make a Pixie like Object
database easier to write; looks like I'm wrong. One of the things
Pixie does is to attach its control data by magic to the object itself
(rather than any particular variable pointin
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
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.
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.
>
Damian Conway <[EMAIL PROTECTED]> writes:
> Dave Whipp wrote:
>
>> OK, I've assimilated all that (though it still feels wrong). I think you are
>> saying that of the following, the 4th is an error.
>> my @d = @x but Foo; # error: no values involved in this assignment
>
> Correct. Although presum
53 matches
Mail list logo