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

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

Thread Previous | Thread Next
Dave Mitchell
August 28, 2012 06:06
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
On Tue, Aug 28, 2012 at 08:16:01AM +0200, Johan Vromans wrote:
> Father Chrysostomos <> 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):


    BEGIN {
	$x = 1;
	# print "x=$x\n";
    use constant FOO => $x;

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About