cperl
cperl copied to clipboard
new compile-time typeof operator
returns the type(s) at compile-time. which is string or list of strings or a list of type expressions.
currently the string comes from the stash name, but in the future a type can also be an object (as in perl6), not a stash. the return value of typeof must be parsable as valid type declaration. so it should honor list context to listify | alternations.
similar to ref, which returns one run-time string, the current type. (but even if the value contains multiple types, only one is returned with ref). but typeof gets the type from the OP*, not the attached SV*.
can it be indexed again i.e. in a variable declaration?
@vendethiel can you reformulate your question?
can you use typeof as the type of a variable?
Sure, that's the idea when using it with eval.
Note that you cannot do that with ref, but ref is only for introspection and was not really carefully planned
On Mar 30, 2016 16:39, "ven" [email protected] wrote:
can you use typeof as the type of a variable?
this ticket was wrongly closed
Oops, thanks. I really should add support for functions also.