ambuda-org / vidyut

Infrastructure for Sanskrit software. For Python bindings, see `vidyut-py`.
48 stars 21 forks source link

[kosha] Consider using `Option` instead of `None` variants in `semantics` #11

Closed akprasad closed 1 year ago

akprasad commented 1 year ago

Option is more idiomatic but might lead to a lot of friction for callers. We should experiment with it and see how it feels.

akprasad commented 1 year ago

I think we should do this. It's tedious, but it represents semantics better and has fewer gotchas long-term.

The right approach, I think, is to create PackedLinga, PackedVibhakti etc. which are variants that have the modular_bitfield annotation. Then we can have a From train that converts e.g. Linga to PackedLinga and vice-versa.

Although doing this makes the internal API much uglier, it cleans up the public API, which is a worthwhile tradeoff.

akprasad commented 1 year ago

Completed in ede1e45.