develooper Front page | perl.perl6.language | Postings from November 2004

Re: Angle quotes and pointy brackets

Thread Previous | Thread Next
From:
Luke Palmer
Date:
November 30, 2004 19:34
Subject:
Re: Angle quotes and pointy brackets
Message ID:
20041201033414.GA12019@navi.cx
All the cool kids are thinking aloud these days.  Why not jump on the
bandwagon?

Larry Wall writes:
>     * We get the cute, clean and rather more typeable
> 
> 	$var<key1><key2>[3]<key3>

It looks like if you shook that up and down a bit, it would break in
half.

I wonder what would happen if we made <> a little smarter, as in:

    * <foo ; bar> acts as a multidimensional subscript (* but what for
          @array = <foo ; bar>?)
          
    * <+42> returns a number instead of a string.

Then:

    $var<foo ; bar ; +3 ; baz>

Which is certainly less noisy than the kitkat above.  Problems:

    * -foo is common for options; don't want to force a number.  Then
          again, you don't see -6 as an option too often.

    * Doesn't solve anything in the practical scenario where some of
          your keys are not constant.  But we'd, of course, do the same
          thing to «».

However, there's a problem with «»: it doesn't generalize to non-string
keys (since «$foo» can reasonably only stringify).  That is:

    $var«foo ; $bar ; +3»

Doesn't work if $bar is something unstringly that happens to be the key
type of the second dimension.

Not to mention that if we allowed semicolon, «» would be the common one
again, and we'd be in for another switcheroo.

Anyway, I think there's something wrong with:

    $var<foo><bar>[3]<baz>

It doesn't hold together visually.

This might have some relation to the other problem on my mind: the
difference between $, @, and % these days.

The rest of the proposal is pretty snazzy, though.

Luke

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About