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.

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.

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

> Why do I think perl has too much line noise? Because of code like this:

>  @{$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).

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.

> Now I've been told several times to bugger off and use python can we take
> that argument as read and get back to some more constructive discussion
about
> what is good in Perl, and what is good in Python too and how Perl might be
> improved.

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"?

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.)

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'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? "

Dirk

Reply via email to