Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

I/O handle fake methods on ParrotInterpreter #1025

Open
Util opened this Issue · 0 comments

1 participant

@Util
Owner

Reported by: zefram@fysh.org

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"()
        $P0."stdout_handle"($P1)
        print $P2, "A\n"
        .return ()
.end
.sub main :main
        $P0 = getinterp
        set_global "maininterp", $P0
        .const "Sub" foo = "foo"
        $P1 = new "Task", foo
        schedule $P1
        sleep 0.1
        say "B"
.end
$ ./parrot t58.pir  2>/dev/null
A
B

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.)

-zefram

Summary of my parrot 5.7.0 configuration:
  configdate='Sat Oct  5 12:42:43 2013 GMT'
  Platform:
    osname=linux, archname=x86_64-linux-gnu-thread-multi
    perl=/usr/bin/perl
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.