On 2019-12-09 07:21, Simon Proctor wrote:
I think this does highlight something we probably should document more.

How to read signatures. Because it's a *very* powerful part of the language that if you don't understand you're only using it at half strength.

multi method contains(Str:D: Cool:D $needle, Cool:D $pos --> Bool:D)

If not some documentation magic, it's a core part of the language. It tell you this method is called on a defined Str (Str:D:) it takes 2 positional arguments which have to be defined Cool types ($needle and $pos) and it returns a Boolean.

That is the code as it will be written in the Str Role.

I *highly* advise learning how signatures work.


Hi Simon,

Did you see the How To post I made on ".contains"?  At
the bottom of the How To, I take apart the signature
and explain each part.

Do you see anywhere in the docs where how to read
signatures is explained?  (Don't get any ideas.  The
signatures should not be there to start with.)

An aside on the signatures: what is and what is
not a separator can blow your mind.

Do you think it help me or anyone else understand
how to use ".contains" because I explained the
"Signature"?  Seriously?

To answer the question, look at all the various
teaching manuals out there for Raku.  Do you see a
SINGLE ONE, other that the one I posted, that
uses the signatures as a teaching tool?

And notice that I put the signature explanation
at the bottom AFTER I explained how to use the
function (method).  This is akin to the good math
teachers that run circles around bad math teachers
in both mechanics and theory by FIRST teaching the
mechanics and them teaching the theory.  When
teaching, you should never start with the theory.
The docs do just that.

The "Signatures" in the docs only confuse and often
have mistakes in them.  Trying to get them corrected
is a fools errand too.

The signatures are how the developers talk to each other.
And judging by the results of their work, it works
marvelously for them.  This kind of information is
not appropriate for standard Rakoon that just wants to
write code.

You don't need to know how much current affects an LED
diode to read the time on your digital clock.  This
is what the signatures are doing.

The Signatures only confuse.  They need to be left to
the developers.

-T

Reply via email to