Natural Language Programming

Page 8 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
Status
Not open for further replies.

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
Wolfram is entitled to his opinion on that, and he has invested hundreds of millions to build a platform to back it up. Even so, the domain in which their research is taking place is still significantly more constrained than a general purpose programming language.

And that's why we started where we did. Wolfram (with ALPHA) and Nelson (with INFORM) and the folks at Apple (with SIRI) and the folks at Amazon (with ECHO), etc, are all attempting to build domain-specific natural language systems from the bottom up -- their primary audiences are not programmers, per se, and their systems are not programmed in the natural language they intend to interpret. Our system is different: our Plain English development system was written entirely in Plain English, and was written specifically as a "general purpose programming language" (with capabilities similar to native PASCAL or C).

You can write stand-alone programs in Plain English. You can write strictly procedural "console" applications in Plain English. You can write full-screen or windowed point-and-click event-driven programs in Plain English. You can develop interfaces in Plain English, or interact with the widgets provided by others. You can write file systems in Plain English, or interact with other such systems already in existence. You can develop text editors and hex dumpers and wysiwyg page-layout programs in Plain English. You can write compilers in Plain English, for any language (including Plain English). You can download and upload stuff from and to sites on the internet with Plain English. You can write programs that paint and draw pictures with Plain English. You can write text and graphic adventures in Plain English. You can write programs to analyze word lists for young readers in Plain English. You can process credit card transactions with Plain English. And we know all this is so, because we've actually done all those things with Plain English. Unlike ALPHA and INFORM and SIRI and ECHO, Plain English really is a general purpose programming language. Admittedly, it's not fully "packaged up and ready for prime time" (it is, after all, a research prototype). But it is a general purpose programming language. No doubt about that.
 

Spungo

Diamond Member
Jul 22, 2012
3,217
2
81
Adventure game parsers have been able to do what you're describing since the 1980's. If you're going to claim to enable "plain english" programming then you need to demonstrate how a user can instruct your system to do something useful by assembling a series of commands in natural english text, without any preconditions on which words are acceptable and which are not. Any other definition is not "plain english programming." It's "programming in osmossian" or whatever it's called.
Those games were pretty awesome, and they had some of the same problems mentioned in this thread.
Example:
https://www.youtube.com/watch?v=STGBWbivpmc&list=UUzMdwhnAoQ4ywzx7dgS-eZg#t=174
The scene contains a frog. If you say kiss frog, it says that's corny. A monster appears. If you try to kiss the monster, it still says that's corny. It would seem that it's only looking for the "kiss" keyword while ignoring everything else. It's not bad programming. It's just a limitation of getting non-programmers to enter commands.

One could argue that the graphical user interface is the future of unskilled programming and automation. I can open outlook right now and schedule something. I can list all of the people who will be there and where it will be. I can tell it to notify me before this event happens. I can look on the calendar to see if it conflicts with something else happening that day. Was that possible 30 years ago? I don't think DOS lets you run multiple things at once. This was a task that even a skilled programmer couldn't really do. You're either in the program or you're not. If you're not in the calendar program, you will not be notified about this meeting. I don't even think home computers had Windows services until Windows XP. If you were using Windows 95, you could maybe create a scheduled task to open a text file saying "you have a meeting at 9am, check your calendar". It's like tying a string around your finger to remember something. It's the most ghetto kind of programming/scripting/automation imaginable. The kind of automation you can do now is unbelievable, and you don't need to know anything about programming because it's all graphical and things can run in the background without killing performance. Am I saying that Outlook and Excel are forms of programming? Yes, I am. It's just a very high level form of programming. Very simplified, yet very powerful.

Here's a nice example of future programming:



We had to do this in electrical engineering. It's called ladder logic, it's used in Programmable Logic Controllers (PLCs), and this is what drives industry. It's really interesting if you think about it. Before computers, the ladder logic would represent mechanical relays and sensors. This is not a graphical representation of some computer language. It's a graphical representation of an electric circuit. All you do is follow the electricity. This switch closes, power goes down wire rung 53 to activate a pump, etc.

OP, there's an idea. You could make a ladder logic program. Your program could compile the ladder logic into an exe. That would be unique.

Coding with graphical software is the future as well. Look at Visual Studio. You type "string." and a menu pops up as soon as you hit that period. That menu is doing what the OP is trying to do. It's making programming easier. Instead of me telling the computer what to do in English, how about the computer uses English to tell me what I can do. Tell me what something is when I put the mouse on it. Suggest things when I start typing. It even underlines things that are wrong. You know the code is broken before you attempt to compile it. This is how we bring programming to the unwashed masses.

I'm always saying that I think Perl is an easy language, but that's only true in Notepad++. Scalars are orange, arrays are pink, hashes are a light color I can't describe, keywords are blue, comments are green. Things in back quotes are yellow with a dark background. It's a lot easier to see what's going on when it's color coded. Pasting the exact same script into regular notepad makes the code virtually unreadable. It feels difficult when it's all the same color. Computing can be made easy just by changing the colors of words and remembering the names of variables defined earlier in the code. Unlike making a new language, helping visualize things will never go out of style. Think of the first person to indent things. That was a huge step forward, it applied to all languages, and it will still be important 10 or 20 years from now.

Anyway, I think the OP should work on the presentation of language rather than the language itself. One way to help is to actively support things like Notepad++. Contribute some code, add some plugins. I think it would be really nice if every language was as well supported as Python:


It seems like programmers always have nice grammar. Look at that use of a comma and semicolon. The comma is used to separate a condition from the rest of the clause. A semicolon is used to start a new clause related to the same topic.
The people who would have trouble writing in C# due to syntax are the same people who would have trouble writing English.
 
Last edited:

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
You have yet to show [that Plain English is a general purpose programming language], despite a lot of prompting.

You must have a different definition of "general purpose programming language" than the rest of the world (http://en.wikipedia.org/wiki/General-purpose_programming_language). If a programming language can be used to conveniently and efficiently write the wide variety of programs I listed in my previous post -- and Plain English is such a language -- what else could it be but a "general purpose programming language"?
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
Those games were pretty awesome, and they had some of the same problems mentioned in this thread... If you say kiss frog, it says that's corny... It's just a limitation of getting non-programmers to enter commands.

This is a different situation from Plain English programming. With a text adventure game, the user and the programmer are two different (and usually unrelated) people. A Plain English programmer not only writes Plain English code, but he extends the language, in his own way, as he programs: every type, variable, and routine he defines adds to the vocabulary and grammar of his system. In short, he's not "working in the dark" as the player of a game is; he's both outside and inside the system.

One could argue that the graphical user interface is the future of unskilled programming and automation.

There are obvious limits to what can be done with point-and-click programming interfaces. The fact remains that some things are best done with words, some with formulas, some with pictures, etc; no single approach can satisfy all needs, even for the uninitiated.

Our goal is to produce a hybrid system where the proper tool for each job can be used: a system where the beginner (with limited finesse) and the professional (with, hopefully, much finesse) can communicate with their machines simply and naturally. With both groups -- and everyone in between -- using essentially the same tools (as children write short English sentences, and calculate with elementary formulas, and draw simple diagrams, while adults write longer sentences, and work with more sophisticated formulas, and produce more intricate drawings).

Am I saying that Outlook and Excel are forms of programming? Yes, I am. It's just a very high level form of programming. Very simplified, yet very powerful.

Agreed.

Coding with graphical software is the future as well. Look at Visual Studio. You type "string." and a menu pops up as soon as you hit that period.

This sort of thing appeals to some and not to others. The coder who is just learning or who is using an unfamiliar facility typically appreciates the help; while the coder who knows what he wants to say typically finds the prompts and pop-ups and color changes nothing but distracting. Different strokes for different folks.

That menu is doing what the OP is trying to do. It's making programming easier.

Yes, our goals are the same. But our methods differ. Instead of helping the programmer with an unfamiliar syntax, we're trying to eliminate the unfamiliar altogether. Instead of assisting the programmer with a system that is too large to master, we're trying to keep the system small enough so it can be mastered (at least in its essential points and properties).

Instead of me telling the computer what to do in English, how about the computer uses English to tell me what I can do.

How about both? That's the idea we're developing in the interactive version of Plain English. You essentially code one sentence at a time, "coming to agreement" with the compiler, so to speak, and "chatting about alternatives and resolving ambiguities", as you go along.

I'm always saying that I think Perl is an easy language, but that's only true in Notepad++. Scalars are orange, arrays are pink, hashes are a light color I can't describe, keywords are blue, comments are green... It's a lot easier to see what's going on when it's color coded. Pasting the exact same script into regular notepad makes the code virtually unreadable. It feels difficult when it's all the same color.

Too much of a circus in our way of thinking; when everything is highlighted, nothing is highlighted. And generally unnecessary in a natural language. Think about it: authors write and ordinary people read millions of pages of black-on-white text every day, on every imaginable subject, with no trouble at all. There must be something wrong, at bottom, with a language that requires such a plethora of color-coding to make it accessible.

Unlike making a new language, helping visualize things will never go out of style.

The project that led up to our Plain English project was an attempt to create a better programming language in a more traditional style simply by retaining the best features of an existing language while removing the objectionable ones. And we were able to improve on many such languages. The problem was that the resulting language was always, to a great extent, arbitrary. That's why we switched to English (which is also arbitrary, of course, but arbitrary in a widely-accepted way). A syntax that "will never go out of style".

Think of the first person to indent things. That was a huge step forward, it applied to all languages, and it will still be important 10 or 20 years from now.

Sure. But keep in mind that people were indenting their paragraphs centuries before computers were even imagined.

Anyway, I think the OP should work on the presentation of language rather than the language itself.

I'm not sure what you mean by that. Our integrated development environment already "presents" the language in a context that reflects a broad range of our beliefs regarding what makes programming easier for both beginner and expert. Have you tried it?

It seems like programmers always have nice grammar. Look at that use of a comma and semicolon. The comma is used to separate a condition from the rest of the clause. A semicolon is used to start a new clause related to the same topic.

In some languages, yes; But programmers "have nice grammar" in such cases because it's required of them: their programs won't run if they don't toe the line.

The people who would have trouble writing in C# due to syntax are the same people who would have trouble writing English.

I don't think that's true. I'm pretty sure there are many accomplished novelists who would abhor C#. And plenty of mathematically-minded C# programmers who couldn't write a decent short story if their lives depended on it. But it's a moot point. Languages that are effective will survive; languages that are not will fall into disuse and will eventually be forgotten. Not too many people use Roman numerals any more...
 

Rakehellion

Lifer
Jan 15, 2013
12,181
35
91
One of the biggest problems you have with spoken language is ambiguity. Compilers tend to hate that. Everything needs to be defined and all ambiguous statements need to be resolved before a compiler can generate proper code. How many times have you ever talked with someone who went and did something other than what you asked for?

Dave

Right. And sometimes ambiguity is intentional.

Natural language is like any other programming language, you still have to learn the syntax.
 

Spungo

Diamond Member
Jul 22, 2012
3,217
2
81
Natural language is like any other programming language, you still have to learn the syntax.
You realize this when you talk to little kids. I remember watching my friend talk to her son. He was maybe 2 or 3 or something. My friend asked where something was, and her son said it was downstairs. My friend was confused because there was no downstairs. The building has a ground floor and a second floor, but no basement, and we were on the ground floor. The kid thought downstairs was an absolute name of that floor.

You can run into similar problems when talking to a different kind of little kid - most adults. We're all guilty of this. Rather than looking up the true meaning of words, we assume the meaning based on context, and the assumed meaning can be very different from the dictionary meaning. Different than? We very rarely check the actual definitions of words. Or phrases. Or names. Or anything.
Here's a fun game you can try. I want you to ask people what the following words mean:
-dynamic
-static
-redundant
-volatile
-literally
-narcotic
-organic
-queer
-depressant


Select the text below to see what they actually mean. People are free to disagree with me on the meaning of these words. Words can mean different things to different folks:

Dynamic:
This word relates to change. To say I work in a dynamic environment means my environment is always changing.

Static:
The opposite of dynamic. It means things do not change. If I place a brick on the ground and it doesn't move, I would say the brick is static. It's in static equilibrium. What does it mean in programming? It's when something doesn't change.

Redundant:
Redundant means something is not essential. Having a second hard drive to backup data is redundant. I can take the second hard drive out and the computer still works. That doesn't always mean it's bad or useless, but it can. In engineering, redundancy is often a good thing. In writing, it can be a bad thing because it can make things confusing.

Volatile:
Volatile means something quickly evaporates. Chloroform is a volatile chemical. Is it explosive? No. Is it flammable? No. Is it dangerously reactive? No. It just evaporates quickly. Volatile can also means rapidly changing. It doesn't mean bad. It doesn't mean dangerous.

Literally:
Literally means something happened exactly as stated. I shot a guy in the face and his head literally exploded.

Narcotic:
Narcotic means it causes drowsiness or loss of consciousness. Think narcolepsy. Cocaine is not narcotic. Amphetamine is not narcotic. Carbon monoxide is narcotic. Alcohol is narcotic.

Organic:
In biology, organic means it relates to living matter. Space invaders from Mars would be organic. In chemistry, organic means something contains carbon but is not a cyanide, carbide, or carbonate. Table salt is inorganic. Sugar is organic. Oil is organic. Plastic is organic. Heroin is organic. Amphetamine is organic. Nicotine is organic.

Queer:
Queer means strange. This actually makes a lot of sense. If someone is flamboyantly gay, you might say they're a bit strange.

Depressant:
A depressant is something that slows your body's nervous system. Now that you know what this word means, it can radically change the meaning of saying someone is depressed. It means their nervous system is below normal. A lot of "thrill seekers" are clinically depressed. Doing unusually dangerous things is an attempt to get out of a depressed state and feel normal. Putting a non-depressed person in the same dangerous situation would take them from normal to stressed out.


English is a tricky language. A lot of us say things that technically don't mean anything, but people still understand the intended message.
"The burned out light bulb [in a series circuit] is always the last one you check."
Of course it is. Why the hell would you keep checking for dead bulbs after you've already found the dead one? Also, is burned the correct word in that sentence? I think burnt is a word too. I literally checked it close to exactly two seconds ago.
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
Rather than looking up the true meaning of words, we assume the meaning based on context, and the assumed meaning can be very different from the dictionary meaning.

I think it would be more accurate to say that in all natural languages, most words have multiple meanings -- meanings that can normally be determined by the context. Dictionaries typically list the various meanings, often with examples of the proper context. Like this:

Noun: words
1. The words that are spoken ("I listened to his words very closely")
2. The text of a popular song ("he wrote both words and music")
3. Language that is spoken or written ("she put her thoughts into words")
4. An angry dispute ("they had words")

Is this a problem in everyday life? Usually not, since we're all pretty good at interpreting things in context. Is it a problem when we use something like English as a programming language? Again, usually not since compilers are also pretty good at using context. As Wolfram put it in his article on natural language programming that I quoted above:

"Something I thought would be a big issue is the vagueness of natural language. That one particular natural language input might equally well refer to many different precise programs... But in reality this seems to be quite rare: there is usually an 'obvious' interpretation that one can put first—with the less obvious interpretations a click away."

English is a tricky language.

True, English is not always a pretty thing. But it is widely used and understood. And things recommended as alternatives are not always pretty -- or improvements -- either. I just started another thread about a Conversational Storytelling system:

http://forums.anandtech.com/showthread.php?t=2410448

We developed the thing first in Plain English, and then converted it to HTML/JavaScript (so it would run in browsers). Here's a type definition from that system, first in Plain English (blue), then in JavaScript (red):

A story is a thing with a title, a prolog, some scenes, and an epilog.

function Story() { this.title=[]; this.prolog=[]; this.scenes=[]; this.epilog=[]; }

Is JavaScript's "less ambiguous" syntax really an improvement in this case? Obviously not. And we run into the same kind of thing throughout the program. Here, for example, is the equivalent Plain English (blue) and JavaScript (red) code for moving from one scene to another:

If the current scene is complete, go to the next scene.

if (isComplete(currentScene)) currentScene=nextScene(currentScene)

Again, is JavaScript's "less ambiguous" syntax really an improvement in this case? I don't think so. In both of these cases -- and in almost every other line in the program -- the Plain English syntax is (a) easier to think about, (b) easier to type, (c) easier to understand, and (d) easier to remember.

A lot of us say things that technically don't mean anything, but people still understand the intended message.

Some technical terms for such things are "metaphor" and "hyperbole" and "idiom". Most people don't realize it, but all languages, except when describing objects that can be directly sensed, are metaphorical and idiomatic through and through -- including programming languages, mathematical formulas, graphical representations, etc. The good news is that, as above, this doesn't typically become a problem in everyday conversation. Nor is it a major hurdle for natural language programming systems.
 
Last edited:

Sgraffite

Member
Jul 4, 2001
171
107
116
We developed the thing first in Plain English, and then converted it to HTML/JavaScript (so it would run in browsers). Here's a type definition from that system, first in Plain English (blue), then in JavaScript (red):

A story is a thing with a title, a prolog, some scenes, and an epilog.

function Story() { this.title=[]; this.prolog=[]; this.scenes=[]; this.epilog=[]; }

Is JavaScript's "less ambiguous" syntax really an improvement in this case? Obviously not. And we run into the same kind of thing throughout the program. Here, for example, is the equivalent Plain English (blue) and JavaScript (red) code for moving from one scene to another:

If the current scene is complete, go to the next scene.

if (isComplete(currentScene)) currentScene=nextScene(currentScene)

Again, is JavaScript's "less ambiguous" syntax really an improvement in this case? I don't think so. In both of these cases -- and in almost every other line in the program -- the Plain English syntax is (a) easier to think about, (b) easier to type, (c) easier to understand, and (d) easier to remember.

I'm not arguing for nor against natural language programming as I feel like that is not something I wish to spend my time on.

However I feel like this is a poor comparison. Your English version represents a single story which knows of itself when referenced.

Your javascript version of the Story represents a singularly named Story which is defined to appear to accept multiple of each property. Based on the English representation it doesn't seem a Story may have multiple titles, but the javascript representation appears to assume having multiple is common.

The English version of the scene completion know of its self, and will tell you when the scene has completed. The javascript version you have to tell it what scene is current, so an anonymous visitor can decide if is the scene has completed.

In my opinion it would make much more sense to represent the Story as an object in javascript so the properties would be more clearly defined, and asking the instance of a Story if it has been completed or not doesn't require telling the Story again what scene the Story is on.

This could be a language barrier in and of itself, because if you are more familiar with one language it seems natural you would be able to write a more clear description of something using it.
 
Last edited:

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
I'm not arguing for nor against natural language programming as I feel like that is not something I wish to spend my time on.

Okay.

However I feel like this is a poor comparison.

I'm sure our JavaScript code will appear unusual to many. Plain English is a purely procedural language and, since we like procedural programming, we decided to make the translation using JavaScript as if it were also a purely procedural programming language (rather than an object-oriented language) so we'd only have to deal with differences in syntax (and not paradigm as well).

Your English version represents a single story which knows of itself when referenced.

Which (to a procedural programmer like myself) seems like the hard way of saying that "the story" is a global variable. Keep in mind that, in the procedural paradigm, variables don't "know" anything; they are simply containers for values of various types. The programmer instructs the machine to do things to and with variables; variables do nothing on their own. They are not active agents. The only active agent in a procedural program is the programmer who wields the computer as a tool to manipulate variables.

Your javascript version of the Story represents a singularly named Story which is defined to appear to accept multiple of each property. Based on the English representation it doesn't seem a Story may have multiple titles, but the javascript representation appears to assume having multiple is common.

A title in the English version is defined like this:

A title is a thing with some outputs.

Where "an output" is just a text string with previous and next pointers so it can be hung on a doubly-linked list. In the JavaScript version, an array of strings serves the same purpose. Ditto for the other "fields" in the story "record" -- except for "scenes" which are "records" themselves (and not mere strings) and which have other things hanging off of them. In short, the Plain English data structure is mostly "lists of lists"; the JavaScript equivalent we chose to use is "arrays of arrays".

The English version of the scene completion know of its self, and will tell you when the scene has completed. The javascript version you have to tell it what scene is current, so an anonymous visitor can decide if is the scene has completed.

It's true that in the English version the global variable "current scene" is used directly, where in the JavaScript version the "current scene" variable is passed around. Frankly, I don't remember how or why it ended up that way.

In my opinion it would make much more sense to represent the Story as an object in javascript so the properties would be more clearly defined, and asking the instance of a Story if it has been completed or not doesn't require telling the Story again what scene the Story is on.

From an object-oriented perspective, I'm sure you are correct. But we find the whole object-oriented approach conceptually unintuitive and fundamentally flawed in a number of ways (see http://harmful.cat-v.org/software/OO_programming/why_oo_sucks for a nice summary). We are sworn against using it.

I realize you said you weren't interested in discussing issues related to natural language programming, but I think it important mention that my points regarding syntax would still stand, even comparing procedural Plain English with object-oriented JavaScript. Plain English syntax is (a) easier to think about, (b) easier to type, (c) easier to understand, and (d) easier to remember.
 
Last edited:

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
The subject of object-oriented programming came up in my previous reply and I thought it might help if I explained our aversion to the idea with a simple example.

Let's say we want to mount a tire on a bike. In Plain English we code up two types (one for each noun), like so:

A bike is a thing...
A tire is a thing...


And then we code up a routine to explain how the verb (mount) applies to those two nouns:

To mount a tire on a bike...

But with objects, we have to hide that routine (verb) inside one or the other of our types (nouns). But which? Do we want to end up with:

tire.mount(bike)?

or

bike.mount(tire)?

Obviously, neither. What we want, in this kind of syntax, is:

mount(tire,bike)

where "mount" is independent of both type definitions. And of course what we're really thinking the whole time, is:

Mount the tire on the bike.

Which is exactly how you'd call the Plain English routine described above.

Nouns (types) are one thing, verbs (routines) are another; the whole idea of hiding a verb inside a noun is linguistic nonsense. And the whole idea of asking an inanimate object (like a tire or a bike) to do something (like mount) is also nonsense.

Historically, here's what went wrong. Way back in the 1970's, Alan Kay -- a microbiologist by training -- noticed that living cells did things by themselves and in conjunction with other cells. So he attempted to create a programming paradigm based on this idea, which he called "Object Oriented" and which began with the cardinal rule: "Everything is an Object." Which might be a great idea for simulating the actions of living cells. But as a general-purpose paradigm for use in our macro-world where intelligent agents (like users and programmers) operate on both animate and inanimate things, with and without tools (like screwdrivers and computers), from without, it's simply the wrong approach.
 
Last edited:

Sequences

Member
Nov 27, 2012
124
0
76
What's wrong with asking inanimate objects to do things? Asking a dog to mount a tire to a car won't mount the tire to the car either. I don't think that's a valid argument.

I would like to see a few nontrivial examples. Can you implement binary search? Find the factorial? How about a circularly linked list?
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
What's wrong with asking inanimate objects to do things? Asking a dog to mount a tire to a car won't mount the tire to the car either. I don't think that's a valid argument.

A good model accurately mirrors reality; it doesn't twist or warp reality to fit a preconceived notion. Asking a ball to fetch itself is nonsense since a ball lacks both intelligence and will. Asking a dog to write a book is nonsense because it is beyond a dog's ability to do so. But asking a dog to fetch a ball is reasonable, because a dog has enough intelligence and will to put such a task within his reach. A good programming paradigm will recognize and reflect such realities; a bad one won't.

I would like to see a few nontrivial examples. Can you implement binary search? Find the factorial? How about a circularly linked list?

Binary searches, finding factorials, circularly linked lists, etc, existed, were well understood, and were conveniently and efficiently implemented in procedural programming languages (like Pascal and C) long before the object-oriented approach was even conceived; so clearly "objects" are not required in these cases.

But perhaps you're asking to see non-trivial examples of Plain English code. In this case I would recommend you look at our manifestly non-trivial Plain English development system (which includes a unique interface, a simplified file manager, an elegant text editor, a hexadecimal dumper, a native-code-generating compiler/linker, and a wysiwyg page layout facility). If procedural programming in general, or Plain English in particular, is not up to the job, how did we ever manage to conveniently and efficiently write all those programs? Write me directly and I'll give you a link to the whole shebang including the source code: gerry.rzeppa@pobox.com

In the meantime, here's a traditional "non-trivial" example often used to compare programming languages that shows how the kind of code we develop in Plain English differs from traditional implementations. Specifically, most programming languages are concerned with how something is done; our goal is to allow the programmer to work at a higher level, where he says what is to be done, delegating the how to lower-level "support routines" that may be coded in any suitable syntax.

Here's the problem description from Wikipedia:

To count all the prime numbers less than or equal to a given integer n by Eratosthenes' method:

1. Create a list of consecutive integers from 2 through n: (2, 3, 4, ..., n).

2. Initially, let p equal 2, the first prime number.

3. Starting from p, enumerate its multiples by counting to n in increments of p, and mark them in the list (these will be 2p, 3p, 4p, etc.; the p itself should not be marked).

4. Find the first number greater than p in the list that is not marked. If there was no such number, stop. Otherwise, let p now equal this new number (which is the next prime), and repeat from step 3.

5. When the algorithm terminates, all the numbers in the list that are not marked are prime.

And here's the actual Plain English code:

To get a count of prime numbers less than or equal to a number:
Create a list of consecutive integers from 2 to the number. [wiki's step 1]
Get an entry from the list. [wiki's step 2]
Loop. Mark higher multiples of the entry. [wiki's step 3]
Get the entry for the next lowest possible prime. If the entry is not nil, repeat. [ wiki's step 4]
Get the count of prime numbers in the list. [wiki's step 5]


Note the similarities with the problem statement. And the differences between Plain English code an traditional languages. The Plain English programmer thinks differently about programming: but he doesn't think differently about solving problems -- on the contrary, his solutions tend to mirror his original and natural thoughts about the problem.

The world is full of "procedure manuals" that clearly and concisely tell us how to get things done. Plain English (and, more fully, our proposed Hybrid Programming Language) allows us to describe those procedures to our computers. Conveniently, efficiently, and -- most importantly -- naturally.
 
Last edited:

Sgraffite

Member
Jul 4, 2001
171
107
116
From an object-oriented perspective, I'm sure you are correct. But we find the whole object-oriented approach conceptually unintuitive and fundamentally flawed in a number of ways (see http://harmful.cat-v.org/software/OO_programming/why_oo_sucks for a nice summary). We are sworn against using it.

I realize you said you weren't interested in discussing issues related to natural language programming, but I think it important mention that my points regarding syntax would still stand, even comparing procedural Plain English with object-oriented JavaScript. Plain English syntax is (a) easier to think about, (b) easier to type, (c) easier to understand, and (d) easier to remember.

Since you are comparing on the basis of how the syntax looks for transparency's sake I feel like it is important to note that you are not try to make the javascript look nice.

Nouns (types) are one thing, verbs (routines) are another; the whole idea of hiding a verb inside a noun is linguistic nonsense. And the whole idea of asking an inanimate object (like a tire or a bike) to do something (like mount) is also nonsense.

The anonymous visitor is capable of mounting a tire to a bike as well, but I can't say it makes more sense than the inanimate object doing it.
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
Since you are comparing on the basis of how the syntax looks for transparency's sake I feel like it is important to note that you are not try to make the javascript look nice.

That's true: we were trying to make the JavaScript look as much like the Plain English version (ie, what we had in our minds to start off with) as possible. So help me out. Here's the Plain English version:

A story is a thing with a title, a prolog, some scenes, and an epilog.

And here's our (not-so-nice but functional) JavaScript version:

function Story() { this.title=[]; this.prolog=[]; this.scenes=[]; this.epilog=[]; }

What would a "nice" JavaScript version of this type definition look like?

The anonymous visitor is capable of mounting a tire to a bike as well, but I can't say it makes more sense than the inanimate object doing it.

I'm not sure I understand that statement. Are you really saying you can imagine a tire mounting itself to a bike as easily as you can imagine a person mounting a tire on a bike?

All imperative sentences have a subject, either explicit or implied. Imagine I'm sitting at dinner with my wife Sharon. I might say, "Sharon, please pass the salt." Or I might imply the subject (ie, the active agent) and simply say, "Please pass the salt."

Now in the procedural programming paradigm, the subject is almost always "the computer" and is almost always implied. So when I say, in a procedural language, "Add 2 and 3 giving a sum," I'm really saying, "Computer, add 2 and 3 giving a sum." Which is perfectly reasonable because the computer really is capable of adding two numbers and producing a sum.

Now let's get back to those bikes and tires. In the object-oriented paradigm, subjects are typically explicit but are often incapable of what is being asked of them.

1. tire.mount(bike) -- "Tire, mount yourself on the bike!"
2. bike.mount(tire) -- "Bike, mount the tire on yourself!"


In the procedural paradigm, on the other hand, the subject is typically implied but is presumed capable.

3. mount(tire,bike) -- "You there [implied subject, a person], mount the tire on the bike!"

The question is simply, Which representation is closest to the thought we're actually trying to convey? Obviously, the third one. And what syntax would be most appropriate for conveying that thought? I vote for:

Mount the tire on the bike.

Which is how that would be said in Plain English.
 
Last edited:

Sgraffite

Member
Jul 4, 2001
171
107
116
What would a "nice" JavaScript version of this type definition look like?

This is how I would have written it based on what the English version tells me:
Code:
Story.prototype
{
	title: '',
	prolog: '',
	scenes: [],
	epilog: ''
}


Now let's get back to those bikes and tires. In the object-oriented paradigm subjects are typically explicit but are often incapable of what is being asked of them.

1. tire.mount(bike) -- "Tire, mount yourself on the bike!"
2. bike.mount(tire) -- "Bike, mount the tire on yourself!"


In the procedural paradigm, on the other hand, the subject is typically implied but is presumed capable.

3. mount(tire,bike) -- "You there [implied subject, a person], mount the tire on the bike!"

The question is simply, Which representation is closest to the thought we're actually trying to convey? Obviously, the third one. And what syntax would be most appropriate for conveying that thought? I vote for:

Mount the tire on the bike.

Which is how that would be said in Plain English.

I didn't see an implied "who" and it is not me doing it so I considered it to be anonymous. You aren't saying "Bob, mount the tire on the bike." or mount(who,tire,bike) or who.mount(tire,bike) for example.
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
This is how I would have written it based on what the English version tells me:
Code:
Story.prototype
{
	title: '',
	prolog: '',
	scenes: [],
	epilog: ''
}

Okay, so now we've got your version above, and this one:

function Story() { this.title=[]; this.prolog=[]; this.scenes=[]; this.epilog=[]; }

And the Plain English version:

A story is a thing with a title, a prolog, some scenes, and an epilog.

I'm still going to argue that the Plain English version is syntactically preferable because it's:

(1) Easier to think about: English speakers (programmers and non-programmers alike) are well-practiced in translating their thoughts into English (and vice-versa); they've been doing it their whole lives;

(2) Easier to type: fewer special and shifted characters are required;

(3) Easier to understand: it's essentially the same as a comment one might write to explain the structure to someone else (yet it also compiles and runs!); and

(4) Easier to remember: it's just ordinary English with no special grammar or syntax.

I didn't see an implied "who" and it is not me doing it so I considered it to be anonymous. You aren't saying "Bob, mount the tire on the bike." or mount(who,tire,bike) or who.mount(tire,bike) for example.

Here is the definition of an imperative sentence from Wikipedia: "An imperative sentence or command tells someone to do something." So clearly a subject (ie, a "someone") is always required, but may be either explicit or implicit in the sentence itself. In procedural programs, as I mentioned before, the implied subject is typically the computer. In my dinner-time example, it was Sharon who was passing the salt. In the bike example, it's an unnamed person who presumably knows how to mount tires on bikes.

So let's compare "bike shop" models. Here are my Plain English types:

A tire is a thing...
A bike is a thing...


And here are my variables:

The tire is a tire.
The bike is a bike.


And here is how I define my routine:

To mount a tire on a bike...

And this is how I call that routine with those two variables (and the computer as the implied subject):

Mount the tire on the bike.

How would you code that up in object-oriented JavaScript?
 
Last edited:

Sgraffite

Member
Jul 4, 2001
171
107
116
So let's compare "bike shop" models. Here are my Plain English types:

A tire is a thing...
A bike is a thing...


And here are my variables:

The tire is a tire.
The bike is a bike.


And here is how I define my routine:

To mount a tire on a bike...

And this is how I call that routine with those two variables (and the computer as the implied subject):

Mount the tire on the bike.

How would you code that up in object-oriented JavaScript?

Skipping the definition of the object prototypes, possibly something like this;

Code:
var bike = new Bike();
var tire = new Tire();

bike.frontTire = tire;

Or maybe this way:
Code:
var bike = new Bike({
	frontTire: new Tire();
});
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
Skipping the definition of the object prototypes, possibly something like this;
Code:
var bike = new Bike();
var tire = new Tire();

bike.frontTire = tire;

Or maybe this way:
Code:
var bike = new Bike({
	frontTire: new Tire();
});

I don't see the verb "mount" in there anywhere. Seems like something important got lost in translation. On the other hand, we could simply say obvious stuff like this:

The front tire is a tire.
The bike is a bike.
Mount the front tire on the bike.


Seems to me that the Plain English version is significantly more intuitive. And more natural. Not to mention simpler, cleaner, more familiar, easier to type, easier to understand, easier to remember, easier to describe, easier to teach, etc.

How are objects and all that esoteric syntax helping me with this problem?
 
Last edited:

Sgraffite

Member
Jul 4, 2001
171
107
116
I don't see the verb "mount" in there anywhere. Seems like something important got lost in translation. On the other hand, we could simply say obvious stuff like this:

The front tire is a tire.
The bike is a bike.
Mount the front tire on the bike.


Seems to me that the Plain English version is significantly more intuitive. And more natural. Not to mention simpler, cleaner, more familiar, easier to type, easier to understand, easier to remember, easier to describe, easier to teach, etc.

You're correct I did skip the verb.

I could write it like this:
Code:
var bike = new Bike();
var tire = new Tire();

bike.mount(tire);
Or this:
Code:
var bike = new Bike();

bike.mount(new Tire());

You already said the inanimate object with a verb was awkward to you so this would be no different in this case.

How are objects and all that esoteric syntax helping me with this problem?
My guess is that they aren't at all in this use case, but it's also not a big deal either way.

The Plain English is intriguing to me as I like to tinker, but it seems best as a learning tool. What is it capable of and how can you write it to be reusable under dire circumstances?

For example say a client wants a game written in Plain English and they are nearly your worst nightmare and they require:
Drag and drop sprites that only allow dropping to specific container types.
Tooltips that work with the sprites.
Touch interface that works with tooltips and the sprites, including the drag and drop requirement.
Different layouts/sprites depending on who wants to "rebrand" the game.
Asynchronous calls that can wait on each other to avoid race conditions when they are dependent on each others' order of completion.
Different game mechanics based on the "rebrand" of the game, for example statistics are applied differently.

A team of programmers would be needed for this requirement to realistically meet the deadline.
 

crashtech

Lifer
Jan 4, 2013
10,669
2,273
146
As a virtual layman to the world of programming, one thing that seems evident from reading this entire thread is that those who have spent significant amounts of time learning their craft will not take kindly to something which seems to trivialize all that effort.
 

MagnusTheBrewer

IN MEMORIAM
Jun 19, 2004
24,122
1,594
126
As a virtual layman to the world of programming, one thing that seems evident from reading this entire thread is that those who have spent significant amounts of time learning their craft will not take kindly to something which seems to trivialize all that effort.

You're looking at it wrong. The language used to program means nothing. What you can accomplish with the programming is what's important.
 

crashtech

Lifer
Jan 4, 2013
10,669
2,273
146
You're looking at it wrong. The language used to program means nothing. What you can accomplish with the programming is what's important.
I don't as yet accept your authority to tell me how to look at things. Also, I never mentioned languages. My commentary is directed at the overall tone of the the thread, and meant to inject an outsider's view into the problems I see in the communication of ideas herein.
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
You're correct I did skip the verb.

I could write it like this:
Code:
var bike = new Bike();
var tire = new Tire();

bike.mount(tire);
Or this:
Code:
var bike = new Bike();

bike.mount(new Tire());

Why not "tire.mount(new Bike())" ? In other words, how did you decide the "mount" function should be hidden in the Bike rather than the Tire?

The Plain English is intriguing to me as I like to tinker, but it seems best as a learning tool. What is it capable of...

Plain English is a language much like Pascal or C, but without the special syntax. It supports simple types, record (struct) types, pointers, global and local variables (both static and dynamic), procedures, functions, etc. Pretty much whatever they can do, we can do.

To prove its usefulness to ourselves, we decided to write our whole Plain English development system in Plain English. So we wrote just enough of it to get us going in AIQ (a Pascal-like language that we had written a compiler for earlier) and then rewrote everything in Plain English itself. Then we beefed it up further, always using the Plain English version only. It now includes a unique interface, a simplified file manager, an elegant text editor, a hex dumper, the native-code-generating Plain English compiler/linker, and a wysiwyg page layout facility that we use for documention. The instruction manual is here:

www.osmosian.com/instructions.pdf

And the whole shebang, including source code, for Windows, is here:

www.osmosian.com/cal-3040.zip

Note that your virus detector may not like our zip file because our source files have no extensions (like ".txt" or something) and our executables don't have all the (unnecessary) pieces that a Microsoft compiler typically includes. It's clean though. And there's no installation program: it's all in one folder and doesn't change anything on your system (another thing that, ironically, the virus detectors find suspicious!).

...and how can you write it to be reusable under dire circumstances?

It's an experimental prototype, so we haven't had to worry about "dire circumstances" yet.

For example say a client wants a game written in Plain English and they are nearly your worst nightmare

We'd have to begin by creating the appropriate interface libraries (for DirectX or OpenGL or whatever). Right now, Plain English uses the standard Windows video stuff, and that's all. I've written PacMan like games with my younger son, but we're lucky to get 15 or 20 frames per second going that route.

...and they require: Drag and drop sprites that only allow dropping to specific container types.

No problem.

Tooltips that work with the sprites.

No problem.

Touch interface that works with tooltips and the sprites, including the drag and drop requirement.

We'd need to add a couple of events to our event processing; not a big deal, and not part of the compiler (all that kind of stuff is in a library called the Noodle). Right now Plain English only accepts keyboard and mouse-compatible input.

Different layouts/sprites depending on who wants to "rebrand" the game.

No problem.

Asynchronous calls that can wait on each other to avoid race conditions when they are dependent on each others' order of completion.

No problem. We've already got support for asynchronous sound and for multiple processes and threads in the Noodle.

Different game mechanics based on the "rebrand" of the game, for example statistics are applied differently.

I don't think that would be a problem.

A team of programmers would be needed for this requirement to realistically meet the deadline.

Possibly. I'd need more data to make any kind of realistic estimate.

For comparison purposes, it took my elder son and I a little less than six months to create our complete development system in Plain English: interface, file manager, editor, dumper, compiler/linker, and page-layout facility. 25,000 lines of code plus 120 pages of illustrated documentation. We worked together the whole time, side-by-side, on a single machine connected to two monitors. One of us would run the mouse (and direct the coding) while the other would enter the code on the keyboard. So every line was agreed to, and checked twice, before it was ever run. We'd never code more than a dozen or so lines without testing. And we started every day by deleting something: cleaning up, simplifying, finding better and shorter ways to do what we had done the day before.
 

Gerry Rzeppa

Member
Dec 13, 2013
195
1
76
www.osmosian.com
As a virtual layman to the world of programming, one thing that seems evident from reading this entire thread is that those who have spent significant amounts of time learning their craft will not take kindly to something which seems to trivialize all that effort.

Bingo! You should see what "boutique guitar-amp master builders" thought of this simplification (the video has a cute song on it):

https://www.kickstarter.com/projects/1335354839/banana-jack-amps-no-solder-all-tube-guitar-amp-kit

Or what "real" artists thought about this idea:

https://www.kickstarter.com/projects/1335354839/art-for-the-rest-of-us

It seems the devil wants everyone to be either a couch-potato or a prima-donna. It's lonely in the middle of the road, folks. Lonely in the middle.
 
Last edited:
Status
Not open for further replies.
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |