Hacker News new | ask | show | jobs
by ohwp 4693 days ago
What I think is interesting is that a lot can be done to make typing easier and more human when you can type like you speak (and think).

For example: we say/think

  for each item in list
but in a lot of languages you need to type something like

  foreach(item in list) {

A step further: we say/think

  let a be the substring of b from 1 to the end
we need to type

  a = b.substring(1)
Ofcourse the last example is much shorter and even more readable (to the machine for sure) but maybe code could be a little more human.
1 comments

I disagree. You could argue that a musician probably thinks "I have to play a D# for one and a half beats" as well. Or they can draw a dotted quarter on the sheet. We have symbolic languages for a reason - they are, once learnt, superior. If anything code needs to move further away from spoken language, more in the direction of APL and its descendants.

A skilled musician likely doesn't engage the speech centres of their brain, they see a note on the sheet and translate it to motion. You should be able to take in the symbol for "apply a function to each item in a vector" at a glance without any clumsy English getting in the way. APL had it right, but coding has been crippled by catering to the lowest common denominator.

"they see a note on the sheet and translate it to motion"

Indeed. I think notes are more 'human' than most programming languages. If the music goes up, the notes go up. If the notes are short they look short (and more dense).

But I agree that typing "let a be the subtring of b from 1 to the end" is no fun. So I'm glad we have symbolic languages. But I think they could be made more 'human'.

It isn't about English, but getting closer to the way programmers think. Most people don't think b.substring(1) natively any more than a musician would think "Da Capo al Coda". There are good parts of course; b[1:] is about as natural as ♩. for notation.