in reply to casting, signatures and return types in perl 6 (rakudo)

Type coercions are specced to work with as Num in the signature, but it's not yet implemented in Rakudo.

If you want to modify a builtin function in that way, the specification says (in Wrapping) you can do something like this: &prompt.wrap( { +callsame } )

but I fear it's not implemented either. For now you'll just have to write +prompt.

Return types Should a sub/method/function complain if the return value does not match the specified type, in this case Num?

It should. But it's not yet implemented.

Is the return type part of the signature and if not should it be?

Yes, it should appear as :(rest of signature... --> Num)

Let me add that signatures are only implemented in Rakudo to the amount that's needed to do multi dispatch, and return values and coercion of return values don't count among them. (and, of course, patches welcome, both to the test suite and the implementation :-)

Replies are listed 'Best First'.
Re^2: casting, signatures and return types in perl 6 (rakudo)
by j1n3l0 (Friar) on Mar 17, 2009 at 14:54 UTC
    Thanks for the clarification. I will contribute any patches I think are meaningful ;)


    Smoothie, smoothie, hundre prosent naturlig!