Another day in the ordeal of cartesianProduct
peter.alexander.au at gmail.com
Sat Oct 27 05:23:27 PDT 2012
On Saturday, 27 October 2012 at 11:41:07 UTC, bearophile wrote:
> Peter Alexander:
>> void foo(ForwardRange Range)(Range r)
>> And *immediately* get a type error without having to
>> instantiate it with a variety of different range types.
> It's not an easy problem. To solve it the Rust language uses
> typeclasses adapted from Haskell. But unlike the usual Haskell
> compilers Rust doesn't use global type inferencing and it keeps
> the C++-style monomorphization, so at run-time its generic
> programming is as efficient as C++ generic programming.
Yeah, it's certainly not going to be easy. It's unfortunate that
D adopted the whole C++ style "glorified macros" approach to
templates -- it makes it very difficult to reason about (or
automate reasoning about) the semantics of your code.
Retrofitting some sort of structure to templates will be a
Herculean task, but I think it has to happen. It is clear to me
that the development process we use now (write the template, try
a few instantiations, pray) is unsustainable beyond simple
More information about the Digitalmars-d