Skip to content

Conversation

sabiwara
Copy link
Contributor

@sabiwara sabiwara commented Oct 1, 2024

Some functions are using a mix of any and term within the same signature, which somebody pointed out to me is confusing as it seems to indicate some kind of nuance.

I know that specs are not meant to stay forever, so I gave up fixing all instances of any, but I searched for these mixed specs and replaced any by term (sometimes in other functions of the same module too) for consistency.

# quick-and-dirty one-liner for reference:
Path.wildcard("lib/**/*.ex") |> Enum.flat_map(fn file -> File.read!(file) |> Code.string_to_quoted() |> Macro.prewalker() |> Stream.filter(&match?({:@, _, [{x, _, _} | _]} when x in [:spec, :callback], &1)) |> Stream.map(&Macro.to_string/1) |> Stream.filter(& &1 =~ ~r/\bany\b/ && &1 =~ "term") |> Stream.map(& file <> "\t" <> &1)  end) |> Enum.each(&IO.puts/1)

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the type system will have term but not any, this is the right way to go.

@sabiwara sabiwara merged commit 8dcc969 into elixir-lang:main Oct 1, 2024
8 of 9 checks passed
@sabiwara sabiwara deleted the any-to-term branch October 1, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants