D
Daniel O'Connell [C# MVP]
Jon Skeet said:But those qualities *are* just the syntactic qualities - they're just
easier syntax for calling the methods. In what way *isn't* that
syntactic sugar, albeit very "good" sugar? As you say later on, there's
extra CLR support for properties, but I would say that at least
*nearly* all the stuff that makes them appear field-like is just
syntactic sugar.
I'll agree, with the caveat that a property is there strictly to provide
field like access, which I consider a bit ironic. A property is a set of
methods that exist so that languages can treat them like fields
syntactically
Agreed
And I'd be happy with that - it's when people claim that a property is
more "field-like" than "pair-of-methods-like" that I have problems,
because it's *only* the syntax which is field-like, not the semantics.
In the language, which is what the original post was about at that, syntax
tends to matter a bit more than semantics. In programming the semantics
matter more.
Sure.
That's fine - the fact that they're compiled to methods is all that I
would particularly urge people to know. The fact that they have
semantics which are very close to methods is important - the rest is
only important to a few people who are either doing low-level stuff or
are just incorrigibly nosy, like ourselves.
Being nosy has its perks,
Yes, there definitely more to it than *just* syntactic sugar -
apologies for the previous over-generalisation. The bits that make them
look like fields are just syntactic sugar though, IMO
Yes, that I'll agree on.