Natural Language Programming

Status
Not open for further replies.

RAOF

Ars Tribunus Militum
2,733
[url=http:/civis/viewtopic.php?p=26079337#p26079337:1bhd7xpa said:
Gerry Rzeppa[/url]":1bhd7xpa]
RAOF says: So if I write “Divide the screen's width by 3 inches giving the leftover space and a and a column count” I'll get incorrect answers, right?
If you said that, the compiler would attempt to generate the appropriate machine code to take the "the screen's width" (an existing global variable) and divide it by "3 inches" (automatically converted to 'twips', the internal measure for screen coordinates), assigning the integer result to "the leftover space" in the appropriate unit of measure (assuming you had defined such a variable earlier). It would, however, have trouble with the "and a and a" in your sentence, and would position the caret on that line in your source file with a message like "I was expecting a noun right about here but I found 'and' ". Once you removed the redundant "and a" and re-compiled, it would do the above and then put the remainer of the division into a newly-created local variable called "the column count" (in the appropriate unit of measure).
Right; your formal subset of English has none of the semantic content of English.

[url=http:/civis/viewtopic.php?p=26079337#p26079337:1bhd7xpa said:
Gerry Rzeppa[/url]":1bhd7xpa]
RAOF says: The natural-language interpretation of that is obvious and unambiguous, but you get it exactly wrong.
My wife says things to me all the time that are "obvious and unambiguous" to her, but I often misunderstand and have to ask for clarification. That's the nature of natural languages. The fact that we could write such a large and complex program, conveniently and efficiently, in English, however, makes it obvious that such misunderstandings are not a problem in actual practice.
But that's not actually engaging with my point - you're not writing a program in English, you're writing a program in a formal language where the keywords are English words. There are many well-formed English statements which are not well-formed statements in your NLPL, and statements which rely on the semantic content of English for correctness are (silently) not interpreted correctly.

Your compiler is not going to ask for clarification of “Divide the screen's width by 3 inches giving the leftover space and a column count”, but it's going to give the wrong result because your compiler is only aware of the syntactic content of that statement, not the semantics. This is roughly the reverse of what you want - I'd bet that you regularly make statements to your wife that aren't syntactically correct English but have clear semantic content, and she understands them fine.

The fact that you find it easy to write code in this language is not particularly surprising; you're clearly a competent programmer, and have thus already mastered what appears to be the hard part of programming - the complete and precise description required to get a dumb computer to do what you want.
 
ShuggyCoUk says: That's not how the status quo is overturned in science.
We didn't set out to overturn the status quo in science; we just wanted to see if we could conveniently and efficiently write a compiler in "sloppily-parsed" English, using techniques that appeared to be similar to what we observed in children learning to speak English. See my initial post.

ShuggyCoUk says: If you have compelling new evidence you formalise it and present it.
The compiler itself, and the associated documentation, is a formal as we care to get at this time. We're satisfied with the results, and continue to build on them.

ShuggyCoUk says: Saying "it's up to other people to show I'm right" rarely leads to the presumed end point.
I didn't say that. I said that if my observations are true, they will eventually have to be accounted for in other people's theories of the subject.

ShuggyCoUk says: Language construction in infants is obviously very hard to study (the ethical implications alone are enough to stymie most of the conventional experimental approaches) and bias in the set of subjects is, even to people working with many children, quite significant.
Indeed. Working with one's own children, as I have, is thus both emancipating and limiting. But I think the small fruits we've gleaned are pretty common across all children.

ShuggyCoUk says: Thinking your anecdotal experience is meaningful (regardless of the correctness of it) without significant critical appraisal of its limitations does you no favours.
I'm not sure what kind of favours you think we're looking for. We're simply presenting the results of a personal study in practical programming.
 
RAOF says: Right; your formal subset of English has none of the semantic content of English.
I wouldn't say it has no semantic content; the compiler fully understands the meaning of the types that have been explained to it in the context of the computing machine. For example, when I say "a box" in this context, I'm thinking of a thing with a left, top, right, and bottom coordinate, because that's how I defined "a box". And the compiler, when it sees that term, "thinks" the same thing.

RAOF says: But that's not actually engaging with my point - you're not writing a program in English, you're writing a program in a formal language where the keywords are English words.
You'd have to ask John Searle and his Chinese Room about that. I say, if it looks like English and reads like English and spell-checks like English and grammar-checks like English and has a Flesh-Kincaid reading level like other English language sentences, well, then it's English.

RAOF says: There are many well-formed English statements which are not well-formed statements in your NLPL, and statements which rely on the semantic content of English for correctness are (silently) not interpreted correctly.
One of the beauties of our approach is that you can "teach" the compiler to understand unusual, idiomatic, metaphorical and even malformed English statements, as well as standard English statements, just by coding up the appropriate routine headers.

RAOF says: Your compiler is not going to ask for clarification of “Divide the screen's width by 3 inches giving the leftover space and a column count”, but it's going to give the wrong result because your compiler is only aware of the syntactic content of that statement, not the semantics.
See above regarding semantics. If, for example, the units of measure don't match and appropriate conversion routines cannot be found, the compiler will object (as it should); I would argue that it is objecting on a semantic, not a syntactic, basis in such a case.

RAOF says: This is roughly the reverse of what you want - I'd bet that you regularly make statements to your wife that aren't syntactically correct English but have clear semantic content, and she understands them fine.
Again, see above. The same kind of thing can be accomplished with the compiler; it doesn't require either grammatical or spelling perfection.

RAOF says: The fact that you find it easy to write code in this language is not particularly surprising; you're clearly a competent programmer, and have thus already mastered what appears to be the hard part of programming - the complete and precise description required to get a dumb computer to do what you want.
Yes. And we've found it easier, in many cases, to teach others how to completely and precisely describe their problems when they can work in their native tongue, instead of learning a new language at the same time. The exceptions are those individuals who are mathematics-oriented and who have already acquired a degree of fluency in artificial languages. But that's a very small portion of the general population.
 

RAOF

Ars Tribunus Militum
2,733
[url=http:/civis/viewtopic.php?p=26085189#p26085189:34ic45ta said:
Gerry Rzeppa[/url]":34ic45ta]
RAOF says: Right; your formal subset of English has none of the semantic content of English.
I wouldn't say it has no semantic content; the compiler fully understands the meaning of the types that have been explained to it in the context of the computing machine. For example, when I say "a box" in this context, I'm thinking of a thing with a left, top, right, and bottom coordinate, because that's how I defined "a box". And the compiler, when it sees that term, "thinks" the same thing.

RAOF says: But that's not actually engaging with my point - you're not writing a program in English, you're writing a program in a formal language where the keywords are English words.
You'd have to ask John Searle and his Chinese Room about that. I say, if it looks like English and reads like English and spell-checks like English and grammar-checks like English and has a Flesh-Kincaid reading level like other English language sentences, well, then it's English.
I'd add if it writes like English to your list, and it doesn't. There are lots and lots of English statements that aren't well formed for your compiler, and, worse, there are English statements that are well formed for your compiler but mean something different.

It's not at the Chinese Room¹ level - I can ask it questions in English to which it will respond with obviously incorrect answers.

[url=http:/civis/viewtopic.php?p=26085189#p26085189:34ic45ta said:
Gerry Rzeppa[/url]":34ic45ta]
RAOF says: The fact that you find it easy to write code in this language is not particularly surprising; you're clearly a competent programmer, and have thus already mastered what appears to be the hard part of programming - the complete and precise description required to get a dumb computer to do what you want.
Yes. And we've found it easier, in many cases, to teach others how to completely and precisely describe their problems when they can work in their native tongue, instead of learning a new language at the same time. The exceptions are those individuals who are mathematics-oriented and who have already acquired a degree of fluency in artificial languages. But that's a very small portion of the general population.
That's quite interesting; are you doing any formal studies of this?

¹: I think Searle's Chinese Room is an obviously-flawed argument from motivated reasoning, but it doesn't apply here.
 
RAOF says: I'd add if it writes like English to your list, and it doesn't. There are lots and lots of English statements that aren't well formed for your compiler, and, worse, there are English statements that are well formed for your compiler but mean something different.
Ah, but it does write like English; and I should know, having written over 50,000 lines of the stuff. I'm not sure why this particular point is so difficult to get across. When I speak to my youngest son, I use a very small and specific subset of English that I know he'll understand -- but it's undoubtedly English that I'm speaking. It's the same when I talk to my compiler; I use a very small and specific subset of English that I know it will understand -- but it's undoubtedly English.

The level of understanding you appear to be describing simply doesn't exist, even among humans. "The place where I met my wife" is a well-formed but indecipherable English language phrase to you, since you don't have the necessary context to properly interpret it. And "the most enjoyable experience my wife and I have ever had" is another well-formed English language phrase, also indecipherable to you, but certainly open to more kinds of interpretation (and misinterpretation). Should we say, on the basis of such examples, that you don't understand English? or that I'm not thinking in English and writing in English because I'm consciously avoiding all such references in my remarks? I trow not, my friend.

RAOF says: It's not at the Chinese Room level - I can ask it questions in English to which it will respond with obviously incorrect answers.
Correct, it's not at the Chinese Room level -- yet. But it's way closer than, say, JavaScript, and has an architecture that allows for unlimited extension in the desired direction.

RAOF says: That's quite interesting; are you doing any formal studies of this?
Nothing formal; but both the software and the teaching techniques tend to improve with each child we instruct in the art and science of programming.
 

levine

Ars Tribunus Militum
1,986
ITT: programmers who are pretty sure that they're the next Lacan/Chomsky.
Yeah, that.

Gerry, you're making very big claims about your project, and attempting to substantiate them with effectively anecdotal evidence, often written in an extremely casual style that (frankly) reads like you're mildly schizophrenic. These two things are incompatible. If you want to make big claims, you need to provide rigorous and formal substantiation. If you don't want to do that, you need to walk back the scope of your claims.

It's a shame, because there is a kernel of interesting stuff in all this. It's just really difficult to separate from all the chaff.
 

MilleniX

Ars Tribunus Angusticlavius
8,141
Subscriptor++
[url=http:/civis/viewtopic.php?p=26088631#p26088631:1f5vpmhw said:
levine[/url]":1f5vpmhw]
ITT: programmers who are pretty sure that they're the next Lacan/Chomsky.
Yeah, that.

Gerry, you're making very big claims about your project, and attempting to substantiate them with effectively anecdotal evidence, often written in an extremely casual style that (frankly) reads like you're mildly schizophrenic. These two things are incompatible. If you want to make big claims, you need to provide rigorous and formal substantiation. If you don't want to do that, you need to walk back the scope of your claims.

It's a shame, because there is a kernel of interesting stuff in all this. It's just really difficult to separate from all the chaff.
I think that's way too harsh. The OP started with "Here's something cool that I built, maybe it'd be good for others or the field too". We pushed back hard on that speculation, demanding that it be treated as concrete claims. Let's treat it as the exploratory adventure that it pretty clearly is.
 

MilleniX

Ars Tribunus Angusticlavius
8,141
Subscriptor++
The level of understanding you appear to be describing simply doesn't exist, even among humans. "The place where I met my wife" is a well-formed but indecipherable English language phrase to you, since you don't have the necessary context to properly interpret it. And "the most enjoyable experience my wife and I have ever had" is another well-formed English language phrase, also indecipherable to you, but certainly open to more kinds of interpretation (and misinterpretation). Should we say, on the basis of such examples, that you don't understand English? or that I'm not thinking in English and writing in English because I'm consciously avoiding all such references in my remarks? I trow not, my friend.
I think you're understating the value of semantics. "The place where {you} met {your} wife" has a very clear meaning, even if the concrete location that it refers to is unknown to the listener. For instance, someone speaking to your wife could usefully say something like "Gerry said he'll meet you this evening where the two of you first met". The speaker still doesn't know the value of that variable, but expects that your wife will.

In the division example from above, any English speaker would recognize the specific roles (dividend, remainder) of the two output values requested by the meaning of the words used to label them, regardless of their position-derived syntax. The particular limitation exhibited in your compiler is that a phrase's position in an expression directly determines its semantics - you've implemented purely positional arguments, when linguistically one might expect labeled arguments. Human language can use words' individual meanings to overcome such confusion, but just naming a variable a particular way in a programming language doesn't change its subsequent interpretation (absent syntactic content of the name itself).

What would be really cool is if you could build your division operation to accurately understand signals like "leftover", "remainder", "how many X can fit", and so forth. Moreover, if that can be done in a semantically-aware fashion, where phrases like that are learned from earlier precise expressions that are interpreted accurately, rather than hard-coded, that would be cooler still.
 
It started off sounding like a cute little pet project and as the thread's wore on, it's become increasingly obvious that this is, at least for the folks who put it out there, being regarded as a serious DSL to do actual programmer-y things in.

Which is fine and all, but there's way too much hand-waving ("trust me, I've written 50 KLOCs") going on here.

The reason that we write in languages that don't try to close in on English is because it minimizes the impedance mismatch/uncanny valley between human languages and their messy semantics and computer languages and their formal semantics. It's been tried (hi, Applescript (and others)) and it is infuriating on a level that computer languages fail to be.
 
levine says: Gerry, you're making very big claims about your project...
If so, then I'm being misunderstood. All I'm claiming is that we were able to conveniently and efficiently write a native-code-generating compiler and integrated development environment (with a wysiwyg page layout facility for documentation) in a subset of English using a "sloppy" parsing algorithm.

levine says: ...and attempting to substantiate them with effectively anecdotal evidence...
I admit that my reports of the actual experience of writing the thing are anecdotal (albeit first-hand anecdotal) -- but what else could they be? The system itself is the objective evidence, and anyone who wants can use it to see for themselves, first hand, if they experience the same kind of convenience and efficiency we did.

levine says: ...often written in an extremely casual style that (frankly) reads like you're mildly schizophrenic.
Schizophrenic, huh? What do you think, Ger? Well, I don't know, Ger, I'll get back to you on that. Okay, Ger, thanks.

levine says: These two things are incompatible. If you want to make big claims, you need to provide rigorous and formal substantiation. If you don't want to do that, you need to walk back the scope of your claims.
Again, all I'm claiming is that we were able to conveniently and efficiently write a native-code-generating compiler and integrated development environment (with a wysiwyg page layout facility for documentation) in a subset of English using a "sloppy" parsing algorithm; everything else is mere observation.

levine says: It's a shame, because there is a kernel of interesting stuff in all this. It's just really difficult to separate from all the chaff.
Separating wheat from chaff is always a difficult process; I'm not even sure which parts of this thing are of lasting value and which aren't; which deserve further development and which are dead-ends. I have suspicions, of course, and some solid evidence in the form of the working prototype. But it's just a prototype -- something to be studied and developed further.
 
MilleniX says: I think that's way too harsh. The OP started with "Here's something cool that I built, maybe it'd be good for others or the field too". We pushed back hard on that speculation, demanding that it be treated as concrete claims. Let's treat it as the exploratory adventure that it pretty clearly is.
By golly, I think he's got it!
 
MilleniX says: I think you're understating the value of semantics. "The place where {you} met {your} wife" has a very clear meaning, even if the concrete location that it refers to is unknown to the listener. For instance, someone speaking to your wife could usefully say something like "Gerry said he'll meet you this evening where the two of you first met". The speaker still doesn't know the value of that variable, but expects that your wife will.
Curious example. I think a similar thing happens with the compiler when a programmer, unaware of the internal structure of a variable (like "the default console") makes use of it ('Write "Hello, World!" on the default console'). "The speaker doesn't know the value [ie, the details] of that variable, but expects that [the compiler] will." The question, it seems to me, isn't so much whether a statement has a clear meaning, but whether the listener (or compiler) has enough context to fully and correctly "internalize" that meaning.

Our definition for "understanding" is simply this: If someone or something does what I tell it to do, it has understood me. So when I tell my kid to write "Hello, World!" in the middle of a page, and he does, I assume that he has understood; likewise, when I tell the compiler to write "Hello, World!" in the middle of the screen, and it does, I draw the same conclusion.

MilleniX says: In the division example from above, any English speaker would recognize the specific roles (dividend, remainder) of the two output values requested by the meaning of the words used to label them, regardless of their position-derived syntax. The particular limitation exhibited in your compiler is that a phrase's position in an expression directly determines its semantics - you've implemented purely positional arguments, when linguistically one might expect labeled arguments. Human language can use words' individual meanings to overcome such confusion, but just naming a variable a particular way in a programming language doesn't change its subsequent interpretation (absent syntactic content of the name itself).
Not quite true; the compiler considers the semantic content of names because names in Plain English are typically of the form "article [optional adjectives] type-name" -- the required type-name on the end supplies the semantic content. If the programmer has defined "dividend" and "remainder" as different types of numbers, the compiler will make the proper distinction. And the order won't matter if the programmer has defined headers for both forms of the statement (this order-swapping will be automatic in the next release).

MilleniX says: What would be really cool is if you could build your division operation to accurately understand signals like "leftover", "remainder", "how many X can fit", and so forth. Moreover, if that can be done in a semantically-aware fashion, where phrases like that are learned from earlier precise expressions that are interpreted accurately, rather than hard-coded, that would be cooler still.
See immediately above, and consider these type definitions:

A quotient is a number.
A remainder is a number.
A leftover amount is a remainder.


In the context of these routine headers:

To divide a number by another number giving a quotient and a remainder:
To divide a number by another number giving a remainder and a quotient:


The programmer will now be properly understood when he says any of the following:

Divide the screen's width by 3 inches giving a quotient and a remainder.
Divide the screen's width by 3 inches giving a quotient and a leftover amount.
Divide the screen's width by 3 inches giving a leftover amount and a quotient.


And many similar statements (since, for example, "giving" can be replaced with equivalent prepositions like "yielding"). I'm not sure this is the ultimate solution to the problem; but it does work, and it's at the discretion of the programmer, not the compiler-writer (ie, it's not "hard coded").
 
jxl says: It started off sounding like a cute little pet project and as the thread's wore on, it's become increasingly obvious that this is, at least for the folks who put it out there, being regarded as a serious DSL to do actual programmer-y things in.
Yes. We write real-world programs in Plain English, and we use those programs to accomplish other real-world work. The most obvious example is the wysiwyg page editor that is included with the system and that was written entirely in Plain English; it was used -- instead of some other word-processing tool -- to produce the documentation for the system. It has since been used to write a number of illustrated books and training manuals (see, for example, http://www.someofthepartsbook.com and http://www.rhymingreader.com). Those are real-world products produced with a real-world page editor that was coded entirely in Plain English (which, in turn, was coded entirely in Plain English). Seems to me that constitutes "actual programmer-y things," with second- and third-generation offspring to boot!

jxl says: Which is fine and all, but there's way too much hand-waving ("trust me, I've written 50 KLOCs") going on here.
You can see -- and run -- the first 25,000 of those lines for yourself. Just download the prototype (http://www.osmosian.com/cal-3040.zip) and unzip (no installation necessary). Start with the "instructions.pdf" in the "documentation" directory and within ten pages you'll be viewing the source code and recompiling the whole shebang in itself. In less than three seconds on a bottom-of-the-line machine from Walmart. That's not "hand-waving"; that's tangible "proof of concept".

jxl says: The reason that we write in languages that don't try to close in on English is because it minimizes the impedance mismatch/uncanny valley between human languages and their messy semantics and computer languages and their formal semantics. It's been tried (hi, Applescript (and others)) and it is infuriating on a level that computer languages fail to be.
Infuriating to some, sure. But not necessarily to "the rest of us"! I recently had to convert a Plain English program (which I wrote with pleasure and ease) to HTML/CSS/JavaScript so it would run in a browser. Let me wave my hands and declaim, "That was infuriating!"
 
yakumo says: i poked around a little. feels a lot like inform 7, and I hate inform 7.
The feel is similar, I suspect, because in both cases you're writing English-language sentences. I think, however, that our approach is both more general and less complicated than Inform. But in both cases it's the programmer who ultimately determines which words, phrases, and sentences the program understands; these are adaptable systems; they "get to know you" and the way you like to express things as you use them more and more. Nevertheless, "no man having drunk old wine straightway desireth new: for he saith, The old is better," Luke 5:39. For those accustomed to traditional programming languages, it seems that natural language programming is an acquired taste.

yakumo says: kinda surprised to see shit like

Code:
to add a number to another number:
intel $8B8508000000. \ mov eax,[ebp+8] \ the number
intel $8B00. \ mov eax,[eax]
intel $8B9D0C000000. \ mov ebx,[ebp+12] \ the other number
intel $0103. \ add [ebx],eax


hardcoded in there.

At some point a compiler has to deal directly with the machine. Once that's done, however, it doesn't have to be given any more thought; a Plain English programmer would very rarely, if ever, code such stuff. And there's very little of it: all the machine code is restricted to the Noodle and Compiler files, and we only use about 25 of the hundreds of instructions available on a typical Intel chip.

But it does serve to illustrate our view that in the end, programs will be written more like math books: mostly natural language, with snippets of artificial syntax (and even graphics) where it's more convenient, appropriate, or -- as in this case -- necessary.
 

MilleniX

Ars Tribunus Angusticlavius
8,141
Subscriptor++
[url=http:/civis/viewtopic.php?p=26092091#p26092091:1gew1lhi said:
Gerry Rzeppa[/url]":1gew1lhi]
MilleniX says: I think you're understating the value of semantics. "The place where {you} met {your} wife" has a very clear meaning, even if the concrete location that it refers to is unknown to the listener. For instance, someone speaking to your wife could usefully say something like "Gerry said he'll meet you this evening where the two of you first met". The speaker still doesn't know the value of that variable, but expects that your wife will.
Curious example. I think a similar thing happens with the compiler when a programmer, unaware of the internal structure of a variable (like "the default console") makes use of it ('Write "Hello, World!" on the default console'). "The speaker doesn't know the value [ie, the details] of that variable, but expects that [the compiler] will." The question, it seems to me, isn't so much whether a statement has a clear meaning, but whether the listener (or compiler) has enough context to fully and correctly "internalize" that meaning.
It's not about internal structure, it's about a closure over an unbound variable.

The speaker saying "the default console" is referring to a particular entity that they know about, and will recognize immediately whether it's been interpreted correctly. The variable is bound to a particular value in the speaker's mind.

If one spouse remembers a different initial meeting place than the other and the two people end up missing each other, the speaker has no grounds on which to determine that one of them was wrong. The speaker has no binding for that variable, they just have a name that they expect to be meaningful to the listeners.

MilleniX says: In the division example from above, any English speaker would recognize the specific roles (dividend, remainder) of the two output values requested by the meaning of the words used to label them, regardless of their position-derived syntax. The particular limitation exhibited in your compiler is that a phrase's position in an expression directly determines its semantics - you've implemented purely positional arguments, when linguistically one might expect labeled arguments. Human language can use words' individual meanings to overcome such confusion, but just naming a variable a particular way in a programming language doesn't change its subsequent interpretation (absent syntactic content of the name itself).
Not quite true; the compiler considers the semantic content of names because names in Plain English are typically of the form "article [optional adjectives] type-name" -- the required type-name on the end supplies the semantic content. If the programmer has defined "dividend" and "remainder" as different types of numbers, the compiler will make the proper distinction. And the order won't matter if the programmer has defined headers for both forms of the statement (this order-swapping will be automatic in the next release).

MilleniX says: What would be really cool is if you could build your division operation to accurately understand signals like "leftover", "remainder", "how many X can fit", and so forth. Moreover, if that can be done in a semantically-aware fashion, where phrases like that are learned from earlier precise expressions that are interpreted accurately, rather than hard-coded, that would be cooler still.
See immediately above, and consider these type definitions:

A quotient is a number.
A remainder is a number.
A leftover amount is a remainder.


In the context of these routine headers:

To divide a number by another number giving a quotient and a remainder:
To divide a number by another number giving a remainder and a quotient:


The programmer will now be properly understood when he says any of the following:

Divide the screen's width by 3 inches giving a quotient and a remainder.
Divide the screen's width by 3 inches giving a quotient and a leftover amount.
Divide the screen's width by 3 inches giving a leftover amount and a quotient.


And many similar statements (since, for example, "giving" can be replaced with equivalent prepositions like "yielding"). I'm not sure this is the ultimate solution to the problem; but it does work, and it's at the discretion of the programmer, not the compiler-writer (ie, it's not "hard coded").
The ability of your compiler to elaborate on your syntax to address semantic blindness is helpful. At the call sites, it's a different take on named (vs positional) arguments, using their distinct types in place of explicit names. It's still a syntactic workaround of the fact that your compiler doesn't know anything about the programmer's intended semantics, though.

In general, I think using the name of the type of a one-of-a-kind object as the object's name is distinctive, and intriguingly innovative. In as much as naming things well is hard, and this avoids the need to name 'dummy objects', it stands well as a new design. Many languages have conventions for naming one-off things, like "Message msg" or "x : xs = X", but I don't know of any that eschew the need to label entirely.
 
MilleniX says: It's not about internal structure, it's about a closure over an unbound variable.

The speaker saying "the default console" is referring to a particular entity that they know about, and will recognize immediately whether it's been interpreted correctly. The variable is bound to a particular value in the speaker's mind.

If one spouse remembers a different initial meeting place than the other and the two people end up missing each other, the speaker has no grounds on which to determine that one of them was wrong. The speaker has no binding for that variable, they just have a name that they expect to be meaningful to the listeners.
I'm (obviously!) not quite sure what you're getting at here. Practically speaking, it seems to me, all conversation is a trial-and-error kind of thing: you say something you hope is explicit and unambiguous enough, and in response get (a) an expected response, or (b) an unexpected response based on a misinterpretation of your statement, or (c) an explicit query asking for clarification. The same three things happen when programming in Plain English (or any language, for that matter).

MilleniX says: The ability of your compiler to elaborate on your syntax to address semantic blindness is helpful. At the call sites, it's a different take on named (vs positional) arguments, using their distinct types in place of explicit names. It's still a syntactic workaround of the fact that your compiler doesn't know anything about the programmer's intended semantics, though.
I would say "nearsightedness" rather than "blindness". The compiler does know something of the programmer's intended semantics because the programmer enters not only imperative commands but type definitions and variable definitions as well; it is within the context of these latter two that the imperative commands are semantically interpreted. For example, when the programmer defines a type (polygon) by saying:

A polygon is a thing with some vertices.

he's providing an agreed-upon context for future conversation; and the compiler (as well as the programmer) now think of "a thing with some vertices" when the word "polygon" is used. But more: the compiler will also include in its understanding everything it knows about "things," in general, as well: that they can be added to and removed from lists, can be sorted, etc.

MilleniX says: In general, I think using the name of the type of a one-of-a-kind object as the object's name is distinctive, and intriguingly innovative. In as much as naming things well is hard, and this avoids the need to name 'dummy objects', it stands well as a new design. Many languages have conventions for naming one-off things, like "Message msg" or "x : xs = X", but I don't know of any that eschew the need to label entirely.
The idea originated with the all-too-obvious (and therefore overlooked) fact that most of the objects we use in everyday life do not have proper names: the chair, this keyboard, my shoes; and that we typically refer to such things using a definite article (the, this, my), optional adjectives (big, black, left), and the generic noun (chair, keyboard, shoes). The "naming convention" in our compiler attempts to bring this grand human tradition into the world of machine programming.

Had computers been invented by philosophers rather than mathematicians, I think this would have been common practice from the start. Which, incidently, explains some of the other unusual design choices we made in the implementation of our prototype. The lack of support for floating-point numbers, for example: when attempting to build a machine that understands imperative commands at the level of a three-year-old child, there is obviously no need for anything but integers (since a typical three-year-old knows nothing of floating-point representation).
 

MilleniX

Ars Tribunus Angusticlavius
8,141
Subscriptor++
MilleniX":1cj0ap2c said:
It's not about internal structure, it's about a closure over an unbound variable.

The speaker saying "the default console" is referring to a particular entity that they know about, and will recognize immediately whether it's been interpreted correctly. The variable is bound to a particular value in the speaker's mind.

If one spouse remembers a different initial meeting place than the other and the two people end up missing each other, the speaker has no grounds on which to determine that one of them was wrong. The speaker has no binding for that variable, they just have a name that they expect to be meaningful to the listeners.
I'm (obviously!) not quite sure what you're getting at here. Practically speaking, it seems to me, all conversation is a trial-and-error kind of thing: you say something you hope is explicit and unambiguous enough, and in response get (a) an expected response, or (b) an unexpected response based on a misinterpretation of your statement, or (c) an explicit query asking for clarification. The same three things happen when programming in Plain English (or any language, for that matter).
In existing formally specified programming languages, case (b) does not exist [1]. Given a program that's well-formed according to the specification (i.e. we're not in case c), a response may not be what the programmer intended, but application of the specification will always, definitively, tell you what you should normatively expect. And, for our purposes, a particular compiler/interpreter suffices as a specification.

[1] Leaving aside stupid exceptions, like undefined behavior in C and C++, and compiler/interpreter/system library implementation bugs
 
MilleniX says: In existing formally specified programming languages, case (b) does not exist. Given a program that's well-formed according to the specification (i.e. we're not in case c), a response may not be what the programmer intended, but application of the specification will always, definitively, tell you what you should normatively expect. And, for our purposes, a particular compiler/interpreter suffices as a specification.
Yes, you're right, of course. But on those terms case (b) never occurs in Plain English either (since it is, after all, a completely specified and deterministic system).
 
ShuggyCoUk says: Achieving [complete specification of Plain English] is surprisingly hard. As an exercise I suggest writing a program that attempts to generate all legal Plain English programs (from a restricted alphabet of symbols and types) with deliberate use of the same type, or using the same symbol/type names.
Hard to do as you suggest, no doubt, since each Plain English type, variable, and routine definition increases the range of succeeding definitions. It may, in fact, be impossible. But it's not hard to see that our compiler will give one and only one interpretation to each and every sentence in the source code supplied to it, and that that interpretation can be precisely predicted by anyone who understands the compiler's algorithm. All I meant by "completely specified" in my previous post was, "everything the compiler can do is precisely defined by its code; it never acts randomly or unpredictably". Which was all I needed to say to eliminate case (b) above.

I suspect you're picturing a static "language definition" of some sort to which the compiler is supposed to conform, as with traditional programming languages. The problem with that approach is that natural languages cannot be fully described in that way. So we must, in the end, be content with each compiler (plus the current application's source code) being its own definition. A scary thought, I'm sure, for the mathematically minded among us. But unavoidable, I think, if we intend to "grow" systems that understand us as our fellows do. (After all, our fellows don't come with "complete specifications," but we manage to work things out.) I picture the compilers of the future chock-full of all sorts of ad hoc and specialized algorithms, just as our human brains appear to be. Our compiler is something like that now, and I'm pretty sure that Inform 7 and Wolfram's Alpha and Apple's SIRI are rapidly progressing along a similar path.

Keep in mind also that we're picturing the programs of the future being written like more like math books: mostly natural language with snippets of specialized syntax -- and even graphical representations -- as necessary and convenient. So we're not decrying languages that are small and precise and can be completely specified, we're just trying to get them where they belong.
 

ShuggyCoUk

Ars Legatus Legionis
10,388
Subscriptor++
But it's not hard to see that our compiler will give one and only one interpretation to each and every sentence in the source code supplied to it, and that that interpretation can be precisely predicted by anyone who understands the compiler's algorithm.

Do you use a hash table anywhere in your system. Do you ever rely on the ordering of elements within said hashtable for resolution of ambiguity. That's just one example of where it can crop up. Another is if the ordering of symbols in the file makes a difference (if there is no requirement for this e.g. illegal forward declarations).

*what the compiler does* is a very poor specification, as c and C++ programmers have been fighting with ever since...
 
ShuggyCoUk says: Do you use a hash table anywhere in your system.
Yes, but it's completely deterministic, ie, the same input always hashes the same way.

ShuggyCoUk says: Do you ever rely on the ordering of elements within said hashtable for resolution of ambiguity.
Yes, the first item found is selected. But which item will be the first found is completely predictable.

ShuggyCoUk says: Another is if the ordering of symbols in the file makes a difference (if there is no requirement for this e.g. illegal forward declarations).
There are very few restrictions regarding the ordering of symbols in Plain English, but that ordering will affect the order of items in the hash table and thus the interpretation of the code. But again, it's completely deterministic and predictable.

ShuggyCoUk says: *what the compiler does* is a very poor specification, as c and C++ programmers have been fighting with ever since...
Agreed. Yet it seems like something we're all going to have to learn to deal with (as we have learned to deal with it when communicating with other people).

I think we need to broaden our definition of the term "programming language". For example, I think of Google -- all of it -- as one great big programming language: one of those partly-visual-click-on-this-and-that, partly-textual-put-a-little-script-here-and-there languages. It lets the average person write and run meaningful programs with little or no training. "Who killed Martin Luther King?" and "Convert 300 euros to dollars" and 'click (on Google Maps), click (on source) "Bangor, ME", click (on destination) "Los Angeles" ' are all "source code" to the Google compiler/interpreter, and all of them produce meaningful results. Yet there is no formal definition, no complete specification for Google; no way to generate a list of all of the valid commands and queries. When the interpretation is unclear, it makes suggestions and/or presents multiple results; sometimes it misunderstands and produces unexpected or erroneous results. But "the rest of us" are okay with this poorly specified, incompletely-defined, just-plain-sloppy programming language; in fact, we love the thing. Because it works. And because it works the way we're used to working.
 

ShuggyCoUk

Ars Legatus Legionis
10,388
Subscriptor++
Whilst I can at least accept the possibility of debating the validity of "deterministic compiler as specification" I take issue with "predictability when it depend on the hashcode". That's not predictable unless your hash is miserable.

I also can't imagine people would appreciate their programs changing behaviour/breaking due to someone switching the hash table addressing between open and closed.

For little projects it's really no big deal, but there's a reason people like solid specs for vast programs with long lives. Perfectly reasonable to state that's not the target for your language though.
 
ShuggyCoUk says: Whilst I can at least accept the possibility of debating the validity of "deterministic compiler as specification" I take issue with "predictability when it depends on the hashcode". That's not predictable unless your hash is miserable.
The hash routine we use is a Plain English version of the DJB2 algorithm. It works well for both our compiler/IDE (which can re-compile itself -- 25,000 lines of Plain English code -- in less than three seconds on a bottom-of-the-line machine from Walmart), and for our spell-checker (which can check a hundred page document against our 64,000-word lexicon just as fast). And it's completely deterministic; it works the same every time.

ShuggyCoUk says: I also can't imagine people would appreciate their programs changing behaviour/breaking due to someone switching the hash table addressing between open and closed.
It's highly unlikely that a Plain English program's behavior would be affected by such a thing. Keep in mind that all our compiler really does is match strings of literal words and types (gleaned from imperative statements) to corresponding strings of literal words and types (gleaned from routine headers).

ShuggyCoUk says: For little projects it's really no big deal, but there's a reason people like solid specs for vast programs with long lives. Perfectly reasonable to state that's not the target for your language though.
Our IDE includes a unique desktop with our own tabs, menus, dialogs, and palettes; a simplified file manager; an elegant text editor with incremental find; a handy hexadecimal dumper; a full-featured wysiwyg page layout facility; and a native-code-generating compiler/linker that positions you on the offending line when an error is encountered; and it's been in use now for nearly eight years (across five different versions of Windows without modification). I think that qualifies as something more than a "short-lived little project". Granted, 25,000 lines isn't much compared to Windows XP or healthcare.gov -- but we all know from projects such as Wirth's Oberon (http://www.amazon.com/dp/0201544288) and studies such as VPRI's (http://www.vpri.org/pdf/tr2007008_steps.pdf) that those systems are mostly bloat.
 
Status
Not open for further replies.