Compilation using property syntax requires the type of the receiver to be known at compile time. I may not understand something, but this seems like a broken or incomplete c
Compiling property access requires knowing how to translate the property name into the correct getter/setter name. Without knowing the type of the receiver, the compiler cannot possibly know what the getter/setter is called, as the property may have overridden the name as part of its declaration, like so:
@property (nonatomic, retain, getter=myComment) NSString *comment;
If the compiler were to go ahead and generate code for your untyped example, it would generate [document comment]
, which will fail at runtime as the correct generated code is actually [document myComment]
.
Kevin nailed one of the symptoms.
When designing properties, the very specific decision was made not to support id
as the target of dot syntax. Beyond the ambiguities that Kevin points out, the desire to avoid all ambiguities related to (id) receivers was considered desirable.
In general, the use of fully unqualified id
is both undesirable and actively discouraged. In creating new features in the language, not supporting id
discourages the proliferation fragile coding patterns across the new feature(s).