On 19 Apr 2016 at 13:34, Klemens Morgenstern wrote:
Because it absolutley requires metaprogramming and it is the only elegant choice. On Windows you have a function overblown with parameters, making it unreadable. On Posix you have to call several functions to get a process up. And my design has a variadic function, which allows you to pass only the arguments you need.
A freeform constructor with tagged parameters is absolutely right for when the parameters can be extended by third party code. Here though parameter types are completely known, so the appropriate design for when there are too many parameters and/or you'd like to name them is to pass a tagged tuple aka a struct. The choice to use metaprogramming should always confer an absolute design win over all other design alternatives given the increased compile times, memory usage, brittleness and other factors. Metaprogramming is very much not free of cost. It should be used as sparingly as possible in publicly facing library APIs. In particular I find Process' use of a freeform constructor gratuitous given the much simpler close substitutes like passing a struct.
So would you just design the library like the python equivalent?
How would you view this library? http://templated-thoughts.blogspot.de/2016/03/sub-processing-with-modern-c.h...
Very favourably indeed. I will say I don't think much of his internal implementation unfortunately, a lot of problems. But the public API design is the right direction, very intuitive and straightforward to use. No messing around. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/