carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.
Apache License 2.0
5.55k stars 178 forks source link

I couldnΓÇÖt find the symbol 'Int.init' at line 1, column 12 in 'Blitable.carp'. #1342

Open rgkirch opened 3 years ago

rgkirch commented 3 years ago

Running the original example gives me an unhelpful and misleading error message.

This is the same source code as https://github.com/carp-lang/Carp/issues/1325 but I didn't have the option to reopen the issue so I'm making a new one.

I'd expect the error message to point me in the right direction.

(defn main []
  (IO.println &(str (width &Int))))
$ carp no.carp -x
I couldnΓÇÖt find the symbol 'Int.init' at line 1, column 12 in 'C:/Users/richie/notMyCode/carp-lang/Carp/core/Blitable.carp'.

Maybe you wanted one of the following?
    Int.blit
    Int.inc at C:/Users/richie/Documents/org/projects/handmade-carp/no.carp:1:2.

Traceback:
  (defn main [] (IO.println (ref (str (width (ref Int)))))) at C:/Users/richie/Documents/org/projects/handmade-carp/no.carp:1:1.

I'm on master branch commit 499a03e63edd1f370196f9ca43e55335d7e62c87.

rgkirch commented 3 years ago

I know this is an example of bad and invalid code and I believe Carp is right to reject it. I think it's a bug that the error points me to Blitable.carp instead of saying something about how it's invalid to take a ref of a type. I think it's also an option to mark this issue as "won't fix" and follow the mantra "garbage in garbage out". What do you think? Is this bug report productive or does it add noise?

eriksvedang commented 3 years ago

I think it's a reasonable issue :) Will be somewhat tricky to fix in an elegant way, but let's keep it open for now!