On Thu, May 04, 2006 at 01:56:44PM +0300, Markus Laire wrote:

> On 5/1/06, Paul Johnson <[EMAIL PROTECTED]> wrote:
>
> >But then again, as I said, I really don't see the problem that is being
> >solved.
> 
> This "long-dot" can be used for many things, not just method calls.

Thanks for taking the time to explain this.  The long dot here does seem to be
solving more important problems.  Now I'm not as up to date with Perl 6 syntax
as I once was, nor as much as I probably should be to be part of this thread,
but ...

> IMHO This example from S03 is a lot better:
> 
> <quote>
> Whitespace is no longer allowed before the opening bracket of an array
> or hash accessor. That is:
> 
>    %monsters{'cookie'} = Monster.new;  # Valid Perl 6
>    %people  {'john'}   = Person.new;   # Not valid Perl 6

What does "Not valid Perl 6" mean?  A syntax error?  Is it not possible
to make it valid and to mean what would be meant without the whitespace?

Thinking about it a bit, I suppose the problem would be how to parse
something like

  if $person eq %people  {'john'} { ... }

which would be valid whichever way you parsed it, right?

> One of the several useful side-effects of this restriction is that
> parentheses are no longer required around the condition of control
> constructs:
> 
>    if $value eq $target {
>        print "Bullseye!";
>    }
>    while 0 < $i { $i++ }
> 
> It is, however, still possible to align accessors by explicitly using
> the long dot syntax:
> 
>     %monsters.{'cookie'} = Monster.new;
>     %people\ .{'john'}   = Person.new;
>     %cats\   .{'fluffy'} = Cat.new;
> </quote>

I'm probably not seeing what the rest of the "several useful
side-effects" are, and I'm probably far too conservative,  but given the
choice between the following I know which one I would choose.

    if ($value eq $target) {
        $monsters{cookie} = Monster->new;
        $people  {john  } = Person ->new;
        $cats    {fluffy} = Cat    ->new;
    }

    if $value eq $target {
        %monsters.{'cookie'} = Monster.new;
        %people\ .{'john'  } = Person\.new;
        %cats\   .{'fluffy'} = Cat\   .new;
    }

    if $value eq $target {
        %monsters.<cookie> = Monster.new;
        %people\ .<john>   = Person\.new;
        %cats\   .<fluffy> = Cat\   .new;
    }

However, I'm really not looking to drive perl6-language round in circles, so if
there is some document somewhere explaining the rest of the several useful
side-effects I'd love a pointer to it (I couldn't find anything appropriate).
Otherwise I'll hope that, as has happened a number of times before, someone
will decide that this is too ugly to live and will create something nicer.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to