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

Invocation '()' after sub declaration doesn't parse in Rakudo (but does in STD) #2860

Closed
p6rt opened this issue Aug 11, 2012 · 9 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Aug 11, 2012

Migrated from rt.perl.org#114456 (status was 'resolved')

Searchable as RT114456$

@p6rt
Copy link
Author

p6rt commented Aug 11, 2012

From @masak

  <diakopter> rn​: say sub { 5 }()
  <p6eval> niecza v19-15-g051783d​: OUTPUT«5␤»
  <p6eval> ..rakudo 7ec7a2​: OUTPUT«===SORRY!===␤Confused␤at
/tmp/CUV6nwoMFP​:1␤»
  <masak> std​: say sub { 5 }()
  <p6eval> std c3e944a​: OUTPUT«ok 00​:00 41m␤»
  * masak submits rakudobug
  < masak> diakopter++

@p6rt
Copy link
Author

p6rt commented Aug 20, 2012

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 3, 2012

From @masak

<nwc10> masak​: the macro definition has this​: {{{$code}}}( {{{$argument}}}
);
<nwc10> but your expansion is this​: (sub ($t) { say $t })("OH HAI");
<nwc10> why did the extra? set of () appear?
<flussence> std​: sub ($t) { say $t }('arf')
<p6eval> std 04216b1​: OUTPUT«ok 00​:00 45m␤»
<flussence> ...well if that's the case I dunno
<flussence> r​: sub ($t) { say $t }('arf')
<p6eval> rakudo 170c90​: OUTPUT«===SORRY!===␤Confused [...]
<masak> nwc10​: I tried it without the parens in Rakudo while writing the
post, and it didn't work without the parens.
<flussence> n​: sub ($t) { say $t }('arf')
<p6eval> niecza v22-16-g4c016f5​: OUTPUT«arf␤»
<masak> nwc10​: but the real answer is that the transformation is not
textual, but on the AST level. so the parens are just there for clarity,
they don't change the AST topology.
* masak submits rakudobug
<nwc10> ah OK
<flussence> tbh, I really didn't expect that to work in niecza
<flussence> (nice that it does :)
<masak> well, since it parses in STD, it should mean something :)

@p6rt
Copy link
Author

p6rt commented Nov 5, 2012

From @jnthn

On Sat Nov 03 11​:50​:13 2012, masak wrote​:

<nwc10> masak​: the macro definition has this​: {{{$code}}}( {{{$argument}}}
);
<nwc10> but your expansion is this​: (sub ($t) { say $t })("OH HAI");
<nwc10> why did the extra? set of () appear?
<flussence> std​: sub ($t) { say $t }('arf')
<p6eval> std 04216b1​: OUTPUT«ok 00​:00 45m␤»
<flussence> ...well if that's the case I dunno
<flussence> r​: sub ($t) { say $t }('arf')
<p6eval> rakudo 170c90​: OUTPUT«===SORRY!===␤Confused [...]
<masak> nwc10​: I tried it without the parens in Rakudo while writing the
post, and it didn't work without the parens.
<flussence> n​: sub ($t) { say $t }('arf')
<p6eval> niecza v22-16-g4c016f5​: OUTPUT«arf␤»
<masak> nwc10​: but the real answer is that the transformation is not
textual, but on the AST level. so the parens are just there for clarity,
they don't change the AST topology.
* masak submits rakudobug
<nwc10> ah OK
<flussence> tbh, I really didn't expect that to work in niecza
<flussence> (nice that it does :)
<masak> well, since it parses in STD, it should mean something :)

Dupe of #​114456.

@p6rt
Copy link
Author

p6rt commented Nov 5, 2012

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

@p6rt
Copy link
Author

p6rt commented Nov 5, 2012

@jnthn - Status changed from 'open' to 'rejected'

@p6rt
Copy link
Author

p6rt commented Oct 14, 2014

From @usev6

This works now​:

$ perl6-m -e 'say sub { 5 }()'
5

$ perl6-m -e 'sub ($t) { say $t }("arf")'
arf

I added tests to S02-lexical-conventions/sub-block-parsing.t with the following commit​: Raku/roast@09ff5366a3

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 14, 2014

From @usev6

This works now​:

$ perl6-m -e 'say sub { 5 }()'
5

$ perl6-m -e 'sub ($t) { say $t }("arf")'
arf

I added tests to S02-lexical-conventions/sub-block-parsing.t with the following commit​: Raku/roast@09ff5366a3

@p6rt
Copy link
Author

p6rt commented Oct 14, 2014

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant