That's reassuring to know, thanks :)
> However, there is a big and surprisingly important difference between a class and a function that returns a record: with a class you get open recursion between members of the class.
Record members are certainly bound too early to get open recursion, which is why I claimed that classes == functions rather than objects == records ;)
In my example of Python, "objects" are abstract: created implicitly, passed into the constructor, then (implicitly) returned.
> You don't get that with a function that assigns members to a record type - or, at least, if you do build the machinery you need to get that, you have essentially reinvented classes with a worse syntax.
I think there are a few distinctions to be made here:
- Records vs. objects; which I've addressed above.
- Syntax vs. semantics: I'm fine with special-purpose syntax, I just don't like arbitrary semantic distinctions. It sounds like Ceylon is better than most in this regard :)
- Built-in vs. library code: reinventing classes using functions is only a bad idea if they're already built into the language in some other way. If there's no built-in alternative, then doing this in a library is legitimate. Likewise, using the language's existing support for functions to build-in a class implementation is also legitimate, and it sounds like that's what Ceylon's done :)