Upload
hernan-wilkinson
View
215
Download
0
Embed Size (px)
Citation preview
agile software development & services
Augmenting Smalltalk with your own Control
Flow Syntax
www.10pines.com
Hernán WilkinsonTwitter: @HernanWilkinson
Blog: objectmodels.blogspot.comwww.10pines.com
In linguistics, syntax is the set of rules, principles, and processes that govern the structure of sentences in a given language, specifically word order. The term syntax is also used to refer to the study of such principles and processes. The goal of many syntacticians is to discover the syntactic rules common to all languages.
In mathematics, syntax refers to the rules governing the behavior of mathematical systems, such as formal languages used in logic. (See logical syntax.)
Syntax
In linguistics, grammar is the set of structural rules governing the composition of clauses, phrases, and words in any given natural language. The term refers also to the study of such rules, and this field includes morphology, syntax, and phonology, often complemented by phonetics, semantics, and pragmatics.
Grammar
How easy is to change the syntax?How easy is to change the grammar?
Change
Complexity = essential + accidental
Complexity
Complexity = essential + accidental
Complexity
We can not reduce this one
Complexity = essential + accidental
Complexity
We can not reduce this one
We can definitely reduce this one
Smalltalk Complexity
One day, in a typical PARC hallway bullsession, Ted Kaehler, Dan Ingalls, and I were standing around talking about programming languages. The subject of power came up and the two of them wondered how large a language one would have to make to get great power. With as much panache as I could muster, I asserted that you could define the "most powerful language in the world" in "a page of code." They said, "Put up or shut up."
“The biggest hit for me while at SAIL in late '69 was to really understand LISP. Of course, every student knew about car, cdr, and cons, but … no one had penetrated the mysteries of eval and apply. I could hardly believe how beautiful and wonderful the idea of LISP was [McCarthy 1960]”
“… there were deep flaws in its logical foundations. By this, I mean that the pure language was supposed to be based on functions, but its most important components--such as lambda expressions, quotes, and conds--were not functions at all, and instead were called special forms”
Closure
Closure
Lisp Lambda Functions Algol-60 Block & Lexicographic binding
Scheme Closure
“with full closures you can avoid control flow syntax”
Smalltalk Syntax
object message(and other minor stuff)
if
Closure
Does not compile!
Example
(Ruby)
(Ruby)
while
Does not compile!
Closure
Closure
Boolean or Closure?
Example
exceptions
Closure
Closure
Implicit condition… why?Implicit condition… why?
In how many places is ZeroDevide handled?In how many places is SubscriptOutOfBounds handled?
Resources
file will not close if an exception signals before
Syntatically solved again
DSL
Conclusions
▶ Less syntax more flexibility▶ Less syntax more grammar▶ More grammar easier to change,
to augment!▶ Less syntax makes the language
yours!▶ Don’t be afraid! Make your own
language!
Questions?
agile software development & services
twitter: @10Pines
ArgentinaTel.: +54 (11) 6091-3125Alem 896, 6(1001) Buenos Aires