has 'x' => (is => 'rw', isa => 'Int'); has 'x' => {is => 'rw', isa => 'Int'};

The second syntax is more righteous
Some times some people say TIMTOWTDI. But in this case there is just one way better than another
I'm gonna tell ya the reasons
First, the second syntax is faster than first one because you pass one string and just one hash reference while first syntax passes one string and list of law key value pairs. In the first case, the subroutine probably does something like:

 my ($propname,%options)=@_

This is just wasteful isn't it? You make list of key value pairs and copy to @_, and copy again to %options.
But in the second case, you only make list once and what you copy is just a reference.
When you make a big program which uses a lot of classes, the second syntax would be more efficient
Second, inconsistencies.
There are so many module which uses first syntax and there also second syntax.
That leads users into confusion because of inconsistencies of syntaxes. for example the module 'Template' uses second syntax in 'process' subroutine

use Template; # some useful options (see below for full list) my $config = { INCLUDE_PATH => '/search/path', # or list ref INTERPOLATE => 1, # expand "$var" in plain text POST_CHOMP => 1, # cleanup whitespace PRE_PROCESS => 'header', # prefix each template EVAL_PERL => 1, # evaluate Perl code blocks }; # create Template object my $template = Template->new($config); # define template variables for replacement my $vars = { var1 => $value, var2 => \%hash, var3 => \@list, var4 => \&code, var5 => $object, }; # specify input filename, or file handle, text reference, etc. my $input = 'myfile.html'; # process input template, substituting variables $template->process($input, $vars) || die $template->error();

The laziness of not typing two characters '{' and '}' make bigger problem called 'inconsistency'
So what I want to say is: Moose must support at least both syntaxes
PS: It seems that here are so many emotional people. And you even don't give me logical answers.And taste is not a matter of programming. It is matter of food or something. Please find taste in other places


In reply to Re: Why Moose uses this syntax??!! by Anonymous Monk
in thread Why Moose uses this syntax??!! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.