plee for Properties, Private Fields

BlitzMax Forums/BlitzMax Programming/plee for Properties, Private Fields

General idea for properties

i.Speed = 50

If Speed is not a field of i Then
  If i has method SetSpeed Then
    i.SetSpeed( 50 )
  Else
    Throw exception
  EndIf
EndIf

Print i.Speed

If Speed is not a field of i Then
  If i has method GetSpeed Then
    Return i.GetSpeed
  Else
    Throw exception
  EndIf
EndIf


This is exactly how D does it. It's a very simple implementation of properties and works flawlessly. I don't see why it couldn't be added as syntactic sugar for BlitzMax.