4 ms·
there are still things I wish would be possible for c++. I'm not a language expert, but I still wish for those things. * non templated tuples instead of struct
by jokoon 12y ago
there are still things I wish would be possible for c++. I'm not a language expert, but I still wish for those things.
* non templated tuples instead of struct: for example, 2 struct types are the same if the data types they hold is the same. Not sure if it's possible for statically typed language.
* tighter STL container integration with the core language syntax
* some way to do modules
* some new thing to make compiling much faster, so to avoid relying on precompiled headers. go and rust are so much faster for this, C++ is not. I still wonder if there could be some gcc or clang extension for this, it would be really appreciated. C++ is awesone to work with, but language implementations suffers from those little details.
- loup-vaillant 12y agoML and Haskell are statically typed, and have tuples as you describe them. For instance, the tuple (42, "foo", fun x -> x+3) has type int * string * (int -> int) in ML. It would probably be a serious extension to C++'s type system, though, and for limited benefit: you're asking for yet another way to do Cartesian product. Structs already do that. What's sorely lacking is sum types: type 'a option = Some of 'a | None type 'a list = Cons of 'a * 'a list | Empty --- Integrating the STL at a syntax level gives a special status to the standard library, preventing users from writing effective replacements or analogies. Also, C++ has precious little orthogonality left, let's not destroy it. --- What kind of modules are you talking about? C++ has compilation units, classes, and namespaces. What capability do you want that they don't already provide? --- Good luck on the fast compilation front. That one will likely require removing things from the language, or making some major compatibility-breaking changes in the syntax (to make it easier and faster to parse), and possibly a rework of the template system. No. Way.
- AnimalMuppet 12y agoIf I understand correctly, Go is the "removing things from the language" approach to fixing the fast compilation issue.
- robmccoll 12y agoYes. Namely templating.
- pixelglow 12y agoclang has implemented modules as a replacement for monolithic precompiled headers, but they are marked experimental for C++. They are tracking the C++ modules proposal. See http://clang.llvm.org/docs/Modules.html http://clang.llvm.org/docs/Modules.html and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2073.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n207....
- detrino 12y ago> * non templated tuples instead of struct: for example, 2 struct types are the same if the data types they hold is the same. Not sure if it's possible for statically typed language. C++ has std::tuple, but most people (myself included) find nominal typing easier to understand. I Would only use std::tuple in situations where I needed to store a values of the types of a variadic argument pack. > * tighter STL container integration with the core language syntax C++ actually does pretty well here, it has operator overloading as well as std::initializer_list. > * some way to do modules Hopefully a good modules proposal makes it for C++17 > * some new thing to make compiling much faster, so to avoid relying on precompiled headers. go and rust are so much faster for this, C++ is not. I still wonder if there could be some gcc or clang extension for this, it would be really appreciated. C++ is awesone to work with, but language implementations suffers from those little details. Modules would help with compile speed. IMO, Go doesn't offer very many abstractions to the programmer that the compiler must eliminate so its easier to compile quickly. My 1 day experience with Rust was that it actually compiled quite slowly, do you have any personal experience with the language that you found it compiled quickly ?