goby-lang / goby

Goby - Yet another programming language written in Go
MIT License
3.49k stars 171 forks source link

Merge Object and BaseObject interfaces #124

Closed st0012 closed 7 years ago

st0012 commented 7 years ago

Currently we have two interfaces to represent objects in Goby. One is Object which represents any internal objects in the vm. The other one is BaseObject, which represents objects that can be accessed in Goby, like String, Integer.

And these two interface is sort of duplicated, their only difference is that BaseObject requires structs to have returnClass() method. This makes method and error can't be BaseObject, which means if we make these two structs have class then we can remove one of the interface. Besides, method and error do need to be accessible.

(Personally I prefer making Object require returnClass() and remove BaseObject interface.)

What do you think? @adlerhsieh @janczer

hachi8833 commented 7 years ago

Interesting. I'll be watching how fundamental class design is going to be.

st0012 commented 7 years ago

@hachi8833 I already opened a PR for this issue, see the reference above.