agile software development & services
Augmenting Smalltalk
with your own Control
Flow Syntax
www.10pines.com
Hernán Wilkinson
Twitter: @HernanWilkinson
Blog: objectmodels.blogspot.com
www.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?
@hernanwilkinson
Hernan.wilkinson@10pines.com
agile software development & services
info@10pines.com
www.10Pines.com
twitter: @10Pines
Argentina
Tel.: +54 (11) 6091-3125
Alem 896, 6
(1001) Buenos Aires

Augmenting Smalltalk Syntax

  • 1.
    agile software development& services Augmenting Smalltalk with your own Control Flow Syntax www.10pines.com Hernán Wilkinson Twitter: @HernanWilkinson Blog: objectmodels.blogspot.com www.10pines.com
  • 2.
    In linguistics, syntaxis 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
  • 3.
    In linguistics, grammaris 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
  • 4.
    How easy isto change the syntax? How easy is to change the grammar? Change
  • 5.
    Complexity = essential+ accidental Complexity
  • 6.
    Complexity = essential+ accidental Complexity We can not reduce this one
  • 7.
    Complexity = essential+ accidental Complexity We can not reduce this one We can definitely reduce this one
  • 8.
  • 9.
    One day, ina 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."
  • 11.
    “The biggest hitfor 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]”
  • 13.
    “… there weredeep 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”
  • 14.
  • 15.
    Closure Lisp Lambda Functions Algol-60Block & Lexicographic binding Scheme Closure
  • 21.
    “with full closuresyou can avoid control flow syntax”
  • 22.
  • 23.
  • 25.
  • 26.
  • 29.
  • 30.
  • 31.
  • 33.
  • 34.
  • 36.
  • 37.
  • 39.
  • 41.
  • 44.
  • 46.
  • 48.
    In how manyplaces is ZeroDevide handled? In how many places is SubscriptOutOfBounds handled?
  • 50.
  • 52.
    file will notclose if an exception signals before
  • 56.
  • 57.
  • 61.
    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!
  • 62.
  • 63.
    agile software development& services info@10pines.com www.10Pines.com twitter: @10Pines Argentina Tel.: +54 (11) 6091-3125 Alem 896, 6 (1001) Buenos Aires