-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
I'm not sure if I've just had bad luck or if these forbidden properties names are just so useful that they pop up frequently, but this has been a prickly part of S7 for me in a couple different projects now. I've only tried to use S7 in earnest in two packages and both have butted heads with this constraint in different ways.
I'm referring to these forbidden property names.
Just to illustrate a couple cases where this has come up in my exploration so far, I've encountered this during:
- implementing the debug adapter protocol, which has classes that have
namesfields. I'm trying to be faithful to the protocol, but I need to have a special case for this one field because this is a forbidden property name. - implementing a specialized version of a function that does return type checking, I store the return type as a
classproperty, but again hit this constraint. Here I have more control over the naming convention, but was surprised to see that there are these limits.
I'd like to propose a couple alternative designs
- The simplest solution would be to store properties in a
attr(obj, "properties")listto avoid any constraints on the names. However, I assume that this was consciously avoided because of the extra lookup. - If a
listis undesirable, perhaps introducing it only as a backup option for these specific elements so that nearly all properties remain surface-level attributes, but a few select forbidden names get relegated to an internal list. During property getting and setting, there would be branching logic based on whether the property name is forbidden or not.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels