Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Natural language is ambiguous. Grammars for computer languages are designed to remove ambiguity. A natural language that is used to program a computer, too, will have to remove ambiguity, thus only using a severely constricted subset of a natural language. Is it worth it beyond curiosity? If a person can't grok a computer language are they going to grok such a terse natural language?


Only a Subset of features of natural langage introduce ambiguities, equivocations, etc. It is perfectly doable to force one and only one meaning per keyword (just like do programming keywords already (if, while, etc), removing the ability to use coreferences, etc I would love to see a great constrained English, formal without the readability and expressivity loss of formal symbolic grammars / formal maths


>Only a Subset of features of natural langage introduce ambiguities, equivocations, et

I wish! People won't even use "literally" consistently, despite it existing to prevent you having to guess which sense a speaker means.

Edit: Toned down.


People love to pick on the intensive meaning of "literally", perhaps because it is more recent, but it's really not much different from the range of uses of "really", which also can mean both 'in fact, truly' as well as an intensifier sense like 'very'. E.g. "I was really shocked", "I was literally shocked" have similar ambiguities. Competent human speaker generally provide enough context that potential ambiguities aren't too problematic -- for other human beings, if not for machines.

Human languages are more ambiguous than you might imagine, and lexical things like 'what meaning of "literally" is the speaker using' are pretty tip-of-the-iceberg stuff. (Think about what "Every man wants to read some book" or "the girl saw the man with the binoculars" (can) mean.)



Sounds like you are looking for Legal-ese.


Even legal-ese can be ambiguous. If it weren't then courts would never overturn other courts' rulings.


'Only a subset'? What does that mean?


That means that natural language is not intrinsically ambiguous and fuzzy, and removing the features that cause ambiguities would create a Constrained natural language, far more clearer. Or is it the word Subset that you want me to explain?


'Remove ambiguity' means 'choose a meaning', which of course means non-zero% chance you're wrong.

Alternatively, as you said, use a non-ambiguous subset. But then it's no longer a natural language, I wouldn't mind betting they're all ambiguous.


I don't believe there is a natural grammar that is unambiguous, instead I think in the realm of computer languages it's more a process of creating a jargon set that relates to terms but explicitly overrides them with unambiguous meanings within the domain.

For instance `new Object` - we're all going to read that as "create a new object that hasn't existed before" but within english a `new Object` could also be an antique you happen to have recently acquired, so `new` could be comprehended to be an acquisition action - like copying an Object - rather than creating a new one... But in our fancy computer language jargon we have forever banished the "new to me" meaning from `new`.


It's not actually a "natural programming language", it's more of a snippet generator. The output is ordinary code and you still have to understand it.

I can see how this would be useful to quickly get the right incantation in certain verbose APIs, as opposed to copy-pasting code from API docs or Stackoverflow.


Ruby on Rails is designed to add it right back in.

"Cookies set? Oh, that must be the plural of Cooky" -> actually happened in live coding demonstration before.


Or my favorite example: that at one point, the Rails inflector would singularize "police" as "polouse."


Everyone once in a while a product manager will get familiar with the Django admin page of an app I'm working on and say something like "What? Why does it say Companys? Is there something wrong with the app?"

My response is always (some diplomatic, lay version of), "No, it's correctly refusing to involve us in the game of guessing how the framework developers modeled plurals."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: