projectfluent / fluent-rs

Rust implementation of Project Fluent
https://projectfluent.org
Apache License 2.0
1.05k stars 95 forks source link

Consider adding `const fn` support #192

Open mainrs opened 3 years ago

mainrs commented 3 years ago

This would be useful in cases where an explicit language should be chosen during compilation. That way, static values that do not take arguments or depend on pluralization could be directly embedded into the application and improving performance.

With the landing of Rust 1.46 and their const-fn improvements, it would be possible to declare a lot of function as const.

I know that this is a pretty niche use-case but there are scenarios where this might be useful (mostly on size-restrained devices like embedded systems). The Linux world would probably like this too, as they often enough want to optimize for file size (and not want to include all languages by default for example).

Off-topic
P.S.: The project looks very promising and I'd like to contribute. Although some issues are marked as `help-wanted`, none are marked as `good-first-issue`. And it's hard to judge what issues might be easy to implement for a new contributor! So if you have suggestions, let me know!
zbraniecki commented 3 years ago

I'm happy to explore that! Feel free to look at the current code and suggest how to approach it :)

alerque commented 2 months ago

There seems to be a little bit of overlap in needs between this and other use cases for pre-compiled (e.g. #253) or infallible messages (#107); c.f. #36.