pony-tutorial icon indicating copy to clipboard operation
pony-tutorial copied to clipboard

Add "Dealing With Common Errors" to Appendix

Open aturley opened this issue 9 years ago • 4 comments

When I was new to Pony, errors like Array[I32 val] ref is not a subtype of Array[I32 val] val: ref is not a subtype of val were a bit confusing, and I had trouble figuring out how to resolve them.

Most of my problems revolved around things related to reference capabilities, and I think that's probably going to be the case for most new people coming to Pony, because that's one of the big things that Pony has and that other languages lack.

I'd imagine something with:

  • an example error message
  • a quick explanation of what's happening
  • some example code that triggers the error
  • some example code that fixes the error
  • a link to the relevant part of the documentation to learn more

I'd maybe start with these errors:

  • receiver type is not a subtype of target type
  • right side must be a subtype of left side
  • function body isn't the result type

I think it would also be worth going into some detail about what these messages are trying to indicate:

  • [A] [cap1] is not a subtype of [A] [cap2]: [cap1] is not a subtype of [cap2] (where A is a type and cap1 and cap2 are different reference capabilities)
  • [A] [cap1] is not a subtype of [A] [cap1] !: [cap1] is not a subtype of [cap1] ! (where A is a type and cap1 is a reference capability)

aturley avatar Apr 09 '16 15:04 aturley

I'm willing to do the work here if anyone else thinks this is a good idea. I'd like to get some feedback on it before I go off and do it.

aturley avatar Apr 09 '16 16:04 aturley

i like the general idea although i wonder if effort would be better spent improving the compiler error messages and where possible have them recommend fixes (ala elm)

SeanTAllen avatar Apr 09 '16 17:04 SeanTAllen

We have this partially in place now. I kind of feel like this should be moved out of the appendix and onto a more prominent position on the website. Thoughts?

SeanTAllen avatar Nov 04 '17 23:11 SeanTAllen

@aturley and @SeanTAllen What is the renewed state of this issue? From my view, the underlying confusion is addressable both from improving ponyc errors and in a Tutorial "common error" resolution section.

rhagenson avatar Dec 16 '20 01:12 rhagenson