Jon Lang wrote:
  my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio;
  my ($mag, $phase) = Complex::Polar($z).^attr;
  my ($re, $im) = Complex::Cartesian($z).^attr;
  my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] );

If I'm reading this right, the .^attr is exposing implementation details of the object to get its components. To my mind that is not desirable.

And I think there's a Math error in the 4th line: you don't need the components of a vector to do a dot product with that vector -- so it is just

   my ($x, $y) = $vector «·« ( [1, 0], [0, 1] );

Which makes me wonder if all of them are just the dot-product of an object with a role (i.e. it uses the .^attr of the role, not the object):

   my ($num, $denom) = $real_number · :Ratio;
   my ($mag, $phase) = $complex_number · :Complex::Polar;

Which has a pleasing symmetry with the "dot" used for method calls

Reply via email to