On Tue, Aug 9, 2022 at 1:08 PM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:

> Trying to understand the native APIs and their purpose for the new
> redirecting environments. It
> still seems to be the case that any result can be returned and assigned to
> the RC variable.
>

Which has always been the case for command handlers.


>
> The question is about the usage of redirected input, output and error from
> the native side.
>
> Should one use e.g. ReadInput[Buffer](), WriteOutput[Buffer]() and
> WriteError[Buffer]() only if the
> respective redirection tests (IsRedirectionRequested() and
> IsInputRedirected()/IsOutputRedirected()/IsErrorRedirected()) return true?
>
Yes. While you don't have to, it's better to avoid the performance impact
associated with multiple interpreter callbacks that need to acquire the
interpreter lock. That's a pretty expensive noop.




>
> Would it be a fatal error to use e.g. Write{Error|Output}[Buffer]()
> although
> Is{Error|Output}Redirected() returns false? What would happen in such a
> case; is the operation
> ignored or would that have any adverse side effects?
>

The operation is ignored, but it has a non-zero cost associated with making
the call.

>
> And with ReadInput[Buffer]() would it just return 0 in length if it is not
> redirected?
>
It doesn't currently, it just leaves the length unchanged. It probably
should.

Rick



>
> ---rony
>
>
>
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to