[cfe-dev] ObjCKVCRefExpr class name

Fariborz Jahanian fjahanian at apple.com
Tue Aug 18 12:04:20 PDT 2009


On Aug 17, 2009, at 11:41 PM, Daniel Dunbar wrote:

> On Mon, Aug 17, 2009 at 8:43 AM, Fariborz  
> Jahanian<fjahanian at apple.com> wrote:
>>
>> On Aug 17, 2009, at 5:52 AM, David Chisnall wrote:
>>
>>> On 17 Aug 2009, at 03:59, Chris Lattner wrote:
>>>
>>>> On Aug 16, 2009, at 4:40 PM, David Chisnall wrote:
>>>>
>>>>> 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


>
>
> - Daniel
>
>> - Fariborz
>>
>>>
>>> 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
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>




More information about the cfe-dev mailing list