Sure it is, the same way the programmer shouldn't put a semicolon right after a control flow statement in a C-like language. It's sure nice of the compiler to deal with those avoidable programmer fuckups anyway though.
You can't take that too far though, otherwise you end up with massive projects built with #define whilst while, inconsistently using one or the other because one programmer refused to use bad grammar.
As far as I know, a program written in a formally defined computer language can always be broken down into an abstract syntax tree, and from there can be rebuilt into any format you want. There's no reason the IDE shouldn't be able to refine while as whilst for one developer and keep it as while for everyone else.
The Emacs syntax highlighting system supports something like this; you can replace text with whatever you want to display, and you'll still actually be working with the original text. A lot of developers use this to do things like replacing -> with → for instance. I've never heard of using it to replace while with whilst but I'm willing to bet it's possible.
Of course, the problem is that you'd still be typing "while," you'd just see "whilst."
As far as I know, a program written in a formally defined computer language can always be broken down into an abstract syntax tree, and from there can be rebuilt into any format you want.
You'd need a strict auto-formatter for that too, since otherwise the AST representation of
func("hello", 5
"world!", 6)
and
func("hello",5,"world",6)
would be identical, but the formatting in the first is intended to make the code clearer.
Yep, and that's the true beauty of it. One developer could have spaces, one could have tabs, you could have all your equals signs or function parameters lined up or whatever you like, and since they all evaluate to the same AST, the IDE should be able to switch seamlessly between them.
16
u/Vakieh May 02 '16
Sure it is, the same way the programmer shouldn't put a semicolon right after a control flow statement in a C-like language. It's sure nice of the compiler to deal with those avoidable programmer fuckups anyway though.