On 2006-12-13, at 22:17 EST, Jim Grandy wrote:

I'm curious about the idiom of declaring a field by saying

setters.foo = 'onFoo';

I hope it would be:

setters.foo = 'setFoo';
This appears in many places in the LFC, and typically there is no corresponding getter, cf

setters.clip =  -1;

Setting the setter to -1 is additional Adam magic. I don't recall off the top of my head what it means...

in LaszloView.lzs.

It's pretty straightforward to model this in the refguide -- look for an ASTPropertyIdentifierReference of the right form inside a class declaration and output a field tag to suit -- but I want to make sure I get the semantics right.

Is it right that this is a write-only field?

No. We don't have getters any more. There may be vestigial getter support, but we don't use it. As I said to Ben a while back, we used to pull values through getters, but now we push them through setters. Reading being about 4-5x more prevalent, it is more efficient this way.

We don't really have a way of making a read-only slot. We would if we adopted the JS 2 getter/setter declarations, but this would be a big language change as JS 2 does not allow you to have a slot and a getter or setter with the same name. This is an area of our language that needs clean-up.

In the case of @clip, there's no getClip() and no getters.clip = 'getClip', so I assume so. But the 3.x refguide doesn't say this; it says:

name: clip
Usage: Tag only
Type (tag): boolean
Type (JS): Boolean
Default: false
Category: final

Does the tag compiler special case this sort of thing? If there is no accessor in JS, how should we best handle this in the new refguide?

Remember, some of the documentation for built-in LXC classes used to come from the schema.

Is the existence of just a setter sufficient to suggest that this is a Tag only field?

I think that information was all expressed in the schema.

I'm also confused that there is a setter declared in LaszloView.lzs, but the attribute is documented as "final". Those sound contradictory -- if it is final, why is there a setter? Or maybe I have too strict a definition of 'final' -- I thought it meant the value was set upon exit from the construct method.

Essentially. What this is saying is that clip is an attribute that you can only set on initialization.

Reply via email to