Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Symmetry
on Jan 23, 2015
|
parent
|
context
|
favorite
| on:
What makes Nim practical?
Rust is planning to add that eventually, but in the meantime:
fn foo(n: i32) -> i32 { n * 2 } const y: i32 = foo(3);
error: function calls in constants are limited to struct and enum constructors [E0015]
pcwalton
on Jan 23, 2015
[–]
You can do it with a compiler plugin; I suspect that's what the parent comment was referring to. Admittedly compiler plugins are pretty experimental at this time.
CyberShadow
on Jan 23, 2015
|
parent
[–]
Sorry about that. I haven't tried this myself, I was told by a Rust user that its CTFE was on par with D's. I guess he was mistaken.
Jweb_Guru
on Jan 24, 2015
|
root
|
parent
[–]
Not even close, sadly.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: