[fpc-devel] apple properties // Re: Help/Guidance please: Dwarf support for properties

Martin Frb lazarus at mfriebe.de
Thu May 2 22:01:35 CEST 2024


On 02/05/2024 20:59, Jonas Maebe via fpc-devel wrote:
>
>
>> ---------------
>>
>> I don't have background on the Apple properties.
>
> It's not Apple, but Objective-C.
>
>> property goes from the member to the property strikes me as odd. 
>> (first example of dwarf)
>> It indicates, that the property is only meant to be found when 
>> starting at the member?
>
> Objective-C also knows the concept of "computed properties", which are 
> not tied to a particular field. I don't immediately see how the 
> proposal deals/would deal with that.
Ok, I don't know how to read that, but potentially many fields could 
link to the same property.

Do those properties need a field at all?

>
>> Also the Apple spec uses strings (names) to refer to the getter/setter.
>> I don't know if there is a particular underlying need. It's more 
>> costly than a reference. Also It gets problematic if the getter is in 
>> an embedded record, or if there are overloaded functions, ....
>
> It doesn't use a symbol name, but a selector name. Objective-C method 
> dispatching mostly does not happen using a VMT, but by looking up a 
> (hash of a) selector in a table. "Calling a method" is called "sending 
> a message to" in Objective-C lingo; it's also how it can fairly 
> transparently support working with remote objects.

ok. Explains maybe half...

I am not immediately sure if dwarf has anything to describe dispatching. 
Or if this is just left for the debugger to know. Which is ok, with 
custom tags that are for Objective-C only.
I don't know if that table is precomputed / I.e. get completely created 
at compile time => in which case the location of the looked up hash 
would be known in the table, and the address of the method could be 
gotten via a dwarf expression?

The other part that I really don't understand is, why you find the 
property from the field, and not the other way round (above)?
Does that mean the code/user would not start with "object.my_property" 
but rather do "object.field as property"?

I am trying to understand if there is any common ground with properties 
in Pascal.

I've ask if they (dwarf makers) see potential for our properties 
https://lists.dwarfstd.org/pipermail/dwarf-discuss/2024-May/thread.html
So, I am trying to figure out were those Apple tags fit into it, and 
how/if I treat them in that discussion. (the Borland ones, have no docs 
to be found)

However from what I have seen so far, I do think there are fundamental 
differences.
Pascal properties should have
- the property as a declaration that is a start point (except for being 
owned by a class / but also exists without)
- links to other entities starting at the property (or no links, and 
duplication of accessor declarations)

Maybe there is still stuff that could be proposed as share-able?


More information about the fpc-devel mailing list