Marvin3 supports object-oriented programming through the use of classes. Inheritance is not supported at the moment but it will surely be added in the later stages of the development.
To declare a class you use @ symbol.
@class-name
[constructing code] [me]
:method1-name [method2 code] ;
:method2-name [method2 code] ;
;
For example, consider the following 2D point class
@Point
!y !x me
:x %x ;
:y %y ;
:distance lhs .x %x - sqr lhs .y %y - sqr sqrt ;
;
To instantiate a Point
5 10 Point !point-a # create a point at(5,10)
42 4 Point !point-b # create a point at (42,4)
%point-a %point-b .distance println
Marvin3 classes have the following properties: