On Tue, Sep 24, 2002 at 11:47:16AM -0700, David Whipp wrote:
> It seems that the fundamental problem is the dichotomy between
> a scalar, and a list of 1 elem. Thus, we want
> 
>   $a = 7
> 
> to DWIM, whether I mean a list, or a scalar. Seems to me that
> the best way to solve a dichotomy is to declare it to not to
> be one: a scalar *IS* a list of one element. The only thing
> that needs to go is the inappropriate casting in numeric
> context.

So you're saying that +$a == 7 is inappropriate and it should be 
+$a == 1?  (since lists in numeric context yield their length)

Or are you saying that lists in numeric context should NOT yield their
length but rather the programmer must type @a.length to get that?

> I think the
> answer is that the sigil defines the default interface
> ("skin"?) on an object. So,
> 
>   $a = 7;
>   @a = 7;
> 
> both create identical objects; but the interface to these
> objects is different. so +$a == 7, while +@a is 1.

Okay ...

> Next:
> 
>   $b = 7, 6, 5
>   @b = 7, 6, 5
> 
> Again, both create identical objects, under different
> interfaces. But now we have a problem with +$b: what should
> this mean? To be consistant with +$a (above), I would
> suggest that it simply returns the sum of its elements
> (i.e. +(1,2,3) == 6).

Makes no sense to me.

if $b and @b are identical objects then what kind of objects are they?
Are the commas list constructors?  If so, then why wouldn't +$b == 3?

        $a = 10; $b = 7,6,5;
        $c = $a + $b;           # what happens here?  Is $c == 28?

Anyway, this is most bizarre.  My little perl 5 brain can't intuit.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to