[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: type annotations
From: |
Claude Marinier |
Subject: |
Re: type annotations |
Date: |
Mon, 17 Aug 2020 13:54:46 -0400 |
On Mon, 17 Aug 2020 at 11:04, siiky <github-siiky@net-c.cat> wrote:
> On 8/16/20 1:54 PM, Claude Marinier wrote:
> > I have discovered types.
> > https://wiki.call-cc.org/man/5/Types <https://wiki.call-cc.org/man/5/Types>
> > When used judiciously and sparingly, this could be useful to prevent
> > errors and provide optimisation (specialisation) hints to the compiler.
> >
> > Is there a guide to using this well? I would like examples. Perhaps one
> > of the Chicken libraries or eggs can be used as an example.
>
> I myself would like some good usage examples of `chicken.type`, but if
> you're just getting started and not sure how to use them, or you're
> getting errors, I hope [0, 1, 2] may be helpful to you. The annotations
> on the macros in [1, 2] are not as strict as they could be. And some of
> the other type annotations may even be wrong (e.g. using the symbol uri
> to mean an URI object; the way I use it, it's the same as using *, the
> "any" type), because usually the compiler doesn't complain too much and
> I forget to update them.
>
> [0]:
> https://github.com/SiIky/ssg/blob/81e863733fa6b3e34608adc1ca89065f0759c836/ssg.converters.lowdown.scm#L32-L42
> [1]:
> https://github.com/SiIky/invidious.scm/blob/09c1b26080ecf1ba64a86b3ece501d975ea3608a/invidious.req.v1.scm#L41-L58
> [2]:
> https://github.com/SiIky/invidious.scm/blob/09c1b26080ecf1ba64a86b3ece501d975ea3608a/invidious.uri.v1.scm
Thank you, André,
The examples help. I expect that procedure signatures are the most
common use of type annotations. They seem to provide the most benefit
for the level of effort and extra code.
In the manual page for types ( http://wiki.call-cc.org/man/5/Types ),
what is the meaning of the period in the definition of VALUETYPE for
procedures? The first three annotation variants for procedures use the
period: alone, with « -> », and with « --> ». I find the documentation
confusing.
Merci.
--
Claude Marinier