develooper Front page | perl.perl6.users | Postings from November 2018

Re: what type $in,$out and $err is

Thread Previous | Thread Next
Ralph Mellor
November 1, 2018 12:28
Re: what type $in,$out and $err is
Message ID:
On Sun, Oct 28, 2018 at 7:26 PM Xiao Yafeng <> wrote:

> I'm curious about what type of $in is on Proc class.

`$in` isn't "on `Proc` class".

`$in` is a *parameter* of the `.new` *method*.

> I mean, if $in is IO::Pipe object

As a *parameter* of the `.new` method *declaration* the type of `$in` is
not explicitly specified. When a parameter's type is not explicitly
it defaults to the type `Any`.

The type of the corresponding `:in` *argument*  in a *call* of the `.new`
method is of whatever type you choose to pass. Any ordinary value is
a sub-type of `Any` so the method will accept it. For example, `True`
and `False` are ordinary values so will be accepted.

Besides, just curious, why choose '_' as default it looks strange....

It's '-', not '_'.

'-' is a 50 year old or more unix convention that, when used for a filename
or pipe name means, depending on context, the standard input or output
handles of a process.




Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About