auto ref

bearophile bearophileHUGS at lycos.com
Fri Dec 18 16:23:43 PST 2009


Bill Baxter:
> I don't know
> what the proper generalization is, but I think if you try to keep
> templates the way they are while generalizing them to handle these
> cases you will end up with an unworkable notation nightmare.

It's not easy to design such large changes up-front (Andrei has for example done it with Ranges, but only few people have enough brain to do that and produce a final result that's useful in practice), so I think the design strategy used here is: try to generalize templates to address those cases, produce a too much high castle of cards that you can see is unstable, then try to fix the mess redesigning using a more clean design. The key here is to keep the D3 design process flexible enough, so you can fix design mistakes along the way ;-) It's an iterative process of generalization & abstraction.


> In WalterAndrei.pdf from the D conference there was talk of static
> parameters and of unifying regular functions and templates.

I think Walter has abandoned that idea, for never specified implementation difficulties. I'd like to know more about those difficulties (but I agree that if an implementation is too much hard to do compared to the gains it gives, then it's better to abandon it).


> But I think
> it's worth thinking about whether there may be a significantly better
> way to specify parametrized types and constraints on them than what
> C++ and D use.

Of course. But you may need to implement a more powerful type system to do that.

Bye,
bearophile



More information about the Digitalmars-d mailing list