Re: Significant whitespace (was Re: Blogging sucks)

[prev] [thread] [next] [lurker] [Date index for 2005/10/17]

From: Juerd
Subject: Re: Significant whitespace (was Re: Blogging sucks)
Date: 08:58 on 17 Oct 2005
Abigail skribis 2005-10-17  9:34 (+0200):
> > In both cases I am talking about the %hash<<key>> syntax (per
> > ASCII-transliterated version of the operator).
> Ah, that one. I think that this week[*] they are going for:
>     %hash<key>

Single angle brackets are for word lists, similar to Perl 5's qw//
operator.

    <foo bar baz>

is just an easy way to write

    ('foo', 'bar', 'baz')

Double angle brackets are also for word lists. Symmetric with quotes,
these interpolate (expand) variables. << and >> can be written as « and
» if you wish. I prefer the ASCII version.

    <<foo bar $quux>>

is just an easy way to write

    "foo bar $quux".split
    # not necessarily ("foo", "bar", "$quux")

Hashes are subscripted with the .{} method:

    %hash.{$key}

The . can be left out in almost all cases, resulting in just

    %hash{key}

However, if one chooses to leave out the dot, whitespace is no longer
allowed, while with the dot, you may have whitespace on its LHS:

    %hash{key}
    %hash.{key}
    %hash .{key}

%hash<key1 key2 ... keyn> and %hash<<key1 key2 ... keyn>> are just
shortcuts: %hash<> is a shortcut for %hash{<>}, and %hash<<>> is a
shortcut for %hash{<<>>}. (Here too, the actual operators are .<> and
.<<>>, and the dot is optional.)

> [*] Actually, that was last week. I've no idea what this weeks syntax
>     is going to be.

This joke is no longer funny, as the design is currently so stable that
basic syntax no longer changes every week.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html
There's stuff above here

Generated at 20:00 on 17 Oct 2005 by mariachi 0.52