CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=43200
server: Combust/Plack (Perl)
vary: Accept-Encoding
content-encoding: gzip
content-length: 3270
content-type: text/html; charset=utf-8
last-modified: Sat, 11 Oct 2025 21:48:26 GMT
date: Sat, 11 Oct 2025 21:48:26 GMT
strict-transport-security: max-age=15768000
Re: my $@ - a proposal - nntp.perl.org
Front page | perl.perl5.porters |
Postings from June 2008
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About

Re: my $@ - a proposal
Thread Previous | Thread NextFrom:
Yuval KogmanDate:
June 27, 2008 09:19Subject:
Re: my $@ - a proposalMessage ID:
20080627161923.GB23537@woobling.orgOn Fri, Jun 27, 2008 at 17:54:29 +0200, Steffen Mueller wrote: > If one created a pragma to enable this behaviour lexically, one could > use the same logic for loading it by default with use 5.012 as I > proposed with my use-strict-by-default patch. Unfortunately, the > implications with respect to what happens in -E weren't clear since > those essentially do a "use 5.0CURRENT" but probably shouldn't add any > new behaviour. Eventhough that change in behaviour was mostly liked, the > patch hasn't made it in for this very reason. Rafael said he's still > thinking about it. > > For checking whether to create a lexical or not, you could then use a > hint. So the plan would be: > > - Make it possible to declare $@ as a lexical at all: "Can't use global > $@ in "my" at -e line 1, near "my $@"" > - patch the core eval BLOCK implementation to create a lexical if the > hint is set > - create a simple pragma to set/unset the hint > - apply aforementioned strict-by-default patch with > s/strict/lexicalExceptions/g > > One potential gotcha might be that if using a hints *hash* entry, the > hash lookup on each eval {} could be considered large. I'm not sure, though. This can be at compile time, such that having a lexical $@ in scope compiles a variant of the eval {} opcode instead of the normal one. In fact, I think I can maybe hack a PL_check based hack that makes this work with any lexical. This would be a POC in terms of API, due to the can't use global in my problem, but should give us everything else: use lexical_error '$e'; # name of error var my $e; # if this is in scope it's used instead the PL_check hack would go trrough all eval (string and block) and replace them with wrapped versions that temporarily swap the error SV with the one of the lexical one, and make sure that the jump exit changes this back to what it was at the right time. This way 'die' writes to the some SV, but that SV might not necessarily be $@. If $@ is a normal var and not magical then this shouldn't be too difficult and maybe a real patch can be made out of it. -- Yuval Kogman <nothingmuch@woobling.org> https://nothingmuch.woobling.org 0xEBD27418Thread Previous | Thread Next
- my $@ - a proposal by Yuval Kogman
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Mark Mielke
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Graham Barr
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Ben Morrow
- Re: my $@ - a proposal by Graham Barr
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Johan Vromans
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Rafael Garcia-Suarez
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Ben Morrow
- Re: my $@ - a proposal by Elliot Shank
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Juerd Waalboer
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Sean O'Rourke
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Steffen Mueller
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by David Cantrell
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Nicholas Clark
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Reini Urban
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Sam Vilain
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About