|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^2: Idea: Moose Mutal Coercionby k0st (Novice) |
| on Feb 15, 2012 at 10:46 UTC ( #953898=note: print w/ replies, xml ) | Need Help?? |
|
OK, so perhaps first and last names wasn't the best way to describe my idea. I agree with all these points about the difficulties of storing names but there's no need to lament about users who don't exist! It was just an example. The idea is: A formal way of describing the relationship between attributes that can constructed from each other. Lets start again. After thinking about the problem some more I'm going to rename this from "mutal coercions" to "invertible builders". Here's a different example that is hopefully less confusing:
So what is MooseX::Invertible_Build doing? but it also creates a builder for 'a' and 'b' which for 'a' would look like: Now that my idea is more clear lets return to the original example which involves strings and change it a little (and ignore the complexities behind generalizing human names).
now our 'via' statement contains the 'join'function....and Once again it has an inverse! the inverse of join(A,B) with respect to A is (split(' ', C))[0] (with C being full_name). Not only do we know what the builder for full_name is but we also know it for first_name and last_name. MooseX::Invertible_Build goes ahead and defines the default methods for first_name and last name with their respective split statements. So right now concrete idea for MooseX::Invertible_Build is:Thanks for taking the time to read all this monks. I'll try and get something working this weekend. Any comments/ideas/advice on where to start welcome. Also a description of the mathematical concepts involved would be cool. I used the word 'inverse' a lot which I think is correct, but I forgot all the mathemical jargon to do with sets, functions and mappings etc.
In Section
Meditations
|
|
||||||||||||||||||||||||||||||||