On Sun, Oct 28, 2018 at 7:26 PM Xiao Yafeng <xyf.x...@gmail.com> 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
specified
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.

cf https://stackoverflow.com/a/8045639/1077672

hth

--
raiph

Reply via email to