8 ms·
One with no errors. There's no concept of a "syntax error" or a "compiler error" or a function error. One of the most common things we joke about is people not
by jodrellblank 8y ago
One with no errors. There's no concept of a "syntax error" or a "compiler error" or a function error. One of the most common things we joke about is people not reading error messages.
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.
- sk0g 8y agoWould testing be off limits in this language as well? It is, after all, the computer screaming at you that your code doesn't work as you expect it to. 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.
- michaelmrose 8y agoif you write x-1 = x + 1 on a piece of paper it just sits there silently being wrong but code runs it shows information on the screen, it launches misles or intercepts them, it helps your phone play a tune or make a phone call. 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.
- jodrellblank 8y agoWhy would you even think my suggestion for "tools which point you towards success" maps to "worse tools which don't help you"?? 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.
- hulahoof 8y agoIt sounds like a nice IDE is the solution then
- jodrellblank 8y agoIf it sounds that way, then I did a bad job of turning an idea into words. Having a language with a concept of errors, and hiding them behind an IDE interface, is not the same thing as having a language without the concept of errors.
- michaelmrose 8y agoThe best way to avoid mismatched parens is to have the closing paren inserted automatically and have operations operate on either just contents or contents and both parens. See smartparens or paredit. Never having an error is indeed the nicest way to deal with errors but I don't know how you deal with all possible errors in the same structured way as smartparens deals with parens. Further efforts in the same vein might have value but even if we can correctly discern intent and correctness what do we do with it? In theory you could not allow someone to type foo.len() if foo doesn't have a len method or force the programmer to click a dropdown of available methods but that seems cumbersome. What if it will have such a method when you are done and the error is merely a function of the intermediate state at present? Ultimately flagging that section of the text may be the best way to allow code to be entered that will ultimately be in a correct state but isn't. Using the word error and the red squiggly line is probably if anything good UI because it correctly expresses the current state of the code and does a good job of drawing attention to the source of the problem.
- atoko 8y agoI believe we’re still trying to dig ourselves out of that particular hole since html days :)
- Athas 8y agoDo you have a concrete example of how this would work? If I write some garbage and ask the computer to run it, what should happen? 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.
- jodrellblank 8y agoDo you have a concrete example of how this would work? 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 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.
- brabel 8y agoLike the web (HTML/CSS/JS)? Unless you inspect the console, there's no errors.
- F-0X 8y agoThis seems to have a weird personification of a compiler/linter's error messages as a telling off, an insult, or a put-down. 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.
- jodrellblank 8y agoAnd this is a dismissal of the idea that words have effects on people. 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).
- F-0X 8y ago> And this is a dismissal of the idea that words have effects on people. 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.
- azhenley 8y agoOther people argued that block languages, such as Scratch, don't have syntax errors. If you can drop the block, then it will run. 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.
- noblethrasher 8y agoI'd argue that it's not a syntax error simply because the whole point of Scratch is to make programming accessible an audience (small children) for whom the kinesthetic and iconic mentalities are dominant. Syntax belongs to the symbolic mentality, which they haven't developed yet. 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.
- xelxebar 8y agoFunctional Programming with Typed Holes[0] 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-live-functional-programming-with-typed-holes https://popl19.sigplan.org/event/popl-2019-research-papers-l...