Philosophical musings: interpreting models

Alaric Williams alaric@alaric-williams.com
Thu, 16 Sep 1999 09:49:02 +0100 (BST)


On Wed, 15 Sep 1999, Jim Little wrote:

> Lisp: (dial '555-=1212')  -- This is a library call with a string. 
> Compiles fine, dies at runtime.  BUGGY!
> 
> DSL: (dial '555-=1212')  -- This is a language keyword with compile-time
> checking.  Results in compile error.  SAFE!

BUT is the second example not still a function call - the function being
the tool used to add higher level constructs to a language - with a good
enough type check to assert the format of the number?

I mean, I personally would want to define a new class for phone numbers
that "made" them correct and provided easy access to the fields:

(dial (make-phone-number 'domestic "5551212"))

 - the domestic flag going in place of where an international prefix would
 - be

Now, the make-phone-number function has a type spec stating that the first
argument is either two numeric digits (specified with a regexp, or more
generally a predicate function of the argument itself) or the symbol
'domestic, then the second string is a series of digits.

In other words, with a good enough static typechecker, the compiler
doesn't need to be specially written to understand phone numbers. It's
desirable to make the language core fairly simple, then use that language
to write language extensions in a *compiler independent* way - making the
writing of compilers much simpler.

> 
> Jim
> 

ABW

---==========================[ http://www.alaric-williams.com/ ]============---

	Almost three thousand years ago, I was on the comittee
	who designed Christianity... but it took us nine hundred
	years to get it past the risk assessment subcomittee :-(

---=========[ alaric@alaric-williams.com ]==================================---