[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple polymorphism / multi-methods
On Apr 13, 6:38pm, Jecel Mattos Assumpcao Jr wrote:
} > This is one thing I was discussing with a Smalltalk hacker a couple
} >of days ago. One of the really beautifull things about Lisp and
} >Lisp-like things (assembly language is the only non-Lisp derived
} >language that also has this property) is that program is data and data
} >is program.
}
} Actually machine language ( and not in all OSs or machines ), not assembly
} has this property. Back in 1984 I designed ( but never tested ) a
Michael Richardson <mcr@Sandelman.OCUnix.On.Ca> writes:
} The thing that lets you get away with data<->code in Lisp is that
} there is basically only your one datatype. The pair. There is
} essentially no syntax compared to smalltalk, and things like
} 'operators' and 'keyword messages' just don't exist.
} In order to build a parser that could parse code (which was in this
} case, simply data) the right way would be if it assumed some model of
} the operators, etc... You couldn't implement your own language that had
} different semantics.
Languages that can be expressed in themselves (like Lisp) are usually
called "self-embedding". Another language that has this property is
Prolog.
In Prolog, everything is a term, but I find Prolog's terms richer than
Lisp's lists.
Prolog includes an extensible parser that lets you declare new
operators. It is very easy to make up a new "language" by declaring
suitable operators and using them as keywords.
Of course Prolog doesn't really offer you a free lunch, and some
pathological cases can arise where the operators allow ambiguous
parsing. These cases, however, do not arise in practice.
I can provide more info on this matter if there is interest.
-- Joaquim