Is the resemblance to the "natural language" a compelling selling point for a programming language?

Take a look, for example, at AppleScript (and there are many others, some admittedly not bad) that tout the use of the natural language metaphor. The code seems to be more readable because it can be / is intended to be created in English sentences, he says. I am sure that there are people who would like nothing better than programming using only English sentences. However, I doubt the viability of a language that takes this paradigm too much (except in cases of niche).

So, after a certain reasonable moment, is natural-paganism use or obscene? What if the concept is taken to extremes - will the code necessarily be more readable? Or can it be unnecessarily long, difficult to work with, and just as capable of creating fun on the scale of the intricate Perl, C obfuscation, and Bash script logorrhea eye curl?

I know of some special cases, such as Inform, which are almost pure English, but they have a niche that they are unlikely to want to get out of. I hear and read about how great it would be to have the code read more like English sentences, but are there any discussions about possible flaws? If everyday language were so clear, simple, pure, beautiful, concise, understandable, why did we first invent mathematical notation?

Is it really easier to describe complex instructions accurately and accurately on a machine in natural language, or is not something closer to mathematical markup a much better choice? Where should this line be drawn? And finally, are you attracted to languages ​​that are advertised as resembling English sentences? If all this question was just one liner:

naturalLanguage > computerishLanguage ? booAndHiss : cheerLoudly;
+5
source share
13 answers

My answer to this question will be that the ideal programming language is somewhere between a natural language and a very formal language.

On the one hand, there are formal, minimal, mathematical languages. Take Brainfuck for example :

,>++++++[<-------->-],[<+>-]<.    // according to Wikipedia, this means addition 

, , -.

λfxy.x
λfxy.y

-. , (, AND, , λpq.pqp).

, , .


, , , , , . :

MAYBE IT WILL RAIN CATS AND DOGS LATER ON. WOULD YOU LIKE THIS, DEAR COMPUTER?
IF SO, PRINT "HELLO" ON THE SCREEN.
IF YOU HATE RAIN MORE THAN GEORGE DOES, PRINT SOME VAGUE GARBAGE INSTEAD.
(IN THE LATTER CASE, IT IS UP TO YOU WHERE YOU OUTPUT THAT GARBAGE.)

. , :

READ AN INTEGER NUMBER FROM THE TERMINAL.
READ ANOTHER INTEGER NUMBER FROM THE TERMINAL.
IF IT IS LARGER THAN ZERO, PRINT AN ERROR.

IT? ( .) — , , .

. , ?

, , . . (, , , .)


. , 10 000 , 10 000 (: GO/WALK/RUN/TROD/SLEEPWALK/etc. TO THE FRIDGE AND GET ME A BEER!). , 10 000 -, - , - , 9999 , 1 , .

, . , GW-BASIC COBOL, . , , , , , , , , , C-.

+5

, , , , , , , , , , .

+14

, Gartner 400 COBOL.

, , , . , .


, : , , , , , .

, , . Perl, APL J " ". - , , , - . , , , .

+4

" , , , -".

+4

( ) .

. , - , . -, ( ), , , , , . , . , , , . , , , , :

 "Workers [dumped [sacks [with flour]]]"
 "Workers [dumped [sacks] [with a fork-lift]]]"

, , ​​, , -. - "", , , , , .. " Dodge Viper, ".

, : , , LALR LL , , , , . , , , . , , , .

, , , - , , . , - . , .

+3

, , , , , ( ). , , . , , , , ( ).

, , ; , , ( , [, , , ...]).

- , , .

, , : , , Obj-C, mad libs:

[pot makeCoffee:strong withSugar:NO];

BrainFuck , , , .

; - , , , , , . ( , . [! Yay!])

+2

. .

"" , .

+1

, , ( Fortran, Pascal Cobol), Natural. 4GL 1980 ADABAS.

, , , . , , .

, "" 30 (, cobol), , "", . , 1GL → 2GL → 3GL , 4GL ( ) , . . - , , .

+1

SQL . , , "".

, SQL, , . . , - , , - , .

- . , , - , , / script /- intepreter/CPU.

+1

, , " ". , .

0

, , , .

, , "" , , , , , , .

, ​​AppleScript.

0

, , , , - . , , . .

, , - , - . , - , , .

, - - , Inform 7, , - , , , - , , . - ( ) , - , , , , .

, . , " ". : , , , .

C Pascal. Pascal:

for i := 1 to 10 do begin
  j := j + 1;
end;

C-:

for (i = 1; i <= 10; i++) {
  j = j + 1;
}

, Pascal, , , , , C .

. +, - *. /, : C,/ , ; "" div . , , .

C : & &, ||, &, |, ^, <, <, → - , and, or, and, or, xor, shl, shr. , - - , . , xor - , XOR - C, ^ XOR.

, - : , Pascal, C, , , : , .

, , : (, Inform), . (, C), , , , - , ( , , , - ).

0

I think the question is who reads and who writes the code of the application in question? I think, regardless of language or architecture, a trained software developer should write code and analyze the code as errors occur.

0
source

All Articles