Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Past-pm printing the return value of the main routine

12 views
Skip to first unread message

Allison Randal

unread,
Dec 12, 2006, 12:47:16 PM12/12/06
to Perl 6 Internals
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?

Allison

Patrick R. Michaud

unread,
Dec 12, 2006, 1:35:40 PM12/12/06
to Allison Randal, Perl 6 Internals

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

Allison Randal

unread,
Dec 12, 2006, 1:42:52 PM12/12/06
to Patrick R. Michaud, Perl 6 Internals
Patrick R. Michaud wrote:
>
> What revision number are you working with? I think this was fixed in
> a later revision of HLLCompiler.

Aye, this was yesterday. Working now.

Allison

Allison Randal

unread,
Dec 12, 2006, 12:13:34 PM12/12/06
to Perl 6 Internals
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?

Allison

0 new messages