develooper Front page | perl.perl5.porters | Postings from August 2012

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
David Golden
Date:
August 26, 2012 17:57
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
CAOeq1c-YaoYN2rxCNnmZDAM7sNXhB=ffcs91wJ39nbmU24jnaw@mail.gmail.com
On Sun, Aug 26, 2012 at 3:52 PM, Father Chrysostomos <sprout@cpan.org>wrote:

>   # literal numbers
>   when(0)
>   when(1)
>   when(0xff)
>   when(0b101110)
>   when(023476)
>   # literal strings
>   when('foo')
>   when("foo")
>   when(q "foo")
>   when(qq "foo")
>
> and *nothing* else.  Everything else would be a boolean, including
> when($foo).  Anything else is madness; it really is.
>

Tempting.  If constant subs could be made to work as well, I think it would
cover 90% of the uses I'd have for it.

-- 
*David Golden* <dagolden@cpan.org>
*Take back your inbox!* → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About