Why is there no or or and ?

F i L witte2008 at gmail.com
Fri Feb 17 08:25:41 PST 2012

Timon Gehr wrote:
> The contract syntax is wrong, because it conceptually has to 
> belong to the function declaration, not the function body.

I'm not so convinced. I just hate how in/out are shoved up 
against the name of the function. I was thinking about using '.' 
to reference the current function with each sequencial '.' 
meaning parentage. if that was the case, ".conctract in {}" would 
refer to the function, though I'm not sure how to resolve the 
naming conflicts of incoming parameters. Maybe '@' for attribute? 
I've the same dilemma for properties (aliases):

      Vector2: class
          x, y: float private

          X: alias
              @get: x
              @set: ( val:float )
                  case val != 0 { x = val }

          this( x, y:float, contract:int )
                  assert( contract != 0 )

              x = .x // set this.x to params.x
              ..x = .x // same as above
              y = ...y // sets this.y to super.y

              ret .. // returns this

More information about the Digitalmars-d mailing list