Smylers wrote:

cdumont writes:

there are some changes in the grammar which benefits aren't that
obvious :

Hi there.  For some of these the benefit is indirect: it isn't that it
makes the feature in question easier to use; instead it enables _other_
features.

1- $str1 ~ $str2
I do not really understand the new concatenation style when most of
the time it's '+' or '.'

It isn't great, but I'm sure we can live with it.  It frees up dot for
other things.  Anyway, because of interpolation Perl doesn't use
concatenation as much as many other langauges (and even less so in Perl
6 with method calls being interpolatable and braces for conveniently
interpolating any code at all).

It also has the advantage that tilde is consistently used in several
places in Perl 6 to indicate strings.

2- $life = (!$monster) ?? 'safe' !! 'dead';
I don't see how putting 2 questions marks and 2 exclamations marks
make things shorter and easier to understand.

Clearly it doesn't -- but then I don't think anybody is claiming that
that's the reason for the change!

Shortness isn't always a virtue; by using doubled characters they stand
out more, which makes it easier to spot when this operator is being used
-- something that's more important with this operator than most, since
it is split between two positions.

And it frees up some symbols for use in other operators.

I think I can live with the ?? !! thing but ~...

3- given $operator {
when '' {}
}


The given ... when doesn't seem to bring that much from switch ...
case given ...

Surely it brings all of it?  Plus much more as well.   Much of the power
is in the smart-matching, which enables many different sorts of
comparisions, each naturally matching the appropriate thing.  A big
advantage given has over C's switch construct is not having to include
break in the usual case (and get mysterious-yet-silent bugs if you
accidentally forget it).
I understand that given ... when is even more powerful than a simple switch case but why just don't say it this way : this is a switch case dopped with hyper process and
keep the old switch ... case keywords.
I don't know why, this given... when sounds so 'English' without really being that
English.

And hashes require '=>' but it could be nice to switch to ':'

Indeed it could be.  But, unfortunately, the colon seemed to be top of
many people's most-wanted lists, with many different (and mutex)
suggestions for what it should do.  (Remember, only a couple of
paragraphs ago you were wanting to keep it for the ? ... : operator!)
Possibly somebody could design a language in which the colon is the only
symbol used ...

I don't really think using the column in a ternary means that you cannot use it
else where.

because then :(or perhaps we can use whatever separator we want?)

{
elems : {
deleting : {
ids : [1,2,3],
names : ['concatenation','ternary operator','switch']
},
replace : {
with : ['.','?:','switch...case']
}
};
And I know this may not sound that much but it could be sent to
javascript or actionscript or any ecmascript based languages.

The key bit of the above is your parentical comment about using whatever
separator you want -- which is exactly what Perl 6 provides the
flexibility to do.  In Perl 6 it will be possible to do:

 use Grammar::JSON;

and then within that file you can have the above syntax for complex
data-structures.

Or at least, it will if somebody writes the Grammar::JSON module -- but
the whole point of Perl 6's pluggable grammars is that it specifically
supports people who want to do this sort of thing: it recognizes that
not everybody is going to agree on the ideal syntax, so instead it
merely provides a 'default' syntax (which Larry judges to be the best
all-round) then provides a way of changing anything about it.

Hope that helps.
That's sweet !

But I wouldn't want to be most of the time on C6PAN downloading
grammars written in perl6 for perl6.
...

But being able to expand the perl6 grammar is a nice feature that
will be interesting as a learning process for me !

As for the functions, i didn't see that much for hashes and arrays which was
a big disappointment.

Anyway, I think that perl6 has really nice features and I hope people are
going to use it a lot and that the community will be huge!!

The above points are the only things that kind of let me dubious.




Smylers




--
シリル・デュモン(Cyrille Dumont)
[EMAIL PROTECTED]
our work is the portrait of ourselves
tel: 03-5690-0230 fax: 03-5690-7366
http://www.comquest.co.j


Reply via email to