[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
s-exprs + prototypes
The reason I was asking about s-exprs:
I'm toying with an object system for a Self-like prototype language
using s-exprs as the syntax.
The syntax for method calls is not prefix, it is (receiver selector
..args..).
There are at least three reasons for this.
1. Binary operators become infix naturally: (1 + 2)
2. Cascades:
I find
(((data sort) merge x) filter y)
more natural to read and write than
(filter (merge (sort data) x) y)
A preference that could just be due to my greater time with OOP instead
of FP.
3. Operations and their arguments can be easily separated from the
receiver and applied to other objects or collections of objects, much
like mapcar but with a message instead of a lambda.
> ('(1 2 3) mapmsg '(+ 20))
(21 22 23)
Perhaps some lispers might find this not the "right way"..
Interested in opinions.
--
--- james mccartney james@audiosynth.com <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language for
MacOS X.