4 ms·
that's the issue: there is no other way to create new types aside from creating a new class in mainstream languages. Those two concepts are separate, and should
by dgan 4y ago
that's the issue: there is no other way to create new types aside from creating a new class in mainstream languages. Those two concepts are separate, and should be treated as such. Types are not Classes, the last is just a lousy "embodiment" of the first
- pipeline_peak 4y agoClasses are composite data types, what you are referring to are primitive data types. A class isn’t necessarily some wrapper around primitive types, they can contain data structures, other type instances, etc. Obviously that eventually leads to an end object containing a primitive, you can’t just have fancy trees of nothingness lol. https://en.wikipedia.org/wiki/Data_type#Classification_of_data_types https://en.wikipedia.org/wiki/Data_type#Classification_of_da...
- kaashif 4y ago> Obviously that eventually leads to an end object containing a primitive, you can’t just have fancy trees of nothingness lol. You absolutely can have types with only one value, e.g. a class with no members. Then you can have a tree type composed of those nothing types, where the information is in the tree structure, not in any primitive value stored anywhere.
- dgan 4y agoAgain, I was referring to user defined types (not primitive types), which are not classes.
- pipeline_peak 4y ago> A class specified by the keyword class, is a user defined type that contains both data members and member functions... http://www.cs.fsu.edu/~cop3014p/lectures/ch8/index.html http://www.cs.fsu.edu/~cop3014p/lectures/ch8/index.html
- dgan 4y ago? Okey? module Example type mytype val id: mytype -> mytype end = struct type mytype = { position:(int * int) } type othertype = int let id self = self end ``` How many classes I have defined? Exactly zero. How many types I have defined? Definetely not zero. One of these types is secretly equivalent to a primitive type, while the other is not, and none of this is known to users of these types. I am not sure why keep trying to show "class = type". It is wrong, those are different concepts. I don't care what c++ says