"Myers, Dirk" wrote:
> 
> Karl Glazebrook wrote:
> 
> > But what is $x[3] ?
> 
> >  It could be a scalar.
> 
> >  BUT it could be a reference to a list.
> 
> >  It could be a reference to a 2D PDL image.
> 
> ... but references are scalar.  So, $x[3] *is* a scalar.
> 
> That scalar could be a reference to a list.  It could be a reference to a 2D
> PDL image.  It could also contain a tar of the perl source distribution.  We
> can *never* tell what a scalar contains just by looking at it.

exactly.

> I don't think this is a problem with the line-noise markers themselves -- I
> think this ambiguity is inherent in the idea of scalars, and the idea that
> references are scalar.  On the surface this seems reasonable: a reference is
> a single thing.  The implications of that idea lead to ugly code, though.

yes.

> So maybe the idea of scalars isn't useful for references, and maybe it's
> worth suggesting that references shouldn't really be scalars...

Yes, I guess what I am arguing is because we are now using references for
most things the concept of @lists as such as of little use.

> >  @{$x->{$$fred{Blah}}}[1..3]
> 
> Ugh.  I hope no one's arguing that this is pretty.  (In fact, I think anyone
> who believes this is pretty or elegant should probably not be allowed near
> sharp objects...)
> 
> On the other hand, I'm not convinced that just cutting the line noise helps.
> It seems to me that the concept of really only having three first-class data
> types (scalar, hash, array), the fact that these types are intimately tied
> to context, and the fact that perl will do some automagic context-dependent
> stuff limits the amount of change we can make without altering perl beyond
> recognition.
> 
> In particular:
> 
> @x[3] = grep &foo, @bar ;
> 
> and
> 
> $x[3] = grep &foo, @bar ;
> 
> have very different results because of context.  Changing this is a big deal
> for the way perl works (at least from my point of view).

It depends on whether we are after a radical redefinition of the language
or not. 

 
> Further, it really looks to me like the basic complaint isn't with the
> markers themselves, but rather that dereferencing complicated things is not
> just complicated, but *really* complicated.

And confusing. 

> I think some of these comments have been meant as "go away and use Python",
> but I think some of them were meant as "what can Perl learn from Python"?

That's where I am coming from.
>
> Personally, I want to know what Perl should learn from Python.  (I've kind
> of liked Python when I've used it, but it doesn't run reliably on some of
> the platforms I need to have my stuff work on. Because of this, I seldom use
> Python, and I'm not familiar enough with it to know what the good points
> are.)

I think it's the cleaner object syntax and the was you can pass everything
around by reference without a lot of $@{} - which IS confusing.

> Back to line noise: do I support removing line noise?  Nope.  Do I support
> the current dereferencing syntax?  I'm not fond of it for complicated
> expressions.  I don't have a better suggestion, though.

I am glad my suggestion has at least triggered some debate. 

> I'm glad this is getting discussed, because I'd like to see it improved, but
> I don't have any answers.  I just wanted to throw in my $0.02, though, and
> say thanks very much for bringing up what I think is the *real* question
> here... which is "can we improve the syntax for dereferencing thingys? "

Indeed.

Karl

Reply via email to