rcl/src
Ruud van Asseldonk 258f0e2384 Rename Set.{map,flat_map}, add _dedup suffix
The map function in particular is a footgun that hit me twice in two
weeks, in a case similar to this one:

    {"apple", "orange", "banana"}.map(x => x.len()).sum()

This looks like it sums the lengths of the strings. Except it doesn't,
it sums the *unique* lengths of the strings, so we get 11 instead of 17.
That's surprising, and I don't want that kind of surprise in RCL.

At first I thought to remove Set.map and Set.flat_map entirely. You
would just have to convert to a list first and map there, and if you
wanted the set, convert back with List.to_set_dedup, which makes it
explicit. That's why I added these conversion functions. Then I
implemented deletion ... and as I was writing the PR description and
changelog entry for how to handle the break, it dawned on me, if we
have the _dedup anyway in to_set_dedup, we might as well use it here.
We don't have to delete these methods, we can just call them _dedup.

    {"apple", "orange", "banana"}.map_dedup(x => x.len()).sum()

Now the snippet is no longer so sneaky! It's clear that there is
deduplication going on! So I'm fine keeping them in this form. At least
in the Nix transitive closure test, the map_dedup behavior is what I
want, which validates demand for at least map_dedup. But even then,
a changelog entry for a breaking change that says "renamed to X" is a
much better experience than "have been deleted here are some much longer
alternatives".

Also, this change is relatively safe to make: it will break existing
callers, but they will get an error message and there is a clear path
to fixing this. It doesn't silently change the output of something: it's
being called on sets, so there can't even be fields named 'map' or
'flat_map' because sets don't have fields. So I feel comfortable making
a small breaking change here.
2025-12-17 19:28:26 +01:00
..
abstraction.rs Insert runtime typecheck for dict unpack if needed 2025-11-22 21:33:25 +01:00
ast.rs Insert runtime typecheck for dict unpack if needed 2025-11-22 21:33:25 +01:00
cli.rs Add --about that prints license info 2025-11-22 21:33:02 +01:00
cli_utils.rs Silence incorrect Clippy advice 2025-08-31 00:35:43 +02:00
cmd_build.rs Accept a new json-lines format in the CLI 2025-06-28 22:17:01 +02:00
cmd_eval.rs Implement JSON Lines output format 2025-06-30 22:49:37 +02:00
cst.rs Fix formatting of collections that contain unpacks 2025-12-13 15:35:54 +01:00
decimal.rs Tweak the handling of exponent 0 on integers 2025-08-22 20:17:14 +02:00
env.rs Prevent hangs from deeply nested values in recursion 2025-12-12 23:00:32 +01:00
error.rs Enable the CST formatter to read from multiple docs 2025-08-25 22:56:49 +02:00
eval.rs Rename Set.{map,flat_map}, add _dedup suffix 2025-12-17 19:28:26 +01:00
fmt_cst.rs Parse unpack expressions 2025-11-22 21:33:24 +01:00
fmt_json.rs Remove Value::Int in favor of Value::Number 2025-02-24 20:42:59 +01:00
fmt_json_lines.rs Implement JSON Lines output format 2025-06-30 22:49:37 +02:00
fmt_raw.rs Unbox primitive values 2024-02-10 14:11:01 +01:00
fmt_rcl.rs Fix broken intra-doc links 2025-09-02 23:25:11 +02:00
fmt_toml.rs Fix broken intra-doc links 2025-09-02 23:25:11 +02:00
fmt_type.rs Resolve todo in reporting type diff 2025-11-22 22:16:31 +01:00
fmt_yaml_stream.rs Simplify yaml-stream formatter 2025-06-30 22:49:37 +02:00
highlight.rs Delete builtins from highlight module 2025-03-15 19:58:19 +01:00
lexer.rs Lex .. and ... tokens 2025-11-22 21:33:24 +01:00
lib.rs Add crate docs with an example 2025-09-02 23:25:11 +02:00
loader.rs Fix broken intra-doc links 2025-09-02 23:25:11 +02:00
main.rs Encapsulate patch functionality in patcher struct 2025-08-25 22:58:11 +02:00
markup.rs Add a way to convert MarkupString back to Doc 2025-06-30 21:59:40 +02:00
parser.rs Allow comments after '=>' in functions 2025-12-13 16:00:04 +01:00
patch.rs Encapsulate patch functionality in patcher struct 2025-08-25 22:58:11 +02:00
pprint.rs Implement JSON Lines output format 2025-06-30 22:49:37 +02:00
runtime.rs Prevent hangs from deeply nested values in recursion 2025-12-12 23:00:32 +01:00
source.rs Enable the CST formatter to read from multiple docs 2025-08-25 22:56:49 +02:00
stdlib.rs Rename Set.{map,flat_map}, add _dedup suffix 2025-12-17 19:28:26 +01:00
string.rs Remove now-redundant cases of Prefixed<Expr> 2024-06-16 22:49:27 +02:00
tracer.rs Make width optional in pretty-printer 2025-06-28 21:50:20 +02:00
type_diff.rs Resolve todo in reporting type diff 2025-11-22 22:16:31 +01:00
type_source.rs Add build target parsing 2024-07-27 23:03:05 +02:00
typecheck.rs Remove todo in scalar unpack error message 2025-11-22 22:52:18 +01:00
types.rs Turn todo into deliberately unimplemented feature 2025-11-22 22:19:39 +01:00