3 ms·
>not being able to save syntactically incorrect code Going deeper, it would be nice to not being able to enter syntactically incorrect code.
by wruza 9y ago
>not being able to save syntactically incorrect code
Going deeper, it would be nice to not being able to enter syntactically incorrect code.
- kazinator 9y agoThat'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.
- wruza 9y agoRed 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?> }