in reply to Checking TYPEs after my declaration
As far as I'm aware, fields isn't deprecated.
As far as I'm aware, the only compile-time checking that the perl core does for lexical is types is that the package corresponding to the type must already exist, and that in conjunction with the compile-time use of fields, it checks constant hash lookups of a typed lexical reference. For example:
package Foo; use fields qw(a b c); sub new { fields::new(@_); } package main; my Foo $r = Foo->new(); $r->{d} = 1; # compile-time error $key = 'd'; $r->{$key} = 1; # run-time error
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Checking TYPEs after my declaration
by LanX (Saint) on Aug 18, 2016 at 22:12 UTC |