views:

143

answers:

1

hello, I wanna declare a record inside a class as follows:

class player (x, y)=
     object(self)
     type gun = {x:int; y:int; active:bool}
     val guns = Array.create 5 {x=0; y=0; active=false}
....

but the compiler claim that this line is syntax error : type gun = {x:in ....

when declared outside the class like this

type :  gun = {x:int; y:int; active:bool}
class player (x, y)=
     object(self)
     val guns = Array.create 5 {x=0; y=0; active=false}
....

the error is : unbound value gun.

so anyone know how to reach the same functionality with another way? thank you!

***** solved***

Bizare now it's working when the type is declared outside, thank you

+2  A: 

Why don't you define the type gun outside of the class definition?

starblue
when I declare it outside the class it sais : unbound value gun.
martani_net