4 ms·
This is a good post and technique in general. I used to use it extensively in C++: beware though of (super long) compile errors while nesting them through temp
by rq1 6y ago
This is a good post and technique in general.
I used to use it extensively in C++: beware though of (super long) compile errors while nesting them through templates params. :)
Edit: I was wrapping pointers for instance to not mix GPU and CPU memory addresses, to define a unidirectional flow of memory transfers between devices (and avoid manual synchronisation and tracking)... etc.
You could somehow define a state machine through types and ensure compositional coherence.
- pd-andy 6y agoUsing phantom types in state machine transitions is really cool, yeah. I came across a little gist that explored that idea in Elm [1] the other day, actually. [1]: https://gist.github.com/rupertlssmith/88946c8d207d7ad64daf4360fef1ac42 https://gist.github.com/rupertlssmith/88946c8d207d7ad64daf43...