Re:Nim Programming Language v0.15.0 released
by captainmuon on Saturday October 01, 2016 @01:53AM
(#12616665)
Actually, in Nim almost everything is an expression, including if blocks, case, and even except blocks.
Together with immutable "variables" (let) this encourages a pretty functional style. I'd just wish their support for lambdas and list comprehensions would be a bit better.
Re:Nim Programming Language v0.15.0 released
by nathancahill on Saturday October 01, 2016 @12:15AM
(#12616490)
I highly agree, especially about the if/else. The more I code, the more I try to elimante branching. If statements as expressions would be ideal.
Re:Nim Programming Language v0.15.0 released
by qznc on Saturday October 01, 2016 @02:43AM
(#12616794)
Most mainstream languages (C, Java, etc) have this. The ternary operator ?:
Re:Nim Programming Language v0.15.0 released
by 35bge57dtjku on Saturday October 01, 2016 @03:00AM
(#12616831)
That's like farting in the bathtub and calling it a hot tub.
Re:Nim Programming Language v0.15.0 released
by tigershark on Saturday October 01, 2016 @05:16AM
(#12617146)
Why? It is an expression, not a statement regardless of your farting nonsense.
Re:Nim Programming Language v0.15.0 released
by 35bge57dtjku on Monday October 03, 2016 @11:39AM
(#12628288)
Because they aren't the same thing.
Re:Nim Programming Language v0.15.0 released
by hermanradtke on Saturday October 01, 2016 @12:33AM
(#12616526)
Based on my understanding, Rust is an expressive language. What have you seen that is not expressive?
Re:Nim Programming Language v0.15.0 released
by jeremyjh on Saturday October 01, 2016 @07:44AM
(#12617461)
You are mistaken about rust. I can't think of a construct that is not an expression.
Re:Nim Programming Language v0.15.0 released
by steveklabnik on Saturday October 01, 2016 @09:24AM
(#12617727)
let x = 5;
(That said, very nearly everything is an expression, yes)
Re:Nim Programming Language v0.15.0 released
by wisam on Saturday October 01, 2016 @11:48AM
(#12618331)
I don't know about Rust; but in ML family, everything in top level is a binding. Whether it's a variable, function, type or structure.
SML is explicit about it and its syntax makes it clear what type of binding is going on.
val x = 5
fun f = fn x => x * x
datatype weekend = Sat | Sun
So while on top level not everything is an expression, everything on the RHS is an expression.
Re:Nim Programming Language v0.15.0 released
by qwertyuiop924 on Saturday October 01, 2016 @05:26PM
(#12619960)
In rust, assignment isn't an expression, but everything else is.
Even conditional logic constructs (if/else) should be an expression (i.e. return a value).
The language doesn't even have to be pure or hard core FP to follow this philosophy.