Closed kalekundert closed 3 years ago
The other advantage of eliminating function values is that I can then interpret callable layer values as deferred values, to be loaded when needed. This is the same way that layer locations work, so this would remove an inconsistency in the API. It would also allows use cases where layer values depend on object attribtues that aren't available at load time.
Right now, a layer value can be either a dictionary (really, any object implementing
__getitem__
) or a function accepting a key as an argument. The problem with the latter is that a key can be either a string or a function accepting a collection, and it doesn't make sense to use a function key with a function value. Since function values don't really add any functionality (any such function could be implemented using__getitem__
, and perhaps a wrapper could be provided to help with that), I'm inclined to get rid of them. This also simplifies the API for key functions, since they could now count on__getitem__
being available.I'll think about this some more, but for now I'll just try to limit myself to using collections.