Another title for the talk would be : How to know if a language is simple enough? I would like to see more things like those we will have in C++20 to make possible to implement simple things simpler. Glad to see that sometimes sound simple features accidentally solve problems that these features where not designed for. Excellent talk.
@@davidledger5941 Yeah, exactly something like that. I would go even beyond, allowing multiple operators to be default in on go, such as: auto operator+-*/(const auto& t) const = default; // Motherships addition, subtraction, multiply and division operators in one go Essentially, the operators generated would do the member-wise operations internally. For primitive type-wrappers this would be ideal - for wrapped user types one would need to cascade the same behavior for the entire depth of the tree.
@@nnevatie Yes, why not allow concatenation of operators like that, boolean too ||, &&. We need to submit proposals before December 21st, 2018... That could be much effort... Automatic operator generation needs to be a thing. Even if it was just allowing = default on all operators separately...
I don't think automatic generation of / operator will be handy in wide hanful of cases. What does autogeneration do? divide each member ? suppose you writing your own complex number, it just bring invalid logic. I don't think perfect general algorithm for such operation could be privided.
I think Metaclasses solves your problem partially: you could write TrivialArithmetic metaclass, where you define * operator as "multiply each member in scalar-mult behavior", then just use that metaclass.
Another title for the talk would be : How to know if a language is simple enough?
I would like to see more things like those we will have in C++20 to make possible to implement simple things simpler.
Glad to see that sometimes sound simple features accidentally solve problems that these features where not designed for.
Excellent talk.
Spaceship operator is nice, but I think we'll need a Mothership operator, that also generates all the member-wise arithmetic operators...
Hmm
auto & operator + - (...) ??
auto & operator * / (...) ??
@@davidledger5941 Yeah, exactly something like that. I would go even beyond, allowing multiple operators to be default in on go, such as:
auto operator+-*/(const auto& t) const = default; // Motherships addition, subtraction, multiply and division operators in one go
Essentially, the operators generated would do the member-wise operations internally. For primitive type-wrappers this would be ideal - for wrapped user types one would need to cascade the same behavior for the entire depth of the tree.
@@nnevatie
Yes, why not allow concatenation of operators like that, boolean too ||, &&. We need to submit proposals before December 21st, 2018...
That could be much effort...
Automatic operator generation needs to be a thing. Even if it was just allowing = default on all operators separately...
I don't think automatic generation of / operator will be handy in wide hanful of cases. What does autogeneration do? divide each member ? suppose you writing your own complex number, it just bring invalid logic. I don't think perfect general algorithm for such operation could be privided.
I think Metaclasses solves your problem partially: you could write TrivialArithmetic metaclass, where you define * operator as "multiply each member in scalar-mult behavior", then just use that metaclass.
const(bool), volatile(bool), static(bool), constexpr(bool) too please:) maybe not all of them...
pure gold
Coming up with minimal, consistent and unsurprising semantics for operators is hard, even for Mathematicians.