News for hackers. Stuff that matters.
Re:Survey results: ISO C++ feature proposals by ebg13 on Friday July 26, 2019 @09:56AM (#20534815)
What monsters put compile-time programming over concurrency and pattern matching?
Re:Survey results: ISO C++ feature proposals by jandrewrogers on Friday July 26, 2019 @11:25AM (#20535477)
It actually makes sense to me.

Compile-time programming is a very powerful feature of C++ that does not have an equivalent in other systems languages. It is commonly used to effect several types of compile-time verification of code design and safety that would be difficult to do any other way, in addition to its more obvious use case for effecting relatively complex performance optimization algorithmically. The ability to algorithmically generate almost arbitrarily complex types during compilation that are fit to purpose is an extremely useful feature for fast, high-reliability code and used pervasively in modern C++ as the facility has become more expressive. Filling some of the last remaining holes in its expressiveness would be high-value novel capability. Think of it as a hardcore safety feature.

You can put me in the camp that adding more support for concurrency in the language beyond a feature like coroutines (in C++20) and the existing primitives is not that useful. It would have the same issue as STL containers, where there simply isn't enough control of the implementation details for them to be used for many applications C++ is used for, so most concurrency infrastructure will be purpose-built anyway.

Pattern matching functionality can already be effected in many cases, albeit quite ugly. This would be more syntactic sugar than new capability, so I can understand why it isn't prioritized as much.

Re:Survey results: ISO C++ feature proposals by pjmlp on Friday July 26, 2019 @11:37AM (#20535561)
Have you ever used Common Lisp macros, D meta-programming, Nim, Dylan macros, BETA pattern matching, OCaml pptx templates, Template Haskell,...?

Yes, C++ compile time capabilities are powerful, but they aren't by all means the only game in town.

Re:Survey results: ISO C++ feature proposals by pkolaczk on Friday July 26, 2019 @05:00PM (#20538286)
Also Java (annotation processors) and Scala (macros with full access to type system). Java is considered good enough systems language for some definition of a system - there are successful high performance database engines, web servers, web frameworks, compilers, distributed computing engines written in Java.
Re:Survey results: ISO C++ feature proposals by jandrewrogers on Friday July 26, 2019 @12:03PM (#20535791)
Almost none of those are systems programming languages, which was the domain of comparison.
Re:Survey results: ISO C++ feature proposals by nestorD on Friday July 26, 2019 @01:21PM (#20536421)
Rust with its macro system and explicit target of system programming seem like a perfect fit.
Re:Survey results: ISO C++ feature proposals by banachtarski on Friday July 26, 2019 @02:40PM (#20537246)
Rust is beyond even current C++ with respect to compile time code.
Re:Survey results: ISO C++ feature proposals by comex on Friday July 26, 2019 @04:10PM (#20537971)
Sort of. Rust procedural macros are powerful, but they’re basically glorified code generation: they take a list of tokens as input and return a list of tokens as output. They don’t have access to type information. For that you need to use a combination of the trait system and `const fn`, to which the C++ equivalent is templates and `constexpr`. But C++ `constexpr` is currently way ahead of Rust `const fn` in functionality. And while Rust’s trait system tends to be nicer than C++’s templates for most purposes, it’s not as good at performing arbitrary computations. Overall, when I use either language I find myself badly missing features from the other. I look forward to seeing both close the gap…
Re:Survey results: ISO C++ feature proposals by pjmlp on Friday July 26, 2019 @12:58PM (#20536247)
Common Lisp (Lisp Machines), D, Nim, OCaml (MirageOS Unikernel, Docker macOS TCP/IP stack), Haskell (House OS and Galois bare metal deployments).
Re:Survey results: ISO C++ feature proposals by slaymaker1907 on Friday July 26, 2019 @01:52PM (#20536753)
Systems programming language is only a useful term if you define what systems you are talking about. Are you talking about creating an OS, highly performance micro services, distributed systems, etc.? Common Lisp would likely be a poor choice for an OS but would be great for some of those other types of systems.
Re:Survey results: ISO C++ feature proposals by jandrewrogers on Friday July 26, 2019 @03:27PM (#20537644)
I would say that the common feature of a systems language is that it is explicitly designed to enable direct control of hardware resources and -- very importantly -- operation scheduling by the programmer. A point I think is often overlooked is that some software architectures cannot be implemented correctly without this level of control, and for some applications those architectures are the only competent choice. Using a systems language should be driven by the requirements of application with respect to software architecture, and most applications don't have that requirement.

Some applications that are above the OS and device drivers, such as database engines, are clearly in the domain of systems applications because it is not possible to create a competent implementation without the control a systems language provides. Even for relatively abstract high-level software like distributed systems, strict control of scheduling is required for consistently robust throughput and behavior. Some key algorithms only work in real systems if resource management and concurrent operation sequencing is inexpensively deterministic. For some other applications, the only real benefit of a systems language would be for performance engineering purposes, which may not be a practical priority.

The "managed language" litmus test is quite good in my opinion, and almost definitional.

Re:Survey results: ISO C++ feature proposals by majidazimi on Friday July 26, 2019 @10:32AM (#20535069)
It means concurrency and pattern matching is not really critical for the community as it is for other language communities. There is no insult, but generally speaking an average C++ developer has deeper knowledge than an average Java developer which essentially means C++ developer is somewhat comfortable with traditional concurrency toolkit like threads.
Re:Survey results: ISO C++ feature proposals by asveikau on Friday July 26, 2019 @11:15AM (#20535404)
> C++ developer is somewhat comfortable with traditional concurrency toolkit like threads.

As somebody who has used threads a lot and written code in kernel mode etc. something about this scratches me the wrong way.

The traditional concurrency toolkit has some issues. Being experienced with them can make you somewhat jaded against them. In particular, the standard way to solve problems in that mode of thinking is to introduce locks, and experienced people know all the problems that locks have, and that the "solution" is harmful in the extreme.

So it is acceptable for such a programmer to want more options, standardized. I would even argue that this is more important than introducing std::mutex, std::thread, or std::atomic, because you can say that in the pre-C++11 era nonportable interfaces like pthreads or win32 were already working OK for people that chose to use them.

Re:Survey results: ISO C++ feature proposals by jcelerier on Friday July 26, 2019 @03:50PM (#20537820)
> In particular, the standard way to solve problems in that mode of thinking is to introduce locks

nowadays I mostly see lock-free queues and message passing across threads, it's trivial to do with a few nice libraries

Re:Survey results: ISO C++ feature proposals by banachtarski on Friday July 26, 2019 @11:06AM (#20535324)
Why would we want concurrency if we already have thread support and coroutines. Concurrency is a nice-to-have abstraction that is not without overhead and design tradeoffs.
Re:Survey results: ISO C++ feature proposals by paulirwin on Friday July 26, 2019 @03:50PM (#20537818)
It also might be a result of the pattern matching proposal having only been introduced this year, and concurrency/coroutines having been a focus in C++20 already. Whereas compile-time programming has been discussed for a while now and is getting more well-baked, but still hasn't made it fully into the language yet and many (myself included) are eager to use it. See the revision history of P0707 for example.
Re:Survey results: ISO C++ feature proposals by steveklabnik on Friday July 26, 2019 @11:30AM (#20535511)
Another interesting thing about this survey is that the categories don't have equal representation; so for example, "pattern matching" has two papers, one of which is extremely popular, but "compile time programming" has thirteen papers, with a few of them being significantly more popular than the others (one has only one vote, for example, but another is, in my mind, one of the most exciting proposals coming down the line for C++).

There's tons of reasons why this could be this way; and it shows why creating these kinds of things is just hard.

Re:Survey results: ISO C++ feature proposals by lgeorget on Friday July 26, 2019 @10:07AM (#20534896)
But what if you can do pattern-matching at compile-time?!
Re:Survey results: ISO C++ feature proposals by steveklabnik on Friday July 26, 2019 @11:39AM (#20535585)
'inspect constexpr' is part of the pattern matching paper, IIRC.
Re:Survey results: ISO C++ feature proposals by ludamad on Friday July 26, 2019 @11:09AM (#20535347)
I feel like Herb Sutter has always written favourably about compile time tricks, and it's reflected in his audience
Re:Survey results: ISO C++ feature proposals by alexhutcheson on Friday July 26, 2019 @11:09AM (#20535344)
Library authors and maintainers.
Re:Survey results: ISO C++ feature proposals by stefan_ on Friday July 26, 2019 @10:51AM (#20535212)
The C++ committee has been captured by a hostile force that tries to turn every C++ compiler into the slowest imaginable C++ abstract machine emulator.