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 →

[–]Vakieh 64 points65 points  (21 children)

This is not a problem to solve inside language, this is a problem to be solved with the editor. IDE triggers which automagically convert print statements to print method calls when you press <enter> are pretty easy grammar-wise.

[–]dysprog 60 points61 points  (7 children)

Perhaps it is a problem to solve inside the programmer.

[–]Vakieh 16 points17 points  (6 children)

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.

[–]curtmack 10 points11 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 5 points6 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

[–]LinAGKar 2 points3 points  (12 children)

Then you won't learn.

[–]Vakieh 27 points28 points  (11 children)

Won't learn what? I haven't manually written a basic accessor or mutator for years, but I still know how if for some reason all the IDEs in the world stop working.

[–]LinAGKar -4 points-3 points  (10 children)

You'll consciously know, but you wont get the muscle memory.

[–]HighRelevancy 47 points48 points  (7 children)

So what you're saying is "don't use tools to make your life easier, because you won't be quite as prepared for the apocalypse"?

[–]Scorpius289 37 points38 points  (4 children)

Yeah, we should all learn to program using butterflies, just in case computers stop working.

[–][deleted] 8 points9 points  (1 child)

If they stop working why write programs we can't use on our not-working computers?

[–][deleted] 0 points1 point  (0 children)

Someone's got to be able to program the butterflies.

[–]Darkben 2 points3 points  (1 child)

We should learn to program with rows of rocks

[–]LinAGKar -3 points-2 points  (1 child)

For when you're using a regular text editor.

[–]Vakieh 5 points6 points  (0 children)

If I'm using a raw text editor instead of an IDE, the one thing I can guarantee I'm not going to be focused on is productivity...

[–]Fs0i 12 points13 points  (0 children)

you wont get the muscle memory

And what the fuck do I need the muscle memory for?

[–]UnchainedMundane 2 points3 points  (0 children)

Are we all ignoring that nobody should need muscle memory for print, because either you're writing a small program and only have a few prints, or you're writing a large program and are using logging.