Philosophical musings: interpreting models

Jim Little
Wed, 15 Sep 1999 01:05:34 -0600

Sorry for the late response -- I was gone all weekend.

Laurent Martelli wrote:
>   Jim> I agree that it's better than hardware-level semantics, but I
>   Jim> still think Lisp's semantics are very low-level.  They don't
>   Jim> relate to real world actions, only mathematical ones.  Here's
>   Jim> what I see as high level semantics:
>   Jim> . Dial a phone number . Print a document . Display a picture
>   Jim> . Calculate income tax etc
> I'm sorry to insist :-) but the examples that you give can be
> expressed very simply with the semantic of lisp :
>         (dial phone-number)
>         (print document a-printer)
>         (display picture display-device)
>         ;; note : it's the same as print actually
>         (calculate-income-tax salary)

Yes, but those aren't Lisp's semantics.  The Lisp compiler knows nothing
about dialing a phone number, etc.  All it knows is how to call a
function (plus a few other things).

> If a user wants to dial a phone number, he'll invoque the "dial"
> service and give it the number he wants to dial as a parameter. What's
> so low level in this ?

It's not low-level, but Lisp's semantics are.  Lisp doesn't think "I
need to dial a phone now" (high level) -- it thinks "I need to call a
function now" (low level).

There's lots and lots of advantages to having high-level language
semantics rather than high-level library semantics, and they're all
related to the compiler being able to do more.  Optomization,
interoperability, and platform-independence come to mind, but my
favorite is compile-time error checking.  In my mind, the more errors
you catch at compile time, the better, and a high-level language can do
that.  Compare the effects of a typo under each approach:

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!