On 10/07/2012 11:44 AM, Henning Pohl wrote:
Imagine you want an image to keep the width of 512:

void func(Image img) {
assert(img.width == 512);

img.doSomething();
assert(img.width == 512);

while (img.somethingElse()) {
assert(img.width == 512)

someFunc(img);
assert(img.width == 512);
}
}

In theory, every call to a function can change the width of the image.
What do you think about this:
https://dl.dropbox.com/u/34762907/temp/prop1.html

I do know it can be implemented in D4 only.

Sounds good. You haven't mentioned the invariant keyword, so perhaps you are not aware of that feature?

  http://dlang.org/class.html#Invariant

  http://dlang.org/dbc.html

Although the docs seem to favor classes, invariant is available for structs as well.

Ali

--
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html

Reply via email to