teikalang / teika

MIT License
318 stars 7 forks source link

teika: use mutable substitutions #217

Closed EduardoRFS closed 2 months ago

EduardoRFS commented 2 months ago

Goals

Achieve a much faster typer.

Context

Currently Teika uses a model where substitutions are only dropped when the stack unwinds, this makes so that the substitutions are never overwritten while some term may still reference it, making so that storing them on the stack is not needed, additionally this makes using a mutable array as the substitutions list waaay easier.

This PR switches to using a mutable substitution list, but note that the actual substitutions are "imutable" and only the content can change, this is intentional as the reference to the substs should indicate the length of substs. This is not optimal but is really easy to implement.

Related