DMD 2.000 alpha release
Reiner Pope
some at address.com
Tue Jun 19 06:09:09 PDT 2007
This looks great!
But as it is, I can't find a difference between invariant(char)[] and
invariant(char[]). For both of them:
invariant(char[]) a; // or for invariant(char)[] a
a = "foo"; // works
// a[0] = 'a'; // fails
a = a[1..$]; // works
And, unless I'm missing something, it seems like there's a problem with
aliases:
void main()
{
alias invariant(Foo) T;
T s = T(new int);
*s.a = 5;
}
struct Foo
{
int* a;
}
the above code compiles, although it wouldn't if I skipped the alias.
And thirdly, I'm not sure about invariant and const as storage classes.
They seem to be identical, saying "a compile-time constant", but also
applying transitively to their types. But if I have a compile-time
constant, how can it refer to data that can change?
It also feels odd to me, since we seem to have two storage classes to
effectively say the same thing: "known at compile-time, doesn't occupy
space." Am I right? Would this mean (except for not wanting to add yet
*more* keywords) that this is an orthogonal notion which could perhaps
warrant *yet* *another* term?
It's been lots of fun to play with, though. Thanks!
-- Reiner
More information about the Digitalmars-d-announce
mailing list