Ted Leung writes... about notations for programming, databases, and otherwise...
Languages need a way to assimilate these paradigms in a way that makes them look seamless.
I would point out two of my favorite examples.
- One is Gemstone Smalltalk's OODB "select blocks" (PDF) which use a notation similar to Smalltalk blocks, but actually implements a declarative query language with structural access to graphs of collections of objects. Although it was very useful, the feature was never developed nearly as much as it could have been.
- The other is Symbolics' Statice OODB. Being based on Lisp, the syntax is much richer and fits more seamlessly into the host language. Unfortunately the Lisp market was already heading for the doldrums, and so a lot of the experience from Statice went into the C++ OODB rather than into Lisp. But apparently Statice is still available.
(defun transfer-between-accounts (from-name to-name amount)
(with-database (db *bank-pathname*)
(decf (account-balance (account-named from-name)) amount)
(incf (account-balance (account-named to-name)) amount)
(when (minusp (account-balance (account-named from-name)))
(error "Insufficient funds in ~A's account" from-name)))))