- Methods are slightly special subs in a namespace
- Declare them with the
method
keyword (not essential, just nice)
- Access invocant via
self
keyword
- Access attributes via class offset
.namespace [ 'Alien::Grunt' ]
# declared as class initializer
.sub _new method
.param pmc args
.local pmc name
.local pmc rank
.local pmc serial
name = args[ 'name' ]
rank = args[ 'rank' ]
serial = args[ 'serial_number' ]
.local int offset
classoffset offset, self, 'Alien::Grunt'
setattribute self, offset, name
inc offset
setattribute self, offset, rank
inc offset
setattribute self, offset, serial_number
inc offset
.end