4 ms·
Natural language is ambiguous. Grammars for computer languages are designed to remove ambiguity. A natural language that is used to program a computer, too, wil
by throwaway55554 7y ago
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?
- The_rationalist 7y agoOnly 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
- SilasX 7y ago>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.
- _emacsomancer_ 7y agoPeople 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.)
- stevenyoung 7y ago'Only a subset'? What does that mean?
- The_rationalist 7y agoThat 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?
- ryl00 7y agoSounds like you are looking for Legal-ese.
- sbov 7y agoEven legal-ese can be ambiguous. If it weren't then courts would never overturn other courts' rulings.
- roywiggins 7y agoWell, lojban tried. https://en.wikipedia.org/wiki/Lojban https://en.wikipedia.org/wiki/Lojban
- SilasX 7y agoRuby 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.
- anamexis 7y agoOr my favorite example: that at one point, the Rails inflector would singularize "police" as "polouse."
- SilasX 7y agoEveryone 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."
- OJFord 7y ago'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.
- gridlockd 7y agoIt'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.
- munk-a 7y agoI 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`.