ObjCKVCRefExpr class name

Hi,

I'm wondering what the rationale behind the name of the ObjCKVCRefExpr class is. It is quite confusing to have a class with KVC in its name which has absolutely nothing to do with KVC...

David

I agree. Should it be ObjCPropertyRefExpr?

-Chris

We already have an ObjCPropertyRefExpr. The difference appears to be that ObjCPropertyRefExpr is generated when the property is declared as a property and ObjCKVCRefExpr is generated when the property is declared as a method. Maybe ObjCImplicitPropertyRefExpr?

I'm not fully sure why these are different, since they generate the same code. It might be nice if we only got the unused expression result from a property ref expression that invoked a declared property and not for using dot notation to invoke other methods (since other methods invoked in this way may alter the state), although it's still very bad style to use the dot notation in this way (or at all, depending on who you ask).

David

I chose it because the whole concept of property was to provide a syntactic sugar for Key-Value Coding
style. During early days of property discussions, people (at Apple) consistently were referring to KVC. Somehow,
they think properties have something to do with KVC.

- Fariborz

Hi,

I'm wondering what the rationale behind the name of the
ObjCKVCRefExpr
class is. It is quite confusing to have a class with KVC in its name
which has absolutely nothing to do with KVC...

I agree. Should it be ObjCPropertyRefExpr?

We already have an ObjCPropertyRefExpr. The difference appears to be
that ObjCPropertyRefExpr is generated when the property is declared as
a property and ObjCKVCRefExpr is generated when the property is
declared as a method. Maybe ObjCImplicitPropertyRefExpr?

I'm not fully sure why these are different, since they generate the
same code. It might be nice if we only got the unused expression

Other clients may want to distinguish the two. ObjCKVCRefExpr always
has (presumed to have) side-effect while ObjCPropertyRefExpr generally
does not if fully synthesize by the compiler.

- Fariborz

Hi,

I'm wondering what the rationale behind the name of the
ObjCKVCRefExpr
class is. It is quite confusing to have a class with KVC in its
name
which has absolutely nothing to do with KVC...

I agree. Should it be ObjCPropertyRefExpr?

We already have an ObjCPropertyRefExpr. The difference appears to be
that ObjCPropertyRefExpr is generated when the property is declared as
a property and ObjCKVCRefExpr is generated when the property is
declared as a method. Maybe ObjCImplicitPropertyRefExpr?

I'm not fully sure why these are different, since they generate the
same code. It might be nice if we only got the unused expression

Other clients may want to distinguish the two. ObjCKVCRefExpr always
has (presumed to have) side-effect while ObjCPropertyRefExpr generally
does not if fully synthesize by the compiler.

I agree with David, I don't see a convincing reason these should be
separate AST nodes. The API should just make it clear that the
contained expression is either a method or a property, and clients can
query this on the ObjCPropertyRefExpr node.

I believe, however, that that was how it used to be, so maybe
something else motivated this change?

- Daniel

Hi,

I'm wondering what the rationale behind the name of the
ObjCKVCRefExpr
class is. It is quite confusing to have a class with KVC in its
name
which has absolutely nothing to do with KVC...

I agree. Should it be ObjCPropertyRefExpr?

We already have an ObjCPropertyRefExpr. The difference appears to be
that ObjCPropertyRefExpr is generated when the property is declared as
a property and ObjCKVCRefExpr is generated when the property is
declared as a method. Maybe ObjCImplicitPropertyRefExpr?

I'm not fully sure why these are different, since they generate the
same code. It might be nice if we only got the unused expression

Other clients may want to distinguish the two. ObjCKVCRefExpr always
has (presumed to have) side-effect while ObjCPropertyRefExpr generally
does not if fully synthesize by the compiler.

I agree with David, I don't see a convincing reason these should be
separate AST nodes. The API should just make it clear that the
contained expression is either a method or a property, and clients can
query this on the ObjCPropertyRefExpr node.

These two ASTs are orthogonal to one another. Let me say that ObjCKVCRefExpr ( or
whatever you like to call it) has nothing to do with properties. It represents the syntactic
sugar for calling couple of user methods. In fact, you can implement ObjCKVCRefExpr without
having, or even knowing, about properties. If you look at the nodes, they share, almost, no
information between them. ObjCKVCRefExpr requires at least one more data member than
ObjCPropertyRefExpr. Using one node for both, bloats ObjCPropertyRefExpr which is heavily used,
unlike ObjCKVCRefExpr.

I believe, however, that that was how it used to be, so maybe
something else motivated this change?

I implemented ObjCKVCRefExpr after I realized feature is missing; no motivational change here :).

- fariborz