Is std.variant.visit not @nogc?

Chris Katko ckatko at gmail.com
Mon Apr 9 07:07:58 UTC 2018


On Monday, 9 April 2018 at 07:02:50 UTC, Hasen Judy wrote:
> IMO, this is one more reason why sum-types should be built into 
> the language compiler, instead of being implemented in 
> user-space.

+1. Any time you have to "create" a fundamental feature in a 
language... from inside the language itself... you're going to 
have confusing error messages, and a huge uphill battle.

Look at Boost. While I salute the effort put into those 
libraries, trying to "fix C++"... "from inside C++" is a fools 
errand. The upgraded multidimensional array code looks like this:

  typedef boost::multi_array<double, 3> array_type;
   typedef array_type::index index;
   array_type A(boost::extents[3][4][2]);

as opposed to you know, in D:

  double [3][4][2] A;

And the D version has useful error messages, small compile times, 
and it's still easier to read, reason about, and debug.


More information about the Digitalmars-d-learn mailing list