keean / zenscript

A trait based language that compiles to JavaScript
MIT License
42 stars 7 forks source link

Objects or No Objects #9

Closed keean closed 7 years ago

keean commented 7 years ago

Discussion about records vs objects

shelby3 commented 7 years ago

Please define the terms 'record' and 'object' and why they are not the same?

Our misunderstandings arise when we have different perspectives on meanings and default semantics.

shelby3 commented 7 years ago

Link to potentially relevant discussion?

keean commented 7 years ago

If you read the OOHaskell paper you will find that an object is the fixed point of a record. However I in general prefer to separate data and functions.

A record is like a namespace, and a value of a record type is a particular implementation or value. In basic terms a record is like a C struct.

shelby3 commented 7 years ago

@keean wrote:

If you read the OOHaskell paper you will find that an object is the fixed point of a record.

Are you referring to page 15, where setting the tail to the Unit type?

Again this seems to be a conclusion that is specific to Haskell's type system and how you are representing inheritance? And what does inheritance have to do with objects?

keean commented 7 years ago

I think we are agreed to have simple objects. No inheritance just interfaces/type classes. Closing as decided.

shelby3 commented 7 years ago

You mean no virtual inheritance and no subclassing. But what about typeclass objects? And what about unions being subtypes? I don't think we can nail down those yet?

keean commented 7 years ago

I think the conclusion here is we are having objects, which will be at least simple objects. The other things are the subject of other threads, but to cover my thoughts, I don't think we need typeclass objects because we have union types. By no inheritance I mean you cannot extend object A. You can extend a typeclass but that is something different. We have interface inheritance, but not implementation inheritance.

shelby3 commented 7 years ago

@shelby wrote:

I don't think we need typeclass objects because we have union types.

Disagree.