by Dewie · 12y ago · 0 comments
Maybe Nimrod?
[Edit] Read Nimrod tutorials and ported a few toy programs. It's encouragingly clean and doesn't seem to shy away from features... I wonder if Alex Stepanov knows that, in Nimrod, "if you overload the == operator, the != operator is available automatically and does the right thing" ;)
Consider this from the tutorial:
fn draw_all(shapes: &[~Drawable]) {
vs C++: draw_all (const vector<unique_ptr<const Drawable>>& shapes) {
Transcribing that took a few seconds of thought, and all the terseness of a few symbols has accomplished is to obscure a poor choice of API and ownership semantics. That's just one symbol... how horrific can we make something without noticing with just a few more params and symbols?(Also, your equivalence is not quite correct: `&[T]` is more like a Boost range. In particular your transcription makes it look like the original code only accepted Vec<T>, which is not the case.)
> That's just one symbol... how horrific can we make something without noticing with just a few more params and symbols?
You've pretty much covered all the type-level symbols in Rust, except for * for unsafe pointers.
In some instances Rust has removed syntax or its prevalence (@ turned into Gc/Rc; ~[] no longer grows, but Vec does).
To each their own.
I'm still using C++ myself until the dust settles a bit, but I've found that my C++(11) code is trending towards being less stateful and more functionl-ish.
It's cool to see things changing in this space after feeling like it would be old style C or C++ forever.
[0] https://github.com/eudoxia0/cmacro/blob/master/grammar/lexin...