Ingo Blechschmidt wrote:
is that allowed (as 42 is a Num (or an Int), not a Code)?

I don't know, but guess not.

Do (most of) the basic types morph themselves into Codes, when needed?

I don't consider it type morphing. If your examples parse
at all they will be dispatched as usual

  say 42();                # 42?

&postfix:<.( )>:( Int :)

  say "Perl"();            # Perl?

&postfix:<.( )>:( Str :)

  say [1,2,3].does(Code)   # true?

Depends on the type of [] which is Ref of Array or so.
But I think it should be false.

Or did you simply forget the braces around 42? :)

No, it was intented for seeing what the reactions will be :)
Just using &foo as unsigiled variable. This might need

my &foo is rw;

But then I presume you could say:

foo = 17;
if foo < 8
   @a[foo] = 8;

We could call that a codeless lvalue sub ;)
TSa (Thomas Sandlaß)

Reply via email to