You're on the right track. Attaching validation routines as setters is falling into a kind of cut-and-paste fallacy. Most such validation should really be done by the subtype system in Perl 6. Merely declaring your attribute to be of the proper subtype will prevent bad values from being assigned to it. The subtype is usually the proper place to attach your validation sub, not the attribute setter.
Anyway, I'm kind of sick of this thread. People are getting exactly the same kind of tunnel vision they had when they wrote the RFCs in the first place, and not seeing how the Perl 6 feature set works together as a whole. They don't see how syntax mutability and dispatch rules will let them cargo cult in whatever silly syntax they like; they'd rather screw around with the clean underlying semantics instead.
Gee, let's just recapitulate the whole RFC process here on PM. Maybe it's about time to trot out highlander variables again. Multiline comments anyone? Ooh, let's make my the implicit default. And I've got this great idea for the colon character... :-)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.