Generic const - a non-functional view

Jason House jason.james.house at gmail.com
Tue Jun 24 16:59:26 PDT 2008


Steven Schveighoffer wrote: 
> I would really like to hear people's opinions, especially Walter's.

What I like:
* Sticking to fundamental principles
* The const!(A,B)(T) syntax looks quite clean
* The ability for mixed const (AKA restricted mutability)

What I don't like:
* const!(~mutable)(T) syntax.  While a mutable keyword may be kind of nice,
the syntax is starting to get clunky and also become the only syntax
for "not const"
* No discussion of how to define const/invariant functions


A lot of times, when I think about tail const/mixed const/mutable/..., I
start thinking about arrays.
AKA:
  T[] vs. array!(T)
  const(T)[] vs. array!(const(T)) vs. const!(element)(array!(T))





More information about the Digitalmars-d mailing list