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

macro not working #612

Closed
p6rt opened this issue Jan 12, 2009 · 12 comments
Closed

macro not working #612

p6rt opened this issue Jan 12, 2009 · 12 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 12, 2009

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

Searchable as RT62224$

@p6rt
Copy link
Author

p6rt commented Jan 8, 2009

From @finanalyst

I have the following in a file test.pl

macro doit ($word) {
  return quasi <say <<<$word>>> <<<$word>>> ;>
};

doit('one');
doit('two');
doit('three');

It should - I think - be outputting​:
one one
two two
three three

Instead I get​:
$ perl6 ./test.pl
Statement not terminated properly at line 1, near "{\n return"

current instr.​: 'parrot;PGE;Util;die' pc 129
(runtime/parrot/library/PGE/Util.pir​:83)
called from Sub 'parrot;Perl6;Grammar;eat_terminator' pc 28962
(src/gen_grammar.pir​:3368)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 27610
(src/gen_grammar.pir​:2835)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 25043
(src/gen_grammar.pir​:1841)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 20899
(src/gen_grammar.pir​:210)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 634
(src/PCT/HLLCompiler.pir​:388)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 428
(src/PCT/HLLCompiler.pir​:301)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 862
(src/PCT/HLLCompiler.pir​:500)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1217
(src/PCT/HLLCompiler.pir​:669)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1398
(src/PCT/HLLCompiler.pir​:759)
called from Sub 'parrot;Perl6;Compiler;main' pc 19195 (perl6.pir​:162)

@p6rt
Copy link
Author

p6rt commented Jan 10, 2009

From @TimToady

On Thu, Jan 08, 2009 at 06​:11​:22AM -0800, Richard Hainsworth wrote​:
: # New Ticket Created by Richard Hainsworth
: # Please include the string​: [perl #​62070]
: # in the subject line of all future correspondence about this issue.
: # <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=62070 >
:
:
: I have the following in a file test.pl
:
: macro doit ($word) {
: return quasi <say <<<$word>>> <<<$word>>> ;>
: };

Note there's a syntax error here​: you can't feed two terms in a row
to "say". There needs to be a comma after the first quasi-unquote.
From S06​:

  Hence, while the quasiquote itself is being parsed, the syntactic
  interpolation of a unquoted expression into the quasiquote always
  results in the expectation of an operator following the variable.

On the other hand, I doubt rakudo handles macros yet in any case.

Larry

@p6rt
Copy link
Author

p6rt commented Jan 10, 2009

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

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

@pmichaud - Status changed from 'open' to 'stalled'

@p6rt
Copy link
Author

p6rt commented Jan 12, 2009

From @finanalyst

I have the following in a file test.pl

macro doit ($word) {
  return quasi <say <<<$word>>> <<<$word>>> ;>
};

doit('one');
doit('two');
doit('three');

It should - I think - be outputting​:
one one
two two
three three

Instead I get​:
$ perl6 ./test.pl
Statement not terminated properly at line 1, near "{\n return"

current instr.​: 'parrot;PGE;Util;die' pc 129
(runtime/parrot/library/PGE/Util.pir​:83)
called from Sub 'parrot;Perl6;Grammar;eat_terminator' pc 28962
(src/gen_grammar.pir​:3368)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 27610
(src/gen_grammar.pir​:2835)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 25043
(src/gen_grammar.pir​:1841)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 20899
(src/gen_grammar.pir​:210)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 634
(src/PCT/HLLCompiler.pir​:388)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 428
(src/PCT/HLLCompiler.pir​:301)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 862
(src/PCT/HLLCompiler.pir​:500)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1217
(src/PCT/HLLCompiler.pir​:669)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1398
(src/PCT/HLLCompiler.pir​:759)
called from Sub 'parrot;Perl6;Compiler;main' pc 19195 (perl6.pir​:162)

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

@pmichaud - Status changed from 'new' to 'stalled'

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @pmichaud

On Sun, Jan 11, 2009 at 08​:56​:06PM -0800, Richard Hainsworth wrote​:

I have the following in a file test.pl

macro doit ($word) {
return quasi <say <<<$word>>> <<<$word>>> ;>
};

Macros aren't implemented in Rakudo yet, aren't likely to be implemented
until after we re-do parsing.

Stalling ticket for now.

Pm

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 12, 2009

@pmichaud - Status changed from 'open' to 'stalled'

@p6rt
Copy link
Author

p6rt commented Nov 14, 2012

From @coke

On Thu Jan 08 06​:11​:21 2009, richardh wrote​:

I have the following in a file test.pl

macro doit ($word) {
return quasi <say <<<$word>>> <<<$word>>> ;>
};

doit('one');
doit('two');
doit('three');

It should - I think - be outputting​:
one one
two two
three three

Instead I get​:
$ perl6 ./test.pl
Statement not terminated properly at line 1, near "{\n return"

current instr.​: 'parrot;PGE;Util;die' pc 129
(runtime/parrot/library/PGE/Util.pir​:83)
called from Sub 'parrot;Perl6;Grammar;eat_terminator' pc 28962
(src/gen_grammar.pir​:3368)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 27610
(src/gen_grammar.pir​:2835)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 25043
(src/gen_grammar.pir​:1841)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 20899
(src/gen_grammar.pir​:210)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 634
(src/PCT/HLLCompiler.pir​:388)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 428
(src/PCT/HLLCompiler.pir​:301)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 862
(src/PCT/HLLCompiler.pir​:500)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1217
(src/PCT/HLLCompiler.pir​:669)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1398
(src/PCT/HLLCompiler.pir​:759)
called from Sub 'parrot;Perl6;Compiler;main' pc 19195 (perl6.pir​:162)

Here's a version updated to current macro syntax​:

21​:05 < [Coke]> r​: macro doit ($word) { return quasi { say {{{$word}}},
  {{{$word}}} ;} }; doit('one'); doit('two'); doit('three');
21​:05 <+p6eval> rakudo fc349a​: OUTPUT«oneone␤twotwo␤threethree␤»

Basic macros are pretty well tested. Closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Nov 14, 2012

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

@p6rt
Copy link
Author

p6rt commented Nov 14, 2012

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

@p6rt p6rt closed this as completed Nov 14, 2012
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant