Extended Type Design.

Benji Smith dlanguage at benjismith.net
Fri Mar 16 12:51:38 PDT 2007


Andrei Alexandrescu (See Website For Email) wrote:
> 
> Working in NLP myself, I totally disagree. Natural language is rife with 
> homonimy and synonimy, and we're all very, very happy with that. But in 
> this case we don't even have to go that far: "super" is an adjective 
> meaning primarily "of high grade or quality" and qualifies a noun. If 
> there's no noun, you don't know what is "of high grade or quality". It's 
> a fact, and we don't even blink.
> 
> Andrei

I've also worked in NLP quite a bit, but I don't think the constructs of 
natural languages are necessarily healthy in artificial languages.

Many natural language constructs are only distinguishable through 
contextual analysis awareness or sense disambiguation (anaphora 
resolution and prepositional phrase attachment are among the most 
difficult to disambiguate).

Natural languages rife with ambiguity may be easy for native speakers to 
disambiguate (thanks to the semantic model we develop during early 
childhood), but those ambiguities make it more difficult for adults to 
learn new languages.

I like artificial languages to be artificial. I like them to be concise 
and unambiguous. I like them to have context-free grammars free from 
left-recursion. I don't like the word "static" to mean one thing in one 
context and something else entirely in another context. I don't like 
keywords to contain punctuation marks. And I don't like phrasal nouns 
(like "super const" or the inevitable "super duper const").

Just like highly ambiguous natural languages are difficult for adults to 
learn, I think synonymy and homonimy make it more difficult for 
professional developers to learn a new programming language.

I used to write a lot of perl code, and the constructs it borrowed from 
natural language (synonymy, homonimy, anaphora, implied words, pronouns, 
etc) are some of the things that drove me away from the language toward 
languages with more explicit semantics (java, C#, python, d).

But that's just me. Not everyone will agree with my opinion, and if I'm 
not in the consensus, I'll concede. But there seem to be a lot of people 
who agree with me.

I reiterate: "const" and "readonly" are the way to go. (Methods which 
promise not to modify the values of their parameters should use 
"readonly" rather than "const" in their method signatures.)

--benji



More information about the Digitalmars-d mailing list