On Wed, Oct 3, 2018 at 22:21 ToddAndMargo <toddandma...@zoho.com> wrote:

> >> On 04/10/2018 03:07, ToddAndMargo wrote:
> >>> Hi All,
> >>>
> >>> In another thread, Timo wrote me:
> >>>
> >>>         The "-->" part of the signature is optional. If there isn't
> >>>         one, it defaults to Mu, which is the type that everything
> >>>         conforms to, i.e. the sub or method that either has "--> Mu"
> >>>         explicitly, or has it by leaving it out, may return
> >>>         absolutely whatever it wants.
> >>>
> >>>         After all, the "-->" part is a constraint, and it gets
> >>>         validated at compile time every time a sub or method
> >>>         returns.
> >>>
> >>> I got to thinking, some routines do not return anything.  Without
> >>> the "-->" constraint, how am I to determine if something is
> >>> being returned?
> >>>
> >>> Yours in confusion,
> >>> -T
>
> On 10/3/18 6:44 PM, Timo Paulssen wrote:
> > I just spotted a grave mistake in my earlier mail:
> >
> > the --> constraints are validated at *run* time, not *compile* time;
> > that's a very big difference, and an important one. Of course "every
> > time a sub or method returns" doesn't make much sense if i had meant
> > "compile time", but I felt i should really point it out before causing
> > too much confusion.
> >
>
> Hi Timo,
>
> Thank you for the help over on the chat line with IN!
>
> My confusion is not that it returns something (Mu).
>
> My confusion is "what" it returns.


I'm not clear on what you mean. When "--> XXX" is given, then an XXX is
returned. When no "-->" is given, it technically returns Mu but you can
pretend it is like a Pascal/Module "procedure" that does not return
anything.

And not all subs
> return things, like "say" and "print".


That's not the case. "say" and "print" return something that conforms to -->
 Bool:D (in most cases, True).


>
> I am presuming I am to pick the "what" from context
> from the examples?


What context or examples are you referring to? Both docs rather clearly
state that True is typically returned, and in the case of
https://docs.perl6.org/routine/say the very second code example states this
in English and then shows it with an example.


>
> -T
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

Reply via email to