diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-10 15:20:18 +0000 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2023-02-11 15:55:20 +0000 |
commit | 8cf9e0b7ee431069f972a1e0a7ecc096a651a275 (patch) | |
tree | 5ba2bba708c07f5452b8242ee642ff8dceb9267f /pod/perldelta.pod | |
parent | 744456cd5b7c91b636776311d9c3421ab52f4083 (diff) | |
download | perl-8cf9e0b7ee431069f972a1e0a7ecc096a651a275.tar.gz |
Perldelta for new 'class' feature
Diffstat (limited to 'pod/perldelta.pod')
-rw-r--r-- | pod/perldelta.pod | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 7a81735089..20ab2548ab 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,6 +27,34 @@ here, but most should go in the L</Performance Enhancements> section. [ List each enhancement as a =head2 entry ] +=head2 New C<class> Feature + +A new B<experimental> syntax is now available for defining object classes, +where per-instance data is stored in "field" variables that behave like +lexicals. + + use feature 'class'; + + class Point + { + field $x; + field $y; + + method zero { $x = $y = 0; } + } + +This is described in more detail in L<perlclass>. Notes on the internals of +its implementation and other related details can be found in L<perlclassguts>. + +This remains a new and experimental feature, and is very much still under +development. It will be the subject of much further addition, refinement and +alteration in future releases. As it is experimental, it yields warnings in +the C<experimental::class> category. These can be silenced by a +C<no warnings> statement. + + use feature 'class'; + no warnings 'experimental::class'; + =head1 Security XXX Any security-related notices go here. In particular, any security |