in reply to Re^4: Idea: Moose Mutal Coercion
in thread Idea: Moose Mutual Coercion

You think that the OP is suggesting that Moose herders use his module so that they can type this:

package Equation_Problem; use Moose; use MooseX::Invertible_Build; has mass => ( isa => Num); has velocity => ( isa => Num); has momentum => ( isa => Num, invertible_build => { A => 'mass', B => 'velocity', via => 'A * B', }, );

To 'save' typing:

package Equation_Problem; use Moose; has mass => ( isa => Num); has velocity => ( isa => Num); sub momentum { my $self = shift; $self->mass * $self->velocity; }

Hm. It can't be that in(s)ane.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^6: Idea: Moose Mutal Coercion
by choroba (Cardinal) on Feb 15, 2012 at 16:27 UTC
    No. I guess the OP wants a class which you can initialize with any two attributes, but you can then ask for all three.

      Ah! The hackers are gonna love this:

      package Hash::PassPhrase; use Moose; use MooseX::Invertible_Build; has passPhrase => ( isa => Str ); has salt => ( isa => Str ); has hash => ( isa => Str, invertible_build => { A => 'salt', B => 'passPhrase', via => 'crypt( A, B )', }, );

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?