I'm curious why both Set.empty and Dict.empty take {}
as an argument? I'm guessing there's a technical reason for it.
We don't have zero argument functions.
They have to be functions due to a technical reason (can try to find the real doc later if you want). Essentially if they weren't functions, you would only ever be able to have one type of Dict or Set. You wouldn't be able to generate multiple kinds.
I think this is the relevant doc? https://rwx.notion.site/Let-generalization-Let-s-not-742a3ab23ff742619129dcc848a271cf
yeah, there's a planned improvement which would let us remove them (so it would just be Dict.empty : Dict * *
) but it's not a high priority at the moment because it only comes up in a couple of places, and it's just an extra {}
to pass in :big_smile:
Ajai Nelson said:
I think this is the relevant doc? https://rwx.notion.site/Let-generalization-Let-s-not-742a3ab23ff742619129dcc848a271cf
Interesting read, thanks! That makes a lot of sense.
Richard Feldman said:
yeah, there's a planned improvement which would let us remove them (so it would just be
Dict.empty : Dict * *
) but it's not a high priority at the moment because it only comes up in a couple of places, and it's just an extra{}
to pass in :big_smile:
Does there happen to be a document on this too? I'm curious what that would look like.
I don't think so - basically @Ayaz Hafiz has an idea to extend the same thing we're doing for numbers to lists and some other types
and since those data structures are built from lists, they'd be fine
Ahh, gotcha!
Last updated: Jul 06 2025 at 12:14 UTC