~roselandgoose

Chicago


#869 Consider adding some syntax to denote that two opaque types must be the same 7 months ago

Comment by ~roselandgoose on ~sircmpwn/hare

Would you want such a linter to be a separate program from the build driver?

#869 Consider adding some syntax to denote that two opaque types must be the same 7 months ago

Comment by ~roselandgoose on ~sircmpwn/hare

While I personally would appreciate the annotations approach Seb is suggesting, I agree with Ember and Bor that it is not right for hare. I think it is at best against Drew's intention in the annotations RFC and at worst basically a language extension...

However I would like to propose (yet) another alternative though. To be honest, I'm not totally sold on it myself as it requires a little bit of magic, though hopefully only as much as the new debug features. I was also inspired by Lorenz's macro discussion, though I think the following idea is a little more in keeping with hare's values than Lorenz's full on meta-programing idea:

What if we exposed a hook for modules to insert @test functions into code that imports (uses) them? Once we have a working hare::check::, modules like sort:: which expose *opaque -based interfaces could insert @test functions that would check for erroneous usage, written entirely in regular hare code with no reliance on extra syntax. Thoughts?

P.S. Apologies if this is an idea that has already been discussed in another ticket or list thread. If it is new and worth considering, I'm happy to do some research into what it would look like and write up an RFC.