Skip to content
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] :const #14428

Open
p5pRT opened this issue Jan 20, 2015 · 6 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jan 20, 2015

Migrated from rt.perl.org#123630 (status was 'open')

Searchable as RT123630$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 20, 2015

From @cpansprout

The ‘const’ attribute is being added as an experimental feature in perl 5.22.0.
This ticket will collect bugs and other acceptance-criteria tickets to
track before :cosnt can be considered accepted or failed in a
future version of perl.

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 20, 2016

From @cpansprout

On Mon Jan 19 20​:37​:06 2015, sprout wrote​:

The ‘const’ attribute is being added as an experimental feature in
perl 5.22.0.
This ticket will collect bugs and other acceptance-criteria tickets to
track before :cosnt can be considered accepted or failed in a
future version of perl.

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 20, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 20, 2016

From @davidnicol

heavens, it's Warnock's dilemma, extended

On Fri, May 20, 2016 at 4​:36 PM, Father Chrysostomos via RT <perlbug-
<perlbug-followup@​perl.org>

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.).

--
"Why would you want to be the last man alive on a sinking ship?" -- Elon
Musk

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 21, 2016

From @wolfsage

Sounds good to me. Though can we add something like the attached patch
to the documentation for clarity?

-- Matthew Horsfall (alh)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 21, 2016

From @wolfsage

Inline Patch
diff --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++;
+    }
@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.