Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Feedback: Strongly-typed "Pascal records" module

by aspen (Sexton)
on Jan 01, 2003 at 21:37 UTC ( [id://223627]=note: print w/replies, xml ) Need Help??


in reply to Re: Feedback: Strongly-typed "Pascal records" module
in thread Feedback: Strongly-typed "Pascal records" module

Replying to both John M. Dlugosz and pg, you are right about the variety of related hash-checking and field-checking pragmas and modules that exist. The particular goal here was about type checking during the assignment of a value to one of an object's instance variables. The "type" of the assigned value must match the "type" expected for that key. When following general OO rules this means checking the module author's action, since non-authors are generally supposed to use module-author accessor methods to modify instance data. (Though Tie::Record will check extra-package assignments as well.)

It wasn't my particular goal to validate/examine whether a derived module was validly implementing it's parent's (or parents') interface. Rather, enable Perl to say to me "Yo, coder, I don't think you did what you meant to do. Isn't this particular object's xxxx instance variable supposed to hold Foo::Bar objects and not Bar::Foo objects!?"

It ensures my mis-assignment to an instance variable gets noticed at its source instead of (much) later when its effect finally shows up.

  • Comment on Re: Re: Feedback: Strongly-typed "Pascal records" module

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found