in reply to Re^3: Stop Using Perl
in thread Stop Using Perl

> Try Moose attribute initializers, especially if you use grouping parentheses.

An example would have been nice ...

(... google ... google...)

I think you mean something like

has pizza => ( is => 'ro', isa => 'Pizza', writer => '_pizza', );

which is just syntactic sugar (sic) for

has 'pizza' , is => 'ro', isa => 'Pizza', writer => '_pizza', ;

and maybe should have been better designed as

has pizza => { is => 'ro', isa => 'Pizza', writer => '_pizza', };

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Replies are listed 'Best First'.
Re^5: Stop Using Perl
by LanX (Saint) on Jan 02, 2015 at 02:02 UTC
    update

    FWIW:

    a new feature allowing to change => from "fat comma" to a kind of "pair operator" wouldn't effect Moose's has() w/o parens.

    DB<105> sub has { \@_} DB<106> has pizza => scalar is => scalar 'ro' => ["pizza", "is", "ro"]

    It's scalar(CODE) which enforces a scalar comma within CODE to only return the last element.

    DB<107> has pizza => scalar ( is => scalar 'ro', ); => ["pizza", "ro"]

    OTOH a changed => doesn't necessarily need to act like a scalar comma.

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

      In other words, fat comma and regular comma would behave differently with regard to parens. No thanks.