Add support to map in ets:select_replace with match spec

ets:select_replace/2 can use match spec to do in place replacement with List, which is efficient. But it doesn’t support replacing map.
For example, the change to a list works:
ets:fun2ms(fun({K, L}) when is_list(L) → {K, [marker | L]} end).
Output: [{{‘$1’,‘$2’},[{is_list,‘$2’}],[{{‘$1’,[marker|‘$2’]}}]}]
But for something similar with map:
ets:fun2ms(fun({K, Map}) when is_map(Map) → {K, Map#{marker => true}} end).
Error: the language element map (in body) cannot be translated into match_spec
{error,transform_error}
Is Erlang/OTP team considering adding support to map as well?

2 Likes

Came here to ask the same question!

Seems like there aren’t many recent updates, but it looks like this is an open issue with some experimentation. I’d subscribe to those GH issues if you want updates, I know I have!