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 )
         {
             @contract.in
             {
                 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
         }
     }

Reply via email to