Re: Past-pm printing the return value of the main routine
by Patrick R. Michaud other posts by this author
Dec 12 2006 10:35AM messages near this date
Past-pm printing the return value of the main routine
|
Re: Past-pm printing the return value of the main routine
On Tue, Dec 12, 2006 at 09:47:16AM -0800, Allison Randal wrote:
> In Punie or Perl 6, when I execute a simple statement:
>
> print "2";
>
> It prints "21". This is because a) the return value of a successful
> print is "1", b) the main routine is returning the value of the last
> statement (note this is correct for Perl, but isn't correct for all
> languages), and c) HLLCompiler is printing out the return value of the
> eval'd code here:
>
> 376 save_output_1:
> 377 print ofh, result
> 378 close ofh
>
> Commenting out line 377 gives the correct behavior of just printing "2".
> My question is, why is HLL compiler printing out the return value of the
> main routine?
What revision number are you working with? I think this was fixed in
a later revision of HLLCompiler.
(It outputs the return value from the compilation phase when
--target=pir is specified. The previous version was a bit
overeager about outputting the result.)
Pm
Thread:
Patrick R. Michaud
Allison Randal
|