Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: [perl6] Complex Attribute Validation and/or Triggers (good OO)

by AppleFritter (Vicar)
on Mar 07, 2015 at 12:14 UTC ( [id://1119171]=note: print w/replies, xml ) Need Help??


in reply to Re^2: [perl6] Complex Attribute Validation and/or Triggers (good OO)
in thread [perl6] Complex Attribute Validation and/or Triggers

It may help to think of constraints on attributes as being either static or dynamic (I'm just making up these terms). Those that only take into account the attribute itself and don't rely on external values are static; numbers being non-negative, strings being non-empty, that sort of thing.

By contrast, requiring that the lower bound of an interval does not exceed its upper bound is a dynamic constraint: you can't know whether the constraint is violated without actually checking the upper bound, i.e. accessing the interval object.

It may thus help to use public attributes only when you can be sure that all constraints are static in nature. If you need dynamic constraints, use methods so you have the language's full power at your disposal for verification.

  • Comment on Re^3: [perl6] Complex Attribute Validation and/or Triggers (good OO)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1119171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2026-04-13 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.