Hacker News new | past | comments | ask | show | jobs | submit login

That's possible, but it requires the machine to enter some things for you. Since ( is syntactically incorrect, it has to be entered together with ).

We do see small examples of this in GUI's with strict validation on inputs that is applied for each keystroke.

One useful compromise is syntax highlighting that doesn't let you enter syntactically incorrect code without flagging the problem in a loud red color.




Red hints annoy me honestly, when I meet these in real editors. I was thinking of something like grammar walker that completes input to shortest finished constructs. While not semantically correct, but syntactically like yes.

  pr
  pr;

  printf(
  printf(<?expr?>);
Or to not edit code as text at all, but as a tree. Like apple plist editor or windows registry editor, but with convenient shortcuts to add constructs. Xcode can sort of simulate this with templates and placeholders:

  if␣
  if (<?condition?>) {
      <?body?>
  }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: