TSa wrote:

   class Length
   {
       has Num $.mm is rw = 0;
       method inch
       {
           yield $inch = $.mm * 25.4;
           self.mm = $inch / 25.4;
       }
   }

Would you regard that as elegant?

That looks functionally incorrect to my eyes: if the caller resumes at the time of the "yield" statement, and immediately assigns a new value to the "mm" attribute, then there is a race between the two updates to "mm".

Reply via email to