From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Tue, 7 Mar 2006 00:11:13 +0100
On Mar 6, 2006, at 23:16, Jonathan Worthington wrote: > "Leopold Toetsch" <[EMAIL PROTECTED]> wrote: >> $I0 = pio.'print'("sample data\n") # return sucess (>=0) or >> failure (<0) >> pio.'print'("sample data\n") # throw exception on failure >> > Could perhaps get fun for compilers though - what if the program just > throws away the return value? So some optimizer that doesn't know this > subtlety sees this code and throws away the unused return value or > just never emits the assignment, and the behaviour changes. I'm not > sure I like this idea. Good point. Then I prefer exceptions + return value (which may be ignored eventually - depending on strictness of retval/result count error checking). Seems to me this won't be a problem if the ideas discussed in the "Param count checks" thread (5-7 Feb, <http://xrl.us/jwt2>) are implemented. There we discussed having one syntax that means "I expect exactly zero returns" and another that means "I expect any number of returns but don't plan to use it/them." This context information should also be testable by the I/O implementation, and no sane Parrot optimizer would dare throw it away. True? -- Bob Rogers http://rgrjr.dyndns.org/