Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Protocol.UndefinedError) protocol List.Chars not implemented for {:error, :bad_name} #384

Closed
Munksgaard opened this issue Jul 21, 2023 · 5 comments
Assignees
Labels

Comments

@Munksgaard
Copy link

When using the initial example from the README to the main/1 of an escript, building with mix escript.build and running the resulting executable, I get the following error:

** (Protocol.UndefinedError) protocol List.Chars not implemented for {:error, :bad_name} of type Tuple. This protocol is implemented for the following type(s): Atom, BitString, Float, Integer, List
    (elixir 1.14.3) lib/list/chars.ex:1: List.Chars.impl_for!/1
    (elixir 1.14.3) lib/list/chars.ex:17: List.Chars.to_charlist/1
    (elixir 1.14.3) lib/protocol.ex:493: anonymous fn/4 in Protocol.extract_matching_by_attribute/3
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (elixir 1.14.3) lib/protocol.ex:492: Protocol.extract_matching_by_attribute/3
    (benchee 1.1.0) lib/benchee/system.ex:186: Benchee.System.all_protocols_consolidated?/0
    (benchee 1.1.0) lib/benchee/system.ex:173: Benchee.System.warn_about_performance_degrading_settings/0
    (benchee 1.1.0) lib/benchee/system.ex:27: Benchee.System.system/1

Here's the module I've defined:

defmodule Foo do
  def main(args \\ []) do
    list = Enum.to_list(1..10_000)
    map_fun = fn i -> [i, i * i] end

    Benchee.run(
      %{
        "flat_map" => fn -> Enum.flat_map(list, map_fun) end,
        "map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten() end
      },
      time: 10,
      memory_time: 2
    )
  end
end

I am using elixir 1.14.3 and OPT 25.

@PragTob PragTob self-assigned this Nov 8, 2023
@PragTob PragTob added the bug label Nov 8, 2023
@PragTob
Copy link
Member

PragTob commented Nov 8, 2023

EEEEEEK

thanks for the report 💚 Also, sorry for the long down time. Lots of going on.

Me and escripts 😂 Let me see if I can reproduce and figure this one out

@PragTob
Copy link
Member

PragTob commented Nov 8, 2023

Reproduced!

@PragTob
Copy link
Member

PragTob commented Nov 8, 2023

Alright, that's just a procol consolidation check that may or may not still be relevant that fails on looking up the elixir executable I can probably fix this easily or at least circumvent it

@Munksgaard
Copy link
Author

thanks for the report 💚 Also, sorry for the long down time. Lots of going on.

No worries! I appreciate the work you're doing ❤️

PragTob added a commit that referenced this issue Nov 8, 2023
In escript we can not find our elixir executable, so warn
and default to true (most things should have protocol consolidation
turned on)
PragTob added a commit that referenced this issue Nov 8, 2023
Will it work on Windows? Maybe?
@PragTob PragTob mentioned this issue Nov 8, 2023
PragTob added a commit that referenced this issue Nov 8, 2023
Will it work on Windows? Maybe?
PragTob added a commit that referenced this issue Nov 8, 2023
In escript we can not find our elixir executable, so warn
and default to true (most things should have protocol consolidation
turned on)
PragTob added a commit that referenced this issue Nov 8, 2023
Will it work on Windows? Maybe?
@PragTob
Copy link
Member

PragTob commented Nov 8, 2023

And fixed on main via #395 ! Thanks again for the report!

@PragTob PragTob closed this as completed Nov 8, 2023
PragTob added a commit that referenced this issue Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants