roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.46k stars 313 forks source link

bad error message on duplicate definition #6898

Open favetelinguis opened 4 months ago

favetelinguis commented 4 months ago

I have been trying out Roc for a few weeks and I really like what you are doing this is just a real world report about how I was talking about Roc at work and what went wrong.

Today I was talking with a coworker about how amazing this new language Roc is. After going to roc-lang.org she went to the repl and typed test = 1 and then again test = 1. She was met with a huge error message and the repl died. After that I had to endure multiple remarks that roc is not all that amazing ;)

Maybe its a small thing to fix just to prevent a potential bad first experience.

Anton-4 commented 4 months ago

Thanks for reporting this @favetelinguis! In this case, the code happened to hit a todo!. We're aware of the bad error messages that these todo's produce (https://github.com/roc-lang/roc/issues/6812), and @NoodleSamaChan is working on improving them :)

I would agree that the core of the language is amazing but we still have many things to improve.

6812 may take some time so I'll do a quick improvement of the error message now.

Anton-4 commented 4 months ago

We do have a nice error message for this case when you try to compile code in a roc file with duplicate definitions, but the repl performs some tricks that result in different behavior.

Anton-4 commented 4 months ago

I've put up PR #6899 with a better error message, it should be active in the web repl in a little less than 24 hours. This error will unfortunately still kill the repl, the fix for that is #6722.

Anton-4 commented 4 months ago

We do have a nice error message for this case when you try to compile code in a roc file with duplicate definitions, but the repl performs some tricks that result in different behavior.

I am actually curious why the usual Roc DUPLICATE NAME error does not get thrown in the repl, this issue should remain open until that is investigated.

Anton-4 commented 4 months ago

I forgot that regular error printing does not work with wasm, I'll try to fix it.

Anton-4 commented 4 months ago

A proper fix is not easy, I'm going to come back to this next week.