Skip to content
  • Yorick Peterse's avatar
    Fix stdout.print/stderr.print panicking · 4868f9a9
    Yorick Peterse authored
    stdout.print and stderr.print perform two writes: one for the message,
    and one for a newline. The newline write was not wrapped in a "try"
    expression, causing any exceptions thrown to go unnoticed.
    
    Sending messages to optional types inside a "try" was also broken. When
    doing so, the VM would jump to the incorrect instruction and effectively
    ignore the "else" clause; bubbling up the error instead. This is fixed
    by having the compiler generate different code: instead of jumping to
    the next block (whatever that may be), we jump to a specific block.
    
    As part of this the signature of stdout.print/stderr.print is also
    changed. Instead of the argument being typed as `?ToString`, it's now a
    `ToString` with an empty String as the default value.
    
    This fixes #199
    4868f9a9