Larry Wall larry-at-wall.org |Perl 6| wrote:

The initializer needs to go =inside= the signature. I think you meant to write


  (my int8 ($x, $y)) «=« 127;

It should already parse that way.  scope_declarator is a noun,
and nouns may be used on the left side of an infix operator.  When
scope_declarator sees something it doesn't recognize, it just stops,
so EXPR picks it up.

OK, I didn't realize that. Even if I had studied all the order of precedence in detail yet, I didn't realize it "just stopped". That is somewhat different than in most languages.



Now, it could be argued that it *should* be considered part of the 'my',
though in the case of 'my' it makes no difference.  It could make a
difference for, say, 'state', though.


I can imagine people who don't know that they are working with a signature object will write something like that, expect it to work, and have it become real assignment rather than pseudo-assignment keyed to the proper lifetime.

Using a declarator other than 'my' as part of a larger expression should generate a warning. Or maybe just on the ones that might be mistakes, such as involvement of assignment and lack of the actual initializer.



Reply via email to