Hacker News new | past | comments | ask | show | jobs | submit login

Many programming languages have naming conventions which act as a sort of inflection. Classes may always be capitalized, whereas functions and methods not be. Constants might be written in all caps, while private variables might be preceded by an underscore.

You can draw comparisons between natural language and programming languages just fine. Maybe functions are like verbs and arguments are like the subject. And maybe partial application of a function is like having an intransitive verb. Maybe a decorator is like an adverb and a type constraint is like an adjective.

In general, though, I think the metaphor about programming languages is wrong: programming languages are instructions, not really languages. A programming language should be easy to read out of order more like a magazine than a novel, it should be possible to get a general grasp of what it's doing by glancing at the code, and the code should eliminate ambiguity and uncertainty. Natural languages don't work that way; they're repetitive, vague, and rely on context (social and otherwise).




Exactly. The only 'natural language' exercise I can think of that compares with programming is the drafting of legal documents, which also aim to specify something precisely according to a very particular set of definitions.

Unsurprisingly, legal documents have a reputation for being at least as difficult to read as some code.

Natural language, designed for human communication, is, by its nature, unsuitable for precise definition, and a precise language is also unsuitable for human communication.

It really makes sense once you realize how much conversation and prose depend on puns, allegory, allusion, symbols, context, emotion, and so on. All of which are hostile to stating a thing as exactly as possible.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: