Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPERIMENT] smartmatch and given/when #13173

Open
p5pRT opened this issue Aug 16, 2013 · 5 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Aug 16, 2013

Migrated from rt.perl.org#119317 (status was 'open')

Searchable as RT119317$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 16, 2013

From @rjbs

Okay, the ~~/given/when feature, introduced in perl 5.10.0, has been discussed
plenty already. Seriously, plenty. For one of the many threads, consider​:

  http​://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg191210.html

Sprout did a bit of work on implementing things as discussed and this work then
languished, mostly because I didn't realize he was waiting on a rely, and then
because he was on hiatus. At present, it's still sort of languishing, mostly I
think, because I need to reply.

Steps to resolve this​:

  * review the work currently done (sprout/smartpatch)
  * respond to it
  * figure out what remains undone
  * test that
  * decide whether it makes sense
  * establish final acceptance criteria
  * finish up

(See also http​://markmail.org/message/eplhjfyep6yigwtl )

I will try to get this moving again as much as I can so we can bring it to a
conclusion.

--
rjbs

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 16, 2013

From @rjbs

* Ricardo SIGNES <perlbug-followup@​perl.org> [2013-08-15T21​:53​:06]

Sprout did a bit of work on implementing things as discussed and this work

In chosing the phrase "a bit of work," I did not mean to make any claim about
the effort involved. I apologize if I seemed to trivialize hard work!

--
rjbs

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 16, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 18, 2013

From @cpansprout

On Thu Aug 15 18​:53​:06 2013, rjbs wrote​:

Okay, the ~~/given/when feature, introduced in perl 5.10.0, has been
discussed
plenty already. Seriously, plenty. For one of the many threads,
consider​:

http​://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg191210.html

Sprout did a bit of work on implementing things as discussed and this
work then
languished, mostly because I didn't realize he was waiting on a rely,
and then
because he was on hiatus. At present, it's still sort of languishing,
mostly I
think, because I need to reply.

Steps to resolve this​:

* review the work currently done (sprout/smartpatch)
* respond to it
* figure out what remains undone
* test that
* decide whether it makes sense
* establish final acceptance criteria
* finish up

(See also http​://markmail.org/message/eplhjfyep6yigwtl )

I will try to get this moving again as much as I can so we can bring
it to a
conclusion.

IIRC, the last two issues that had not been ironed out were
• What the fallback should be​: eq or fatal
• How ‘break’ should behave​: like ‘next’ (my preference) or buggy (your
preference)

OK, that last bit was tongue-in-cheek. However, you never gave a full
explanation of how you want ‘break’ to behave. I was poking you with
questions (does it apply to while(<>)?), and getting short answers that
led me to believe you had not really thought it through.

This is all from memory. I haven’t gone to look back at the archives.
(I don’t have access to markmail.org, so I don’t know which message you
refer to above.)

Another note​: Amidst the whirling threads about how smartmatch should
behave, I pointed out that we already have a generic ‘matcher’ object in
perl​: the coderef. You thought that having something that accepts
coderefs or regexps was a good idea. More recently I have thought about
allowing qr//->($match_against_this). Regardless of smartmatch, that
might be a good idea. What do you think?

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 19, 2013

From @Hugmeir

On Sun, Aug 18, 2013 at 3​:41 AM, Father Chrysostomos via RT <
perlbug-followup@​perl.org> wrote​:

On Thu Aug 15 18​:53​:06 2013, rjbs wrote​:

Okay, the ~~/given/when feature, introduced in perl 5.10.0, has been
discussed
plenty already. Seriously, plenty. For one of the many threads,
consider​:

http​://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg191210.html

Sprout did a bit of work on implementing things as discussed and this
work then
languished, mostly because I didn't realize he was waiting on a rely,
and then
because he was on hiatus. At present, it's still sort of languishing,
mostly I
think, because I need to reply.

Steps to resolve this​:

* review the work currently done (sprout/smartpatch)
* respond to it
* figure out what remains undone
* test that
* decide whether it makes sense
* establish final acceptance criteria
* finish up

(See also http​://markmail.org/message/eplhjfyep6yigwtl )

I will try to get this moving again as much as I can so we can bring
it to a
conclusion.

IIRC, the last two issues that had not been ironed out were
• What the fallback should be​: eq or fatal
• How ‘break’ should behave​: like ‘next’ (my preference) or buggy (your
preference)

OK, that last bit was tongue-in-cheek. However, you never gave a full
explanation of how you want ‘break’ to behave. I was poking you with
questions (does it apply to while(<>)?), and getting short answers that
led me to believe you had not really thought it through.

This is all from memory. I haven’t gone to look back at the archives.
(I don’t have access to markmail.org, so I don’t know which message you
refer to above.)

Another note​: Amidst the whirling threads about how smartmatch should
behave, I pointed out that we already have a generic ‘matcher’ object in
perl​: the coderef. You thought that having something that accepts
coderefs or regexps was a good idea. More recently I have thought about
allowing qr//->($match_against_this). Regardless of smartmatch, that
might be a good idea. What do you think?

You can already implement this without having to modify the core​:

  package Regexp { use overload q[&{}] => sub { my ($re) = $_[0]; sub {
$_[0] =~ $re } }, fallback => 1 }
  say qr/f(oo)/->("foo")

So perhaps it should be tested on CPAN first. I don't see much use for it,
but YMMV*; personally, I'd prefer something like this​:

  sub Regexp​::match { return $_[1] =~ $_[0] }
  say qr/f(oo)/->match("foo")

But I guess that's what autobox is for.

[*] For the curious, yes, I've spent an inordinate amount of time reading
TV Tropes today.

@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.