Welcome to the Monastery | |
PerlMonks |
RFC: Class::Moebiusby rinceWind (Monsignor) |
on Jan 11, 2006 at 12:36 UTC ( [id://522420]=perlmeditation: print w/replies, xml ) | Need Help?? |
I had an idea for a joke module, that provides möbius objects: inside out objects that are also not inside-out. However, thinking more about it, I can see that this could have practical uses. Imagine the scenario of refactoring in-house modules for inside outedness. The modules themselves could be refactored to use Class::Std, Object::InsideOut, Class::InsideOut or whatever, but lots of existing legacy code could break if it is relying on de-encapsulation ->{foo} syntax. Möbius objects could provide a migration path allowing the legacy code to still work, albeit generating warnings whenever encapsulation is violated, but still working. Inside out objects tend to be implemented as a blessed scalarref, using the address or some other unique low level property (their values are not actually used). The möbius object could still use this address, but be a blessed, tied hashref or arrayref. The tie mechanism will intercept any attempts to access attributes directly, and will do the right thing, generating warnings as necessary. What do others think? Is this idea worth pursuing? Or should it retain "joke module" status? --
Back to
Meditations
|
|