Thank you for reminding me. Default values are something that is good to make a method from if you want them inherited in an override. His implementation of defaults tries to do that but will blow up because he will try to be using a symbolic reference and has strict on.

As for the accessor method, I provided one accessor where he provided 2 setters and 2 getters. Then I didn't use mine internally, while he used his a lot. I think that the difference is substantial.

You do have a good point about the needs of Yahtzee vs the needs of role-playing games. However if you wanted to reuse this module for Yahtzee, why not provide a subclass that adds the face attribute? Just because something is sometimes useful doesn't mean that you want to always do it. Instead be reasonably efficient by default but provide an interface that can be extended easily.

As for a sum method, depending on your situation that might or might not fit in the class. In role-playing games you often see rolling a lot of dice and summing them up. But you also see a lot of rolling several dice and summing up some subselection. (Usually the top m of n.) In games such as backgammon you really don't want to sum them, but you do care about doubles. In short it doesn't need to happen by default though it may be convenient often enough to provide it.

As for what a pseudo-hash is, it is an anonymous array whose first element is a hash saying what the following entries are. In short it acts a lot like a C struct. And if you do a lot of declarations Perl will actually resolve the lookup through the hash element at compile time and the accesses will be faster as well.

Unfortunately it looks to be history. But you might as well remember this for reuse as a future trivia question.

What feature was left out of Perl 6 because it caused serious performance problems in the first attempt to write Perl 6?


In reply to Re (tilly) 3: Dice::Dice by tilly
in thread Dice::Dice by coreolyn

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.