Hi,
I just have started diving in D. Exploring the contract feature I
stumbled upon the fact that a class invariant does not apply to properties:
import std.stdio;
void main(string[] args) {
Time t = new Time();
t.hours = 24; // works; why?
writeln("t.hours is ", t.hours);
t.add(1
On 16.02.2011 11:03, Michael Engelhardt wrote:
Hi,
I just have started diving in D. Exploring the contract feature I
stumbled upon the fact that a class invariant does not apply to properties:
Welcome on board :)
Invariant gets called on every public method call (at begin & end if I'm
not mista
Dmitry Olshansky Wrote:
> Now to properties, this is actually shouldn't be allowed:
>
> @property int hours;
>
> @property is a annotation applied to functions (getter/setter), to allow
> calling it with omitted () and a natural assign syntax like this:
Why shouldn't it be allowed? While it
On 16.02.2011 20:47, Jesse Phillips wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natural assign syntax like this:
Why
On Wednesday, February 16, 2011 09:47:32 Jesse Phillips wrote:
> Dmitry Olshansky Wrote:
> > Now to properties, this is actually shouldn't be allowed:
> > @property int hours;
> >
> > @property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natur
On Wed, 16 Feb 2011 12:47:32 -0500, Jesse Phillips
wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to
allow calling it with omitted () and a natural assign syn
Jonathan M Davis Wrote:
> Except that @property is for _functions_. You mark a function with @property
> so
> that it _acts_ like a variable. @property on a variable is _meaningless_. It
> would be like marking a variable nothrow. It makes no sense. Neither should
> be
> legal. The fact that
On Thursday, February 17, 2011 10:39:20 Jesse Phillips wrote:
> Jonathan M Davis Wrote:
> > Except that @property is for _functions_. You mark a function with
> > @property so that it _acts_ like a variable. @property on a variable is
> > _meaningless_. It would be like marking a variable nothrow.