git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Perl gurus: why do we need Scalar::Util?

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Jul 10, 2006, 13:28 UTC
Message-ID
<86k66lsi5q.fsf@blue.stonehenge.com>
In-Reply-To
<Pine.LNX.4.63.0607101343060.29667@wbgn013.biozentrum.uni-wuerzburg.de>
>>>>> "Johannes" == Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

Johannes> please do not let my die dumb: what is this "blessed" thing all about? And Johannes> why do we need it in the private-Error.pm??

Ugh. Just took a peek for the first time at the "next" branch, and I see the dangerous syntactic-sugar try { } catch { }. Sorry for not noticing that earlier.

While that syntax looks like it would make things easier in theory, in practice it is a source of leak-after-leak because it creates a closure for the two blocks, and that can easily lead to a circular reference for long-running tools. This would be of some concern if someone writes a mod_perl module or a standalone webserver that doesn't exec itself to clean up (which it shouldn't need).

So, if there's going to be rewrite, the first part would be to eliminate the try { } catch { } sugar, and replace it with more traditional exception catchers.

        eval { };
        if ($@) { ... }

Note that I'm *not* suggesting not to use Error.pm - that's a great means by which to create hierarchical error classes that stringify nicely and carry context on the error. I'm just saying to throw out the try/catch syntax helper.

Sorry about that.  If it's any consequence, we got it right in Perl 6. :)
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Previous: Randal L. SchwartzNext: Petr Baudis
Message 9 of 10 in “Perl gurus: why do we need Scalar::Util?”
  1. Johannes SchindelinJul 10, 2006
  2. Petr BaudisJul 10, 2006
  3. Eliminate Scalar::Util usage from private-Error.pmPetr Baudis, Jul 11, 2006
  4. Randal L. SchwartzJul 11, 2006
  5. Randal L. SchwartzJul 11, 2006
  6. Randal L. SchwartzJul 11, 2006
  7. Junio C HamanoJul 11, 2006
  8. Randal L. SchwartzJul 11, 2006
  9. Randal L. SchwartzJul 10, 2006
  10. Petr BaudisJul 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.