fontParts icon indicating copy to clipboard operation
fontParts copied to clipboard

Document how we handle dynamic properties

Open benkiel opened this issue 1 year ago • 6 comments

We have _get/set_base_something and _get/set_something for a reason (below). That reasoning should be in the documentation somewhere.

Reasoning from @typesupply:

The _get_base_something method calls the environment implementation _get_something. It then validates/normalizes the returned value before sending the value to the scripter.

Likewise, _set_base_something validates and normalizes the value from the scripter before passing it to the environment implementation _set_soemthing.

This makes sure that the scripter and the environment implementations don’t have to do any validation or normalization.

benkiel avatar Nov 15 '24 17:11 benkiel

I've tried to make the purpose of dynamicProperty objects a bit clearer than before in the updated class documentation, although the reason for the base/sub method structure isn't clarified. The reasoning doesn't seem much different from that of having both public and private equivalents, so I'm unsure whether such explicit documentation for dymic properties is necessary.

If it is, the class docstring of dynamicProperty seems like the most logical place for it. I can add it if so desired.

knutnergaard avatar Nov 16 '24 15:11 knutnergaard

That's fine with me. Thanks!

typesupply avatar Nov 18 '24 13:11 typesupply

Same — this is really for anyone wanting to implement fontParts into their app/objects/etc, to make it clear what the logic is.

benkiel avatar Nov 18 '24 16:11 benkiel

I see. On second thought, how well and where is the private/public method structure documented? Perhaps it makes sense to keep these parts of the documentation in the same place?

knutnergaard avatar Nov 18 '24 17:11 knutnergaard

It could go somewhere on here. It could say that the _base implemented in the base class does the normalization and all of that. It might be enough documentation for when we need to remember what all this does. 😆

typesupply avatar Nov 18 '24 18:11 typesupply

@benkiel @typesupply I've addressed this in #835.

knutnergaard avatar May 29 '25 16:05 knutnergaard