Page 1 of 1

properties in mixins

PostPosted: Sun Nov 11, 2012 4:24 am
by kobi7
the following code doesn't compile due to "error: Cannot use the from form of a property inside an interface declaration."
refering to the getter.

Are properties prohibited in mixins, or is this a mistake?

Code: Select all
mixin ManageAttitude

   var _attitude as decimal
   get attitude from _attitude

   def happierBy(n as decimal)
      require
         n >= 0.0 and n<=1.0
      body
         _attitude = Math.min(1.0, .attitude + n) # atmost

   def sadderBy(n as decimal)
      require
         n >= 0.0 and n<=1.0
      body
         _attitude = Math.max(0.0, .attitude - n) # atleast


Thanks, kobi

Re: properties in mixins

PostPosted: Sun Nov 11, 2012 1:28 pm
by Charles
Properties are definitely allowed. This is a code gen bug. Until it's fixed, the workaround is to write the code for the property like so:
mixin ManageAttitude

var _attitude as decimal
get attitude as decimal
return _attitude

Re: properties in mixins

PostPosted: Sun Nov 11, 2012 11:37 pm
by Charles
This is fixed now.

Re: properties in mixins

PostPosted: Tue Nov 13, 2012 3:40 am
by kobi7
wow, thanks for the prompt replies and fixes.
I feel like a valued customer ;-)

support is much appreciated, and often underrated.

Re: properties in mixins

PostPosted: Wed Nov 14, 2012 3:00 am
by Charles
You're welcome.