Skip to content

I/O handle fake methods on ParrotInterpreter #1025

Util opened this Issue Nov 2, 2013 · 0 comments

1 participant

Parrot Virtual Machine member
Util commented Nov 2, 2013

Reported by:

The methods "stdin_handle", "stdout_handle", and "stderr_handle" on ParrotInterpreter operate on the currently running interpreter, not on the interpreter represented by the invocant. Example:

$ cat t58.pir
.sub foo
        $P0 = get_global "maininterp"
        $P2 = $P0."stdout_handle"()
        $P1 = $P0."stderr_handle"()
        print $P2, "A\n"
        .return ()
.sub main :main
        $P0 = getinterp
        set_global "maininterp", $P0
        .const "Sub" foo = "foo"
        $P1 = new "Task", foo
        schedule $P1
        sleep 0.1
        say "B"
$ ./parrot t58.pir  2>/dev/null

The "B" should have gone to stderr, and thus to /dev/null.

What I said in previous bug report about the "recursion_limit" method applies here too: reading and writing the standard I/O handles of the currently running interpreter are perfectly reasonable operations to support, but they should be presented as opcodes or as standalone subroutines. It is highly misleading to present them as methods on some invocant object that is unrelated to the operation. On the other hand, if there are to be these methods on interpreter objects, they should operate on the interpreter represented by their invocant. (It's also fine to have both types of interface, as long as each is individually in a sensible form.)


Summary of my parrot 5.7.0 configuration:
  configdate='Sat Oct  5 12:42:43 2013 GMT'
    osname=linux, archname=x86_64-linux-gnu-thread-multi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.