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

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

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
August 25, 2012 17:20
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120826002042.GA1930@cancer.codesimply.com
* David Golden <dagolden@cpan.org> [2012-08-25T20:01:26]
> On Sat, Aug 25, 2012 at 7:02 PM, Ricardo Signes
> <perl.p5p@rjbs.manxome.org>wrote:
> 
> > Good, because I have favored that working-with-warning behavior for
> > ambiguous simple scalars.  (What about `$x ~~ $glob`?  That's where I liked
> > undef-and-warn.)
> 
> What do you think people would intend with that? The only thing I can think
> of is "are these referring to the same glob?"  And for that, wouldn't 'eq'
> on the stringified references work just fine?

(Glob, not globref.)

My feeling is that nobody will "intend" anything with that.  eq won't work fine
because:

  '*main::main' eq *main   # is true

  my $glob = *main;
  '*main::main' eq $glob   # is true

So, since it will only be done unintentionally, outside of "stunt programming,"
I think it should fail and warn.

The other non-reference scalar type is vstring, but I think we're just fine
with using string equality there.  Open to rebuttal!

-- 
rjbs

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