Re: [phix] Ambiguity of 'object'

new topic     » goto parent     » topic index » view thread      » older message » newer message
petelomax said...

Technically a class (instance) is a special kind of sequence, but that's an implementation detail and if you perform any of the normal sequence operations on it (append, slice, etc) you'll hose it.
Sequences and classes can contain other objects, but with different access methods (integer subscript vs. dot notation and string subscripts), different semantics (copy on write vs reference), and integer standing in as a routine-id in classes.
A struct implies a simpler "class without methods" with fields public by default, but in reality it is just a pure alias (of class) and any such implied differences are not enforced, apart from the easily changed public vs private default.
User defined types simply attach a clarifying name along with (optionally nested) run-time validation and verification code to the builtin types, without otherwise fundamentally changing them.
Note that a class implicitly defines a perfectly sufficient user defined type of the same name, but there is no deliberate bar on further nested layers of type wrappers, which is what "class extends" effectively does.

Thanks indeed, Pete, for your insightful comments. They are very interesting and informative for anyone who wants to understand the semantics and the concepts of the language beyond the facade of syntax . Please keep sharing them!

new topic     » goto parent     » topic index » view thread      » older message » newer message


Quick Links

User menu

Not signed in.

Misc Menu