Live data from Hacker News

The English-Likeness Monster Stalks a New Generation of Programmers

raganwald.posterous.com

61–70 of 78 posts

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#61
post #57

Earlier quoted context omitted.

My point is that one doesn't use a natural language to get the job done, one uses a computer language in the likeness of a natural language to get the job done. The similarity speeds learning process. As for an example, you just gave one. But if we wanted to make it more natural-language-like it would be a slightly different syntax: DECLARE FUNCTION q_rsqrt (float number) THAT RETURNS float AS ( .... ); Now if you th…

The method signature is the low-hanging fruit. Try the method body. ADD: Do you accept that programming has its basis in mathematics and logic? If so, how is making computer languages resemble human languages a more direct way to improve comprehension than learning some math? Walking up a mountain path is difficult, but not nearly so difficult as moving the mountain until it lies beneath one's feet.

I don't see anything wrong with the message body. The point is we are talking about similarity, not identity. I have been clear: you can't program in English but there is some benefit to having languages which are easy for English-speakers to learn.

> Do you accept that programming has its basis in mathematics and logic?

This is one of the foundations of programming, particularly pronounced in technical fields. As you get to solving higher level problems however, other things come into play.

For example, suppose we are building a robot to automate some physical process (let's say, making coffee). We are going to have low-level programming which takes care of ensuring that we can tell the robot what exactly we want to do. If resources are tight we may do all of this low-level, but if we can spend more on resources we might want to have a higher-level (scripting, if you will) environment for brewing coffee.

On the higher level, our calculations are not going to be how many j of heat to add to the water. They will be what temperature to bring the water to. We may specify how finely the grounds are to be ground, etc. These instructions will resemble a cookbook recipe more than they will resemble a mathematical diagram, and this is the difference between high-level and low-level languages.

> If so, how is making computer languages resemble human languages a more direct way to improve comprehension than learning some math?

but the similarity is not just in vocabulary. In English we might write "three plus two equals five" where "plus" is essentially a conjunction, three and two are subjects, equals is a verb, and five is the predicate/object. This works because English has a subject-verb-object verb. Similarly a equals b plus c tells us that we can find out the value of a by adding b and c. In English there is a difference between a = b + c and b + c = a. There may not be a logical difference but there is a semantic difference that does not exist in pure math.

So let's imagine math written in another language, Irish Gaelic, translated word-for-word into English and ignoring conjucated prepositions. Irish Gaelic has a verb-subject-object word order, so we might write equals a adding and c. Maybe a nice way to represent this symbolically would be (= a (+ b c)). There wouldn't be a computer language like that, would there be?

The problem though that lisp encounters is that it is disorienting, and it is disorienting because the structure bears no resemblance to English.

If English-Likeness is a problem, surely that applies to word order and other syntactic similarities just as much as it applies to lexical similarities.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#62
post #58

Earlier quoted context omitted.

It's not that far from PL/SQL and PL/PGSQL CREATE OR REPLACE FUNCTION foo (int bar0) RETURNS int language plpgsql security definer volatile as $$ begin return $1 + 1; end; $$;

Which is the reason I can't stand SQL

and yet it is still a lower ratio or boilerplate to code (in nontrivial examples) than you get with C++ or Java.....

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#63

Mathematicians have been developing more abstract and concise symbols for hundreds of years and it looks nothing like English or any other natural language. If I had to guess I would say that future programming languages will look more like mathematics than anything else.

Why wait for the future, you can program in APL or (I recommend this one) J today! Have a look at quicksort in J: quicksort=: (($:@( #[)) ({~ ?@#)) ^: (1 Cute, isn't it? I was playing with J for some time - a few weekends maybe - I managed to get to the level of conscious incompetency, which is a lot for such a foreign language and then stopped, I just had enough. J is certainly very powerful, consistent and logical…

What about APL? The quicksort example from http://rosettacode.org/wiki/Sorting_algorithms/Quicksort reads:

qsort ← {1≥⍴⍵:⍵⋄ e← ⍵[?⍴⍵]⋄ (∇(⍵e)/⍵}

Unlike J, all the brackets/parens/etc are balanced, and the functions and operators have single-character names.

Having played with both APL and J, I find APL to be easier to read. J was really just an experiment, adding rank matching and forks and hooks to APL, as well as using ASCII only for syntax. It doesn't take long to remember the keys for entering the non-ASCII characters into APL, and it looks more readable than J.

I think a future programming language should have precedences for its operators, though.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#64
post #57

Earlier quoted context omitted.

The method signature is the low-hanging fruit. Try the method body. ADD: Do you accept that programming has its basis in mathematics and logic? If so, how is making computer languages resemble human languages a more direct way to improve comprehension than learning some math? Walking up a mountain path is difficult, but not nearly so difficult as moving the mountain until it lies beneath one's feet.

I don't see anything wrong with the message body. The point is we are talking about similarity, not identity. I have been clear: you can't program in English but there is some benefit to having languages which are easy for English-speakers to learn. > Do you accept that programming has its basis in mathematics and logic? This is one of the foundations of programming, particularly pronounced in technical fields. As yo…

> Maybe a nice way to represent this symbolically would be (= a (+ b c)). There wouldn't be a computer language like that, would there be?

https://en.wikipedia.org/wiki/Polish_notation -- is that what you're looking for?

Sorry, no time to continue the debate. You're welcome to keep believing, and human-languages interactions sure would be neat at any level, but I'm coming from too pragmatic an angle to believe this will happen before a complete mapping of the human brain or the singularity.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#65

It makes me think of MUDs, specifically my once-upon-a-time favorite, Dragonrealms. It had the usual "command direct-object" syntactical format common to MUDs, but it became an infamous problem to wrestle with the parser to find the correct "obvious" action. > put amulet on drawer > put amulet in drawer > put amulet behind drawer > place amulet on drawer > give amulet to drawer > push amulet to drawer > show amulet t…

Seems Wolfram Alpha suffers the same problem that you and the article detail.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#66
post #64

Earlier quoted context omitted.

I don't see anything wrong with the message body. The point is we are talking about similarity, not identity. I have been clear: you can't program in English but there is some benefit to having languages which are easy for English-speakers to learn. > Do you accept that programming has its basis in mathematics and logic? This is one of the foundations of programming, particularly pronounced in technical fields. As yo…

> Maybe a nice way to represent this symbolically would be (= a (+ b c)). There wouldn't be a computer language like that, would there be? https://en.wikipedia.org/wiki/Polish_notation -- is that what you're looking for? Sorry, no time to continue the debate. You're welcome to keep believing, and human-languages interactions sure would be neat at any level, but I'm coming from too pragmatic an angle to believe this w…

> You're welcome to keep believing, and human-languages interactions sure would be neat at any level, but I'm coming from too pragmatic an angle to believe this will happen before a complete mapping of the human brain or the singularity.

Ummm straw man there.

My point was just that computer languages which leverage people's existing understanding of natural languages do better than those which don't. I said way up at the beginning of my post that the constraints were totally different and that natural languages are quite a bit further from computer languages than we like to think.

I thought we were talking about likeness, not substitutability.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#67

Earlier quoted context omitted.

It's not that far from PL/SQL and PL/PGSQL CREATE OR REPLACE FUNCTION foo (int bar0) RETURNS int language plpgsql security definer volatile as $$ begin return $1 + 1; end; $$;

I was thinking COBOL. Edit: added sample. http://www.csis.ul.ie/cobol/examples/Conditn/IterIf.cbl

Now, there is a program that an ordinary person might be able to read to understand what it does.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#68

Earlier quoted context omitted.

My point is that one doesn't use a natural language to get the job done, one uses a computer language in the likeness of a natural language to get the job done. The similarity speeds learning process. As for an example, you just gave one. But if we wanted to make it more natural-language-like it would be a slightly different syntax: DECLARE FUNCTION q_rsqrt (float number) THAT RETURNS float AS ( .... ); Now if you th…

I wouldn't say that is "natural language like." I would just say that is a very loquacious programming language. I contend the C equivalent of that is more readable. You're using the same sort of constructs in typical programming languages but still lacking anything like the kind of fluid reading and understanding one would expect from the promise of English like programming languages.

If that is the promise it will never be met for the very simple reason I mentioned above: natural language is defined by how the speakers individually use the language. Computer languages are defined by specification. That kiss the flexibility you are asking for right there and that's why you can never program in English. It isn't just a question of imprecision. NULL in SQL is more imprecise than most of the things folks might argue about in English.... The problem is as to how you define correct usage and correct behavior.

The only promise that English-like languages can ever fulfil is that they will be easier to learn for English-speakers than languages which are not.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#69
post #50

Earlier quoted context omitted.

but you still require a hyperdefined subset of English to make that work, and such a parser cannot take into account dialectal and language drift issues.

It could if there were some level of AI behind it.

But at that point you run into another problem, namely that you can interact with computers in natural language but I don't think you can program them, because once you have that level of AI, you can't guarantee that two computers will have the exact same understanding of the command any more than you can expect that two programmers will read a spec in the exact same way.

What this means is that the consistency gained in programming languages would be lost. A computer program would no longer generate repeatable results.

Re: The English-Likeness Monster Stalks a New Generation of Programmers

#70
post #57

Earlier quoted context omitted.

The method signature is the low-hanging fruit. Try the method body. ADD: Do you accept that programming has its basis in mathematics and logic? If so, how is making computer languages resemble human languages a more direct way to improve comprehension than learning some math? Walking up a mountain path is difficult, but not nearly so difficult as moving the mountain until it lies beneath one's feet.

I don't see anything wrong with the message body. The point is we are talking about similarity, not identity. I have been clear: you can't program in English but there is some benefit to having languages which are easy for English-speakers to learn. > Do you accept that programming has its basis in mathematics and logic? This is one of the foundations of programming, particularly pronounced in technical fields. As yo…

I don't see anything wrong with the message body.

Let me see if I got that right. You see the need to transform:

  float Q_rsqrt( float number )
into:

  DECLARE FUNCTION q_rsqrt (float number) THAT RETURNS float AS
but you see no need to do anything to:

          long i;
          float x2, y;
          const float threehalfs = 1.5F;
          x2 = number * 0.5F;
          y  = number;
          i  = * ( long * ) &y;
          i  = 0x5f3759df - ( i >> 1 );
          y  = * ( float * ) &i;
          y  = y * ( threehalfs - ( x2 * y * y ) );
          return y;
I intentionally didn't refer to your later, more "concise" attempt, because the topic of discussion is the "English -Likeness" and, unlike "DECLARE FUNCTION q_rsqrt (float number) THAT RETURNS float AS", your "float function sqrt(float number)" doesn't add English likeness to the syntax.

Now, your assertion was that "what English-likeness does is it speeds up learning". Since we're all just flinging around theories unsupported by research and data, I'd like to posit that the main motivation behind attempts to do away with programming languages and replace them with natural languages is the misconception that you can learn to program without learning to think like a programmer. It doesn't really have much to do with syntax itself, it has to do with inherent complexity of programming.

To take your example, Lisp uses an unusual syntax which makes it disorienting at first. This "disorientation" is something people will deal with in a matter of days, whereas their struggle to plumb the depths of macros and functional programming will take much, much longer.

All in all, I believe that small degrees[1] of "English-Likeness" might help English speakers learn the syntax of the language a bit faster, but that benefit would prove insignificant when compared to the rest of the effort necessary to learn to program.

[1]: Small enough to avoid "polluting" the language with the problems @raganwald writes about.

Post reply on HN