LanX has asked for the wisdom of the Perl Monks concerning the following question:
It is possible to use a TYPE when declaring a variable my TYPE $a; ...
... but is it also possible to introspect this "type", kind of a $a->istype("TYPE") or $a->gettype() ?
my mentions fields but all I understood is that it's somehow deprecated since 5.8. (wasn't it meant for immutable hashes ...?)
What's confusing me is that neither ref nor reftype nor Devel::Peek show any signs of this typing, so it must be stored in fields somehow...
Bonus points if you can tell me:
Is it even possible to create compile time checks of types?
I remember being capable to create errors after such "typing", but can't reproduce.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking TYPEs after my declaration
by dave_the_m (Monsignor) on Aug 18, 2016 at 18:42 UTC | |
by LanX (Saint) on Aug 18, 2016 at 22:12 UTC | |
|
Re: Checking TYPEs after my declaration
by dcmertens (Scribe) on Aug 19, 2016 at 11:07 UTC | |
by LanX (Saint) on Aug 19, 2016 at 12:39 UTC | |
|
Re: Checking TYPEs after my declaration
by dcmertens (Scribe) on Dec 22, 2016 at 21:08 UTC |