by jodrellblank · 7y ago · 0 comments
Whatever the design is, it would not ever spit a big red blob in your face which makes you wince and feel bad, nor would it fill your terminal - the place where you work - with screen after screen of tracebacks. It is unthinkable that you could write "x-1 = x+1" on a piece of paper and the equation scribbles on your workplace and you can't use it anymore.
There would be no adversarial relationship, you wouldn't be "fighting" the compiler or the borrow checker, no red squiggly underlines in an IDE. The whole approach would be reframed into the computer being a mechanical assistant helping you solve problems and guiding you towards success instead of slapping you.
A tuning fork plays a tone you can use to tune a piano string. It doesn't slap you if tweak the string tuning the wrong way. An archery target lets you see when you miss the centre, it doesn't also shout at you. Code not working is feedback all by itself. The tools shouldn't add negative feedback to that, they should guide towards where working is.
It's just a message to highlight what is wrong. Red doesn't equate to bad, red equates to "this is a compilation blocker", just as yellow is typically used for "this will work but it isn't a good idea". The compiler _already is_ guiding the user to success.
If somebody is taking compiler errors personally, they are going to struggle in a lot more areas in life than writing code, and the issue is their frame of mind.
Do you think a manager's choice of words has no effect on their subordinates? Do you think a book's choice of words has no effect on the reader? Do you think ALL CAPS IS NOT SHOUTING AND IS PERFECTLY NORMAL?
Are all software tools the same experience for you - you never find one frustrating and another pleasant, one neutral and another you curse at?
It's just a message to highlight what is wrong.
Nothing is wrong. That's the point. Unfinished code doesn't work, that's normal, not erroneous. (Almost tautologically so - of course it doesn't work, it's unfinished).
No. Context is important. A manager, a human being with authority, is very different to a standard, unchanging message baked into a program. Your claim and comparison (to me right now, correct me if I'm wrong) seems to be that IDE error messages are just as effective on the programmers feelings as the manager coming up to look at your code and pointing a finger while bluntly saying "this is incorrect". I don't believe this at all.
> Are all software tools the same experience for you - you never find one frustrating and another pleasant, one neutral and another you curse at?
They are not. Ironically it is the ones that don't produce direct error messages (especially css) that anger me the most.
> Nothing is wrong. That's the point. Unfinished code doesn't work, that's normal, not erroneous. (Almost tautologically so - of course it doesn't work, it's unfinished).
There's more than one state code can be in while incomplete. It can be incomplete because it doesn't accomplish the task it is being written for yet, but all the same it will still compile. If it is syntactically incorrect, it doesn't even matter if the logic attempted to be expressed is correct, the program is broken. But these errors are easy for a computer to expose - so they should, so problems are fixed as early as possible.
Yes, they should. As I said elsewhere, I'm not suggesting silencing errors or having no feedback at all. That would not be the computer assisting the user in writing correct code, that would be another way of hindering it.
Your claim and comparison (to me right now, correct me if I'm wrong) seems to be that IDE error messages are just as effective on the programmers feelings as the manager coming up to look at your code and pointing a finger while bluntly saying "this is incorrect". I don't believe this at all.
Not "just as effective", but effective nonetheless. Has an effect on. A compiler is not there to reject "broken" code, it's there to run a state machine over some text and report where it got to. Reporting that state with words that humans use to describe unpleasant situations and problems turns that neutral comparison into an unpleasant state and a problem. It becomes a problem because that's how we describe it. It need not be that.
I think term rewriting languages are close to this idea, in that if you write something that is not a redex, it just stays the way it is. I've never heard anyone describe this as particularly ergonomic or friendly however, as it can be hard to figure out why nothing is happening. It also severely constrains the language design.
You will be pushed. J
Seriously talking, if I need to wrote error checking code with user visible message, usually I'm trying to add a suggestion to user how to resolve problem. It's good UX.
Nope, it's only a recent idea. But say in a Python REPL you do len(0) what happens is this: https://i.imgur.com/wzbKaJ6.png it says, in red:
> len(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'int' has no len()
When you try to use a crosshead screwdriver in a slotted screw, it simply doesn't fit. It doesn't also say Traceback: TypeError: object of type 'slot' has no orthogonal drive slot, in red, while pushing your work away from you.I'm not suggesting hide the error, pretend it's fine, or paper over it with "error but I know you can do better :) :) :)". I'm suggesting a thorough but subtle shift in the approach so it's not you trying to build code and the computer bluntly rejecting it for being imperfect, and then you fight that. Instead it's you and the computer cooperating on the task of making code which works and does what you want.
> len(0)
Line 1: len() received something it cannot process (an 'int').
It is intended for lists and strings, use help(len) for more details.
1) Doesn't emphasise that it's an error. You already know it's an error because it didn't give you a length. Function could have a result with details of what happened, instead of throwing an exception. HTTP has a description of one part of it: "The status-code element is a 3-digit integer code describing the result of the server's attempt to understand and satisfy the client's corresponding request.". That's neutral, which is good. It then goes on to say that 4xx codes are client errors, and 400 is "Bad Request". That's not good. Imagine you went into an ice cream shop and asked for blueberry ice cream. Would they say "bad customer!" or "Error: we don't have any", or would they say "we don't have any"?2) Tries to guide you towards what it is intended for and how to make it work, instead of bluntly telling you it's wrong and leaving the rest up to you. "expected end of statement" is better than "parse error".
3) Isn't red. If everything's important, nothing is. Asking for the length of a number isn't a massive critical emergency, worthy of a star ship Red Alert, it's just a slight adjustment of the kind that is required all the time. Probably a typo, chill out.
4) Better if the experience allowed you to dismiss the error message, and it vanished. Visual Studio Code's ability to insert extra lines next to the code to show you messages, and remove them. Visual Studio's lightbulbs to the left of lines of code and hovering tooltip message boxes are good here. PythonWin lets you edit and delete command output.
In Visual Studio as an example, trying to assign a float literal to an int variable: two red cross icons, the text "1 Error", an error code, a red error underline under the code, a red marker on the scrollbar at that line. OK, okay, I get it. The message is neutral, helpful, "Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)". Have that message without the confrontational iconography. Tell me "the result of the parser's attempt to understand the code", draw my attention to it, draw an arrow pointing to it, highlight it, do useful things. Don't give me the constant low grade stress, don't give me the same kind of feedback when I mistype a comma as a dot as when something really serious is going wrong.
If so, not a language I'd consider using. Or one that I could see getting any sort of use in a production environment, but that might just be me.
All of this is complex work not merely because we are making it harder but because we are asking more and more.
Short of AI its infinitely more useful to have an exact answer to what went wrong instead of just silently not doing the correct thing because this is ultimately much harder to reason about.
I'm not sure how your kinder gentler world is even supposed to function or how you imagine you are supposed to work without better not worse tools giving you negative feedback when inevitably things go wrong.
An IDE which highlights matching pairs of parentheses as you move the cursor around is precise and helpful. It's not a "worse tool" because it lacks a modal red popup with a large exclamation mark and a DING! sound effect and the text ERROR 401 MISMATCHED PARENTHESES.
"kinder and gentler" are human traits. I'm thinking of it more like sanded smooth wood rather than splintery rough wood.
I'd argue that it still is a syntax error when it prevents you from placing the block at an illegal position, but the feedback loop is much faster and less disruptive than traditional syntax error messages.
Even in the case of other visual programming languages that are targeted towards adult professionals, the point of such tools is to suppress the symbolic mentality because the iconic and kinesthetic might be better for getting the job done.
I don't know if it's exactly what you want, but this team is working on making a language and compiler capable of "filling in the gaps" on syntax errors. I.e. it can provide completion suggestions and allow you to explore the consequences of those suggestions, by propogating them through the whole program.
The link below has pretty extensive coverage of this idea, with a paper and youtube video.
[0]:https://popl19.sigplan.org/event/popl-2019-research-papers-l...