With static intro all of this is a macro, while loop, and a switch statement. A fraction of the complexity and you get editor help and typed holes. https://willcrichton.net/notes/type-safe-printf/ … https://github.com/deech/LambdaWorldCadiz2019-WhatFPCanLearnFromStaticIntrospection/blob/master/printf.nim …
That said, I agree that the trait-encoding is gnarly. I think there are ways to make these kinds of programs easier to write, in terms of distance from mental model to code. See:https://github.com/willcrichton/tyrade …
-
-
But doesn't the rust built-in have access to type information that rust users do not have? With static intro any user of the language can run the type checker on an arbitrary expression at compile time.
-
Oh I see -- you're right, Rust doesn't give user-space macros access to type information. I've wanted this for a while though (see: https://willcrichton.net/notes/type-directed-metaprogramming-in-rust/ …).
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD