Yeah, that makes sense. It would be worth thinking of other ways to avoid the issue of accidentally depending on a sorted map. Like since the implementation is opaque, perhaps it would be better if the keys were sorted in reverse by default? Probably something to talk to erlang people about.
On Fri, Oct 28, 2022 at 1:02 AM, José Valim < jose.va...@dashbit.co > wrote: > > Oh, you didn’t say it was an env var either. :) I just assumed based on > the casing. > > > In any case, that’s a C constant. It can only be changed while the VM is > building. > > On Fri, Oct 28, 2022 at 07:56 Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote: > > >> Sorry, it isn't an environment variable as far as I can tell, its just a >> constant in `erl_map.c`. https:/ / github. com/ erlang/ otp/ blob/ master/ >> erts/ emulator/ beam/ erl_map. c ( >> https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_map.c ) >> >> >> >> In this case I was using string keys, but reducing the likelihood of this >> foot gun in any way is good :) >> >> >> >> On Fri, Oct 28, 2022 at 12:34 AM, José Valim < jose. valim@ dashbit. co ( >> jose.va...@dashbit.co ) > wrote: >> >>> Can you please provide the documentation for said environment variable >>> from Erlang? >>> >>> >>> Also note that atom keys will likely no longer be sorted alphabetically in >>> Erlang/OTP 26, which should help with said assumptions. >>> >>> On Fri, Oct 28, 2022 at 06:20 Zach Daniel < zachary. s. daniel@ gmail. com >>> ( zachary.s.dan...@gmail.com ) > wrote: >>> >>> >>>> Myself and many other developers have been bitten by the fact that maps >>>> are sorted if they have less than 33 elements. Not because we believed >>>> that we should rely on the sort ordering of a map, but because we >>>> *accidentally* wrote an implementation that did, and didn't test it with >>>> more than 32 elements. Then at some point later in actual use things get >>>> strange, and debugging the above scenario can be very difficult (but is of >>>> course obvious in retrospect). This could be opt-in or opt-out, all the >>>> same to me, although unless the performance impacts are huge I think that >>>> it would save new developers even more time than experienced developers >>>> and so should potentially be opt-out. After a while when you start to see >>>> things "showing up in weird orders" you have an intuition to go look for a >>>> map being enumerated, but that isn't something a beginner would likely >>>> think of. >>>> >>>> As far as I know this is an erlang thing, but I'm not too familiar with >>>> erlang and thought I'd float it by the elixir group first. I'm also not >>>> sure if its possible to change those constants based on Mix environments >>>> (or to change them at all), but I imagine that is where it will intersect >>>> with Elixir. >>>> >>>> >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "elixir-lang-core" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to elixir-lang-core+unsubscribe@ googlegroups. com ( >>>> elixir-lang-core+unsubscr...@googlegroups.com ). >>>> To view this discussion on the web visit https:/ / groups. google. com/ d/ >>>> msgid/ elixir-lang-core/ >>>> a528c1bb-b8e1-429c-b1ff-a98db36ee2d6n%40googlegroups. >>>> com ( >>>> https://groups.google.com/d/msgid/elixir-lang-core/a528c1bb-b8e1-429c-b1ff-a98db36ee2d6n%40googlegroups.com?utm_medium=email&utm_source=footer >>>> ). >>> >>> >>> >> >> >>> >>>> >>>> >>> >>> >>> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to elixir-lang-core+unsubscribe@ googlegroups. com ( >>> elixir-lang-core+unsubscr...@googlegroups.com ). >>> To view this discussion on the web visit https:/ / groups. google. com/ d/ >>> msgid/ elixir-lang-core/ >>> CAGnRm4LBVOhd3AkP70QfkO486njj02%2BXYLGoAgF5M7AeHBGGJg%40mail. >>> gmail. com ( >>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LBVOhd3AkP70QfkO486njj02%2BXYLGoAgF5M7AeHBGGJg%40mail.gmail.com?utm_medium=email&utm_source=footer >>> ). >>> >> >> >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-core+unsubscribe@ googlegroups. com ( >> elixir-lang-core+unsubscr...@googlegroups.com ). >> To view this discussion on the web visit https:/ / groups. google. com/ d/ >> msgid/ elixir-lang-core/ l9s2xhyi. f95fde5a-5c38-40b7-ab2c-de3d3804b91f%40we. >> are. superhuman. com ( >> https://groups.google.com/d/msgid/elixir-lang-core/l9s2xhyi.f95fde5a-5c38-40b7-ab2c-de3d3804b91f%40we.are.superhuman.com?utm_medium=email&utm_source=footer >> ). >> > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscribe@ googlegroups. com ( > elixir-lang-core+unsubscr...@googlegroups.com ). > To view this discussion on the web visit https:/ / groups. google. com/ d/ > msgid/ elixir-lang-core/ > CAGnRm4K9V95mQzqMuEUyintLqOzytwf%2BXS%3DujkGNpcu1kr0oXA%40mail. > gmail. com ( > https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4K9V95mQzqMuEUyintLqOzytwf%2BXS%3DujkGNpcu1kr0oXA%40mail.gmail.com?utm_medium=email&utm_source=footer > ). > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/l9s3cphn.81d32bef-3ae9-47c4-b063-fcb2c274e3f7%40we.are.superhuman.com.