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

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

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
August 26, 2012 19:56
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
FA239D64-30A5-4FAA-8E60-B45415A88FA2@cpan.org

On Aug 26, 2012, at 5:56 PM, David Golden wrote:

> 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.

Unfortunately, constant subs would pose the same string/number problem.


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