equivariant functions

ore-sama spam at here.lot
Thu Oct 16 00:22:00 PDT 2008


Andrei Alexandrescu Wrote:

> One issue  have with const? is that it binds the behavior to const, 
> thereby eliminating the chance of making things more general. Also the 
> const? will have to do something NOT suggested by the notation, namely 
> pass the invariant, if present, along.
> 
invariant is just a flavor of const and we're not restricted to regexp notation.

> What I'm saying is that we're really trying to beat the compiler in the 
> head until it understands that:
> 
> S stripl(S s) if (is(S : const(char)[]) { stmts }
>
try to template this
const?(X) fun(const?(Y) y);

One big difference between normal and templated functions is you can provide only signature for normal function.
Is it safe to typecheck/instantiate templated function without body?



More information about the Digitalmars-d mailing list