18:12 | <bakkot> |
... hm |
18:13 | <bakkot> | keying objects by functions |
18:13 | <bakkot> | kinda fun |
18:13 | <shu> | cursed |
18:27 | <bakkot> |
|
18:29 | <Francisco Tolmasky> | I actually do something similar to that all the time. Also use it to "carry" information in properties, something like { [property 'my-prop' ({ enumerable: false })\]: 10 }\ |
18:30 | <Francisco Tolmasky> | dont know how to nest backticks, but you get the idea, you can have a function that creates metadata, then creates a custom symbol on the fly, associates the metadata to the custom symbol in a weakmap, then returns the custom symbol, then on the other end you can use it to retrieve the metadata |
18:32 | <Francisco Tolmasky> | for example like Schema({ [property 'whatever'.readonly]: 10 }) (Schema then knows how to retrieve the metadata and construct the property descriptor from it to create the property on itself |