Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Economy and Expressivity in Artificial Languages

Economy and Expressivity in Artificial Languages

Polyglot programmers often talk about expressiveness in the languages they use, but it seems a little vague. By borrowing the terms "expressivity" and "economy" from diachronic linguistics, you can compare languages in ways that seem more relevant than just talking about taste.

Presented at the QCon London Ruby Users Group Meeting on 7 March 2013.

Presented in shortened form (as a lightning talk) at Ancient City Ruby, 5 April 2013.

Damon Davison

March 07, 2013
Tweet

Other Decks in Programming

Transcript

  1. Natural languages are in a state of constant evolution. Speakers

    are constantly negotiating between Economy and Expressivity in everying ey say. Wi an artificial language, its designers decide e language’s Economy and Expressivity up front. Sunday, 10 March 13
  2. Economy ✦ Bias toward efficient processing wiout regard to meaning.

    ✦ Examples: ✦ It’s a fact, isn’t it? ➙ It’s a fact, innit? ✦ You had beer recognize it. ➙ You beer recognize. ✦ Berkshire Hunt ➙ Berk ✦ Coffeescript: elimination of ternary operator Sunday, 10 March 13
  3. Expressivity ✦ Bias toward richness in meaning wiout regard for

    efficiency in processing. ✦ Examples: ✦ Synonyms for “vomit” in English. (Count em!) ✦ Perl: ++$count; $count++ ✦ Ruby: ternary vs case/switch vs if...elsif...else vs nested if...else ✦ Ruby: yield Sunday, 10 March 13
  4. Grammaticalisation You need to tie two concepts togeer, and use

    existing words to do at. hād ‘state/quality’ (Old English) -hood e.g. motherhood Sunday, 10 March 13
  5. Grammaticalisation Phonological and Graphological Reduction Bill is going to go

    to college. Bill’s gonna go to college. else if elsif Sunday, 10 March 13
  6. Grammaticalisation Phonological and Graphological Reduction Bill is going to go

    to college. Bill’s gonna go to college. else if elsif But adding a new keyword is Expressivity. Sunday, 10 March 13
  7. yak shaving Any apparently useless activity which, by allowing you

    to overcome intermediate difficulties, allows you to solve a larger problem Lexicalisation You have an concept and you find a way to express it. This is basically what keywords are. Sunday, 10 March 13
  8. Economy Expressivity Economy and Expressivity Effects in Programming Languages few

    choices easier to learn many choices hard to learn Sunday, 10 March 13
  9. Economy Expressivity Economy and Expressivity Ruby and Perl few choices

    easier to learn many choices hard to learn Most programming languages Ruby Perl Sunday, 10 March 13
  10. Economy Expressivity Economy and Expressivity *Pyon Ruby Perl *PHP "There

    should be one—and preferably only one—obvious way to do it." (The Zen of Pyon) This way lies Chaos. “BDSM” languages There’s more an one way to do it (TMTOWTDI) Sunday, 10 March 13
  11. Coding by convention Convention overlays a kind of voluntary grammar

    to push a language toward Economy on e continuum. Rubyists know is from Ruby on Rails’ “convention over configuration” I haven’t been able to find anying developers in more economical languages can do to make eir code more expressive except to write more of it. Sunday, 10 March 13
  12. Thanks to D. Anderson at e Cambridge University for e

    handout I used to provide more English examples: hp://www.ling.cam.ac.uk/li7⁄grammatical_da.pdf “Yak shaving” definition from Wikipedia. All my colleagues at New Bamboo for eir constructive criticism of earlier versions of is talk. @allolex Sunday, 10 March 13