Friday, August 28, 2009

Vector: Well, I thought I was done....

Yesterday, pmichaud++ fixed the operator overloading bug. I can confirm that using this morning's Rakudo build, V+, V-, V*, and V/ can be changed to the more expected +, -, *, and /. I haven't pushed the change to github yet -- I'm not sure what the right policy is in dealing with forcing any potential Vector users to be on the bleeding edge.

Though as nearly as I can tell, today's Rakudo works perfectly on my MacBook -- actually passes all the spectests, unlike the last official release. The only downside is one of the other Vector tests now fails. It's not exactly a crucial test, but it is a puzzling failure to me. I'm trying now to find out whether the test is wrong or something has broken in Rakudo.

The other thing I learned about was class XXXX is also, which allows you to add additional methods to a class. I've used this to resolve Vector's minor DRY issue: now the definition of the dot product operators comes before the definition of Vector.Length, allowing Vector.Length to use dot product internally.

1 comment:

  1. Just a note about "is also": the correct Perl 6 formulation is "augment" (see Synopsis 12). The "is also" form is left over from a previous version of the specification, and we haven't been able to update Rakudo to use the new format yet (internally it's more than a minor keyword change).

    Pm

    ReplyDelete