Re:C++11 and Boost - Succinct like Python
by fusiongyro on Wednesday October 31, 2012 @09:05PM
(#4725677)
Having programmed Haskell for the last seven years (and C++ for zero) I have a fairly decent handle on what HM is all about. If all you had said is that the foundations of C++ are too far gone, there wouldn't be anything to discuss. But the foundations of C++ being what they are, there's no point being offended when unfixable things go unfixed. I love HM, but you can't just throw it in any old language simply because it's cool. The language's semantics need to allow for it, and they just don't with C++.
Re:C++11 and Boost - Succinct like Python
by danking00 on Thursday November 01, 2012 @06:34AM
(#4726905)
Correct, I do not suggest adding HM to C++.
I suggest using a HM language when you start a new project.
Re:C++11 and Boost - Succinct like Python
by comex on Thursday November 01, 2012 @02:09PM
(#4728848)
It's possible to do exactly that (a function that initialized a vector with its arguments) in C++ with variadic templates...
You might end up in trouble if you did something like
auto v = vec(
vec(1.2, 3.4),
vec(0)
)
not sure how well other languages deal with that.
Re:C++11 and Boost - Succinct like Python
by daivd on Thursday November 01, 2012 @06:11AM
(#4726857)
"Hell, stop programming in C++ and start using Rust!" I plan to try to do that, when Rust has become more stable.
No need to downvote this; I'm an enthusiastic Rust follower and I as well recommend that you stay far away from Rust until it settles down a bit. Wait for 0.5 if you're adventurous, 0.6 if you expect some degree of feature-completion, 0.7 if you're fine with half-finished standard libraries, and even later if you expect a high degree of stability, ergonomics, documentation, or performance.
This is part of why I said that the foundations of C++ are too far-gone.
And this syntax isn't necessary to save on typing. In a language that supported syntactic macros (such as Scheme or Racket) we could write something like:
which expands to something like: If you're interested in true syntactic macros for non-sexp languages (though I do suggest getting over the parentheses, my color settings make them nearly indistinguishable from the background) look at Rust [1].Actually, Rust also has type inference [2].
Hell, stop programming in C++ and start using Rust! [3]
[1] http://dl.rust-lang.org/doc/tutorial-macros.html [2] http://dl.rust-lang.org/doc/0.4/rust.html#type-system [3] http://www.rust-lang.org/