HaloO,

John M. Dlugosz wrote:
Then the declaration

  my ::T $x = whatever;

should use the exact same generic mechanism!  At worst, it needs

I would expect that this works by binding ::T to the type of whatever.


  my Any ::T $x = whatever;

Any here is optional.


and it will introduce the T symbol at that point based on the actual type of what gets initialized.

Yes. But the problem is that this does *not* fix the constraint
of $x to be T from there on! Or does it?

   my ::T $x = 'blahh';  #  ::T ::= Str

   my T $y = 'blubb';

   $x = 23; # legal
   $y = 42; # illegal

So perhaps one needs

   my ::T T $x = 'blahh';

to constrain $x to the type of the rhs.


Regards, TSa.
--

The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being.   -- Attributed to Hermann Weyl

Reply via email to