You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it is now the cache generated by @memoize will always by of type Any => Any which can be sub-optimal. If argument and return types of the memoized function are known (and known to not change) it would be nice if the user could provide a fully typed container type for the cache.
However, since @memoize internally keeps function arguments in a tuple of two tuples (one for positional and one for named arguments), key types are a bit inconvenient. A function with a single Int argument for example produces Tuple{Tuple{Int64}, Tuple{}} as a key type for the internal cache.
If there is no simple way to sanitize the key type it would be useful to at least have a function that maps argument types of a function to the key type used by the macro, so that this for example would work:
As it is now the cache generated by
@memoize
will always by of typeAny => Any
which can be sub-optimal. If argument and return types of the memoized function are known (and known to not change) it would be nice if the user could provide a fully typed container type for the cache.However, since
@memoize
internally keeps function arguments in a tuple of two tuples (one for positional and one for named arguments), key types are a bit inconvenient. A function with a singleInt
argument for example producesTuple{Tuple{Int64}, Tuple{}}
as a key type for the internal cache.If there is no simple way to sanitize the key type it would be useful to at least have a function that maps argument types of a function to the key type used by the macro, so that this for example would work:
The text was updated successfully, but these errors were encountered: