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
It would be great to have a way to create a map without wrapping the keys and values in a tuple, similar to Java Map.of, as @ericnormand suggested in Clojureverse.
For example, instead of creating a nested map like this:
If you look far enough back in git for this project, I remember having them in here at one point. But I took them out for Simplicity sake, but I can break that down into some reasons:
How many overloads do you want to make for this function? Without many, it's not so useful. With many, it used to slow down the type inference for the IDE and I think for the compile.
In general, I don't like syntax that works one way sometimes and another way other times. It makes source control diffs messy when you go from your 6-item map to a 7-item map and the syntax is all different.
Many overloads for this function also increased the size of Paguro. This is a really small project. People have said they use it in Android projects where space is very tight.
It was more to unit test.
So, it was a lot of complexity without a lot of value. It was also a little unsafe if you had a map with the same type for keys and values. Like a Map<String,String>, there was no visual indicator what were keys and what were values. The "tup()" shows the pairs unambiguously.
I understand that there are situations where what you are asking for is advantageous. It's not that hard to write your own functions:
It would be great to have a way to create a map without wrapping the keys and values in a tuple, similar to Java
Map.of
, as @ericnormand suggested in Clojureverse.For example, instead of creating a nested map like this:
we would be able to create it like that (a bit less verbose):
The text was updated successfully, but these errors were encountered: