> Yes, if the dot notation had been properly considered then it would have > enforced these additional requirements: > > - Accessor methods supplied for properties must not have side effects > - Accessor methods supplied for properties must always return the value > provided for the last set operation. > - Only methods declared with @property may be called with the dot notation > > If they had made these requirements, then the dot notation would have added > something of value to the language. At present, it is semantically > equivalent to a message send and may be used interchangeably with a message > send. Since it is semantically equivalent, it does not provide any more > information to the reader or to the compiler, it just does something that > looks like a field access (which is one of the fastest operations in C) and > actually makes it into a message send or two (which are an order of magnitude > slower), making it hard to reason about the behaviour of the code.
As far as I remember the dot notation was introduced to make Obj-C more attractive to Java and C++ programmers (especially for the iPhone). So this is not a "missing" feature that was finally implemented by Obj-C 2.0. Obj-C 1.0 was already complete and well designed enough to solve all computing problems since 15 years. Therefore, most long-time Obj-C programmers don't like the new features of Obj-C 2.0 (because many of them don't add value) and the newcomers love them because they look familiar (but are not on a closer look). Sometimes it is argued that the dot notation makes writing code faster and makes it easier to read. I recently back-ported some sample code which was a horrible mixture of dot notation and message sending. Nevertheless it took me just 20 minutes to replace them all and even replace the @property and @synthesize by old-fashioned getter/setter code. So the saving of programmer's time is probably not that much. Obj-C 1.0 did assume a write once read many time (and even years later) policy. So spending time when writing doesn't count too much. The most interesting and powerful addition of Obj-C 2.0 are IMHO blocks. Although there is also something to criticise that the ^ syntax also appears to be suboptimal. But we won't change this - unless we work on Obj-C 3.0 and can deprecate all this in 4.0. Just my 2ct to this topic, Nikolaus _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep
