InterfaceSpecs.jl icon indicating copy to clipboard operation
InterfaceSpecs.jl copied to clipboard

Take ideas from Racket

Open jariji opened this issue 2 years ago • 2 comments

Racket has contracts (guide, reference). There are a lot of research papers on it, especially

jariji avatar Jun 08 '23 19:06 jariji

I don't really know much about Racket, but it looks like this facility is a semantic one, which I'm very explicitly trying not to do. That said, if there's particular features in this system that people think are nice, I'd like to hear about it.

Keno avatar Jun 09 '23 05:06 Keno

Some ideas that come to mind are

  • Blame, especially in higher-order functions. If map(f, x) goes wrong, whose fault is it: the caller for misusing one of those functions, or the developer of f, or map? It depends. With a first-class concept of "blame", the user is informed where the problem is in each case. See example, and papers linked above.

  • Contract combinators, like the or combinator that takes two contracts and makes a contract that is satisfied if either of its components is.

jariji avatar Jun 09 '23 06:06 jariji