Y
Hacker News
new
|
ask
|
show
|
jobs
by
wyldfire
2037 days ago
Hmm. Could you do this kind of code for a static allocation at compile-time too?
2 comments
steveklabnik
2037 days ago
I believe
https://github.com/rust-lang/const-eval/issues/20
is the entry point into this kind of thing. As you can see, there's a lot of discussion. If it ever lands it'll be farther out.
link
efnx
2037 days ago
I don’t think so - you can only use static functions to declare static variables. But you could do it with a macro. It’s debatable whether that would be readable and predictable, though.
link