An alternative FFI/Parser proposal

stéphane ducasse ducasse at iam.unibe.ch
Mon Aug 21 10:24:18 UTC 2006


On 21 août 06, at 10:42, Bert Freudenberg wrote:

> stéphane ducasse schrieb:
>> On 21 août 06, at 01:55, Andreas Raab wrote:
>>> stéphane ducasse wrote:
>>>>> No. They they contain *names* of variables, not variables  
>>>>> themselves.
>>>> So this means that during the compilation of the method you map  
>>>> the name to iv?
>>>
>>> No. You can't map them during compilation since instance  
>>> variables are (as the name says) per-instance,
>> sure there are per instance but the offset in the underlying  
>> structure is the same.
>> so you are telling that you are not doing the same as in
>> class
>>     iv: x y w
>> foo
>>     ^ x
>> => ok we will access offset one of the specific recever?
>
> You misunderstand completely. Suppose there is an event handler  
> like this:
>
> 	showOptions
> 		<on: fire in: optionButton>
> 		optionDialog open
>
> then the compiler simply verifies that there indeed is a field  
> named "optionButton". It does not care whether that field is an  
> ivar (which are the exception in Tweak) or a regular property. But  
> it must be a field so the runtime system can register a secondary  
> event handler for when that field changes (fields automatically  
> generate change events when modified). The field will initially be  
> nil, but as soon as a non-nil object is assigned, that secondary  
> event handler registers the actual event handler (#showOptions)  
> with that object.

Ok I understand better. Before I could not get what andreas was  
saying with per instance...

> This is *exactly* what happens (see class CFieldDescription). You  
> can define fields that way if you want, but it would look horrible  
> in a browser's class definition.
>
> Only for file-in and file-out the field descriptions are converted  
> to a String, which happens to contain XML.

So this means that you cannot load code without having an XML parser.

> For display in the browser it is converted to attributed Text.
>
> Note that this is the same as for non-Tweak classes: instVar names  
> are stored as Symbol in an Array, but on file-in and file-out and  
> for browsing they are converted to a String.

Yes but Symbol are more core than XMLparser :)
>
> - Bert -
>
>
>




More information about the Squeak-dev mailing list