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

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

Thread Previous | Thread Next
Ricardo Signes
August 25, 2012 17:20
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
* David Golden <> [2012-08-25T20:01:26]
> On Sat, Aug 25, 2012 at 7:02 PM, Ricardo Signes
> <>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

  '*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!


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About