Skip Menu |

This queue is for tickets about the Syntax-Keyword-Try CPAN distribution.

Report information
The Basics
Id: 124229
Status: open
Priority: 0/
Queue: Syntax-Keyword-Try

People
Owner: Nobody in particular
Requestors: OSCHWALD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.09
Fixed in: (no value)



Subject: Incorrectly forces scalar context with subroutine called in return
When using Syntax::Keyword::Try, a subroutine called from a return appears to be forced into scalar context. For instance, with: sub list { (10, 11) } sub test {try {return list()} catch {}} "11" is returned by test() in list context. Note that if I return a list directly from the try, it appears to work as expected, e.g.: sub test {try {return (10, 11)} catch {}} Returns "(10, 11)" in list context and "11" in scalar context. Greg
On Fri Jan 26 16:04:59 2018, OSCHWALD wrote: Show quoted text
> When using Syntax::Keyword::Try, a subroutine called from a return > appears to be forced into scalar context. For instance, with:
Ah. Yes. that. I so far haven't found a way to mangle the peephole-optimiser that gets applied to these code structures, to leave it in "unspecified" context. So far it always seems to think it's scalar. At the moment, I think it's somewhat of a "known-bug" that perhaps should be documented clearer. It may be fixable, it may be a limitation of the perl optree representation. -- Paul Evans
On 2018-04-02 11:13:02, PEVANS wrote: Show quoted text
> At the moment, I think it's somewhat of a "known-bug" that perhaps > should be documented clearer. It may be fixable, it may be a > limitation of the perl optree representation.
Would this be something that is solvable if the try/catch keywords were in core?
On Wed Nov 25 16:41:55 2020, ETHER wrote: Show quoted text
> On 2018-04-02 11:13:02, PEVANS wrote: >
> > At the moment, I think it's somewhat of a "known-bug" that perhaps > > should be documented clearer. It may be fixable, it may be a > > limitation of the perl optree representation.
> > > Would this be something that is solvable if the try/catch keywords > were in core?
Verymuch so. -- Paul Evans