APrioriInvestments / typed_python

An llvm-based framework for generating and calling into high-performance native code from Python.
Apache License 2.0
197 stars 8 forks source link

Implement full ConstDict model in compiler #367

Open braxtonmckee opened 4 years ago

braxtonmckee commented 4 years ago

Right now, we have an incomplete implementation that doesn't actually let you do much with const dicts. We should implement the full set of semantics, including adding, converting from typed things like Dict(T1, T2), etc.

Also, we should probably implement the formal tree model for it, because right now lots of standard operations in the interpreter are quite slow if the dicts get large.

rubidge commented 3 years ago

I see that the "+" operator is implemented for ConstDict, but it looks like this will be the "|" operator as of Python 3.9. Other missing operations: d.copy() d.fromkeys() reversed(d) [for 3.8] Besides converting Dict(T1,T2) -> ConstDict(T3,T4), I think that's all the missing operations.

[Regarding Dict: The "+" operator is not implemented for Dict, but when we do implement it, it should be the "|" operator as of Python 3.9. The Dict implementation is also currently missing copy, fromkeys, and reversed support.]