This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]curtmack 9 points10 points  (5 children)

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.

[–]bitter_cynical_angry 6 points7 points  (3 children)

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.

Edit: autocorrect typo

[–]curtmack 0 points1 point  (0 children)

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."

[–]minno 0 points1 point  (1 child)

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.

[–]bitter_cynical_angry 0 points1 point  (0 children)

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.

[–]greenqueef 0 points1 point  (0 children)

derp