|
|
Subscribe / Log in / New account

An interview with Larry Wall (LinuxVoice)

An interview with Larry Wall (LinuxVoice)

Posted Jul 24, 2015 22:19 UTC (Fri) by raiph (guest, #89283)
In reply to: An interview with Larry Wall (LinuxVoice) by mchapman
Parent article: An interview with Larry Wall (LinuxVoice)

Oh, I'm sure there are lots of ways. We're talking about Perl here. :)

The first thing I came up with:

($a,$b) ~~ :(Int, Int) or fail; $a + $b;

The `:(...)` bit is a literal signature, exactly like the ones that appear in function definitions. The `~~` "smartmatch" operator, with these operands, does a trial bind of the argument list on its left with the signature on its right.

I skipped testing the result because an Int can store arbitrarily large integers, and if all of RAM was consumed by a truly vast integer, an exception would (should) be raised by lower levels of the stack.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds