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

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

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
August 28, 2012 06:06
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120828130622.GJ4014@iabyn.com
On Tue, Aug 28, 2012 at 08:16:01AM +0200, Johan Vromans wrote:
> Father Chrysostomos <sprout@cpan.org> writes:
> 
> >> 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.
> 
> This puzzles me... Can you explain?

(this may or may not be what FC had in mind):

Consider:

    BEGIN {
	$x = 1;
	# print "x=$x\n";
    }
    use constant FOO => $x;
    ...
    when(FOO)

Depending on how the constant value is is defined, it may be IOK or POK:
by uncommenting the print debug, we change FOO from integer to string.


-- 
Nothing ventured, nothing lost.

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