Ariel Scolnicov wrote:
>
> Karl Glazebrook <[EMAIL PROTECTED]> writes:
>
> [...]
>
> > o Why do I think perl has too much line noise? Because of code like this:
> >
> > @{$x->{$$fred{Blah}}}[1..3]
>
> This is indeed horrible. However, I fail to see how cutting out the
> "line noise" would make it easier to decipher (I can, however, see how
> splitting it into several expressions, possibly after signing travel
> papers for the programmer, would improve it immeasurably). Could you
> post the proposed "new code", along with explanations of the proposed
> syntax?
>
> That way us "people will die of suffocation at speeds above 12kmh"
> old-fashioned perl4-head !@#$&*#@$[->}})[-lovers will have a concrete
> proposal in front of our eyes. I contend that any consistently
> extendable proposal will lead to horrors at least on the scale of the
> example above.
>
> I hate the example above! Please prove me wrong!
I can see this is a good way to provide a concrete target for people to
aim at!
OK I would go for
($x[$fred{Blah}])[1..3]
I am imagining a language were all arrays and hashes are implicitly passed by
reference, so I only need $fred{Blah} not $$fred{Blah},
that also gets rid of the ->. So $x[$fred{Blah}] is an array, then I am making
up some syntax for taking the elements of something complicated instead of
$array[1..3], other syntaxes might be possible. This still looks complicated but
less so - and all you have to do to figure out what is going on is count braces.
Maybe even
$x[$fred{Blah}][1..3]
would be possible - the problem with pretend languages is that you don't get to debug
them!
(I am assuming a multidim would be $x[a,b,c] not $x[a][b][c])
or a better syntax to me would be
$x[$fred{Blah}][1:3]
as a:b is what every other language uses for ranges. But that is another story!
I guess they key point is that if everything is a reference then we don't have
to worry about de-referencing all the time and other godawfulness. So I might
say
$x=[1,2,3]; # Or whatever shape brackets
$x[42] = 2;
and pass $x to a subroutine and use it in exactly the SAME WAY. (i.e. not @$x[42] -
yes I have heard of prototypes).
Maybe I should write another RFC, if I dare!
Karl