nqp icon indicating copy to clipboard operation
nqp copied to clipboard

$output (inside of HLL::Compiler.eval) seems that it doesn't need any arguments

Open titsuki opened this issue 6 years ago • 2 comments

See the following lines: https://github.com/perl6/nqp/blob/master/src/HLL/Compiler.nqp#L181 https://github.com/perl6/nqp/blob/master/src/HLL/Compiler.nqp#L185 https://github.com/perl6/nqp/blob/master/src/HLL/Compiler.nqp#L188

When I tried rakudo-and-nqp-internals-course and created a PHP-like language, I noticed that $output(|@args) causes error when @args is not empty.

This example implements a workaround for this problem, but I think it is not the best way: https://github.com/perl6/nqp/blob/master/examples/rubyish/rubyish.nqp#L1046-L1060

titsuki avatar Jan 13 '18 15:01 titsuki

I noticed that $output(|@args) causes error when @args is not empty.

Do you still have the contents of the error? What did it say?

zoffixznet avatar Jan 13 '18 19:01 zoffixznet

@zoffixznet

OK, I have.

input.php: https://gist.github.com/titsuki/86b7854102f0a30a7db02a8e96940b82

5.3.issue.nqp: https://gist.github.com/titsuki/ce83497e0133d2559af2ee4b6d948cc0

Error messages:

$ nqp 5.3.issue.nqp input.php
Too many positionals passed; expected 0 arguments but got 1
   at input.php:1  (<ephemeral file>:)
 from gen/moar/stage2/NQPHLL.nqp:1537  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1774  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:1699  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1625  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from 5.3.issue.nqp:101  (<ephemeral file>:MAIN)
 from 5.3.issue.nqp:92  (<ephemeral file>:<mainline>)
 from gen/moar/stage2/NQPHLL.nqp:1537  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1774  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:1666  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1625  (/home/itoyota/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/stage2/NQP.nqp:4123  (/home/itoyota/rakudo/install/share/nqp/lib/nqp.moarvm:MAIN)
 from gen/moar/stage2/NQP.nqp:4118  (/home/itoyota/rakudo/install/share/nqp/lib/nqp.moarvm:<mainline>)
 from <unknown>:1  (/home/itoyota/rakudo/install/share/nqp/lib/nqp.moarvm:<main>)
 from <unknown>:1  (/home/itoyota/rakudo/install/share/nqp/lib/nqp.moarvm:<entry>)

Version info:

$ nqp --version
This is nqp version 2017.12-44-gec345715b built on MoarVM version 2017.12-22-gc2de234c
$ perl6 --version
This is Rakudo version 2017.12-140-g14c2cdb31 built on MoarVM version 2017.12-22-gc2de234c
implementing Perl 6.c.

titsuki avatar Jan 14 '18 00:01 titsuki