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

Debug.todo could report types of the holes #354

Open
Janiczek opened this issue Feb 5, 2022 · 0 comments
Open

Debug.todo could report types of the holes #354

Janiczek opened this issue Feb 5, 2022 · 0 comments

Comments

@Janiczek
Copy link

Janiczek commented Feb 5, 2022

This is inspired by Gleam: whenever you use their equivalent of Debug.todo, it tells you where the call was and what type it is expecting, which is quite nice:
Screenshot 2022-02-05 at 17 10 14

Elm instead doesn't mention the specific calls to Debug.todo at all (nor their types):

-- DEBUG REMNANTS --------------------------------------------------------------

There are uses of the `Debug` module in the following modules:

    Main

But the --optimize flag only works if all `Debug` functions are removed!

Note: The issue is that --optimize strips out info needed by `Debug` functions.
Here are two examples:

    (1) It shortens record field names. This makes the generated JavaScript is
    smaller, but `Debug.toString` cannot know the real field names anymore.

    (2) Values like `type Height = Height Float` are unboxed. This reduces
    allocation, but it also means that `Debug.toString` cannot tell if it is
    looking at a `Height` or `Float` value.

There are a few other cases like that, and it will be much worse once we start
inlining code. That optimization could move `Debug.log` and `Debug.todo` calls,
resulting in unpredictable behavior. I hope that clarifies why this restriction
exists!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant