-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EXPERIMENT] the :const attribute on subroutines #14428
Comments
From @cpansproutThe ‘const’ attribute is being added as an experimental feature in perl 5.22.0. -- Father Chrysostomos |
From @cpansproutOn Mon Jan 19 20:37:06 2015, sprout wrote:
This ticket has had no attention whatsoever. This means that either (a) the feature is bug-free and perfect, or that (b) nobody is using it, or that (c) those who are using it are very silent. If a is the case, then this feature no longer needs to be experimental. If b is the case, it should definitely remain experimental. If c is the case, would somebody please speak up and give opinions on the feature (whether it works and is designed well, whether it is designed poorly, whether it seems like a good design but has bugs, etc.). -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @davidnicolheavens, it's Warnock's dilemma, extended On Fri, May 20, 2016 at 4:36 PM, Father Chrysostomos via RT <perlbug-
-- |
From @wolfsageSounds good to me. Though can we add something like the attached patch -- Matthew Horsfall (alh) |
From @wolfsageInline Patchdiff --git a/pod/perlsub.pod b/pod/perlsub.pod
index 78de284..f95d5da 100644
--- a/pod/perlsub.pod
+++ b/pod/perlsub.pod
@@ -1707,11 +1707,14 @@ Perl 5.22 also introduces the experimental "const" attribute as an
alternative. (Disable the "experimental::const_attr" warnings if you want
to use it.) When applied to an anonymous subroutine, it forces the sub to
be called when the C<sub> expression is evaluated. The return value is
-captured and turned into a constant subroutine:
+captured and turned into a constant subroutine. If declared inside of
+a C<BEGIN> block, it may also be inlined:
- my $x = 54321;
- *INLINED = sub : const { $x };
- $x++;
+ BEGIN {
+ my $x = 54321;
+ *INLINED = sub : const { $x };
+ $x++;
+ } |
@wolfsage, do you still want to have this patch applied to Thank you very much. |
I think this patch or something like it should be applied for sure. That whole documentation bit is a little messy IMO - it says "inlined" in a bunch of places where I don't think it means what it ... thinks it means. I do not know when I will have time to revisit it though, so expect no action from me here; apologies. |
Looking at this now there doesn't seem to be any reason to keep it experimental. |
Migrated from rt.perl.org#123630 (status was 'open')
Searchable as RT123630$
The text was updated successfully, but these errors were encountered: