[Prev][Next][Index][Thread]
OIL and Dylan
Hi,
Recently because of work, I learned i2
supply chain planner (SCP) product.
In SCP, there is an interactive scripting language
OIL (object interaction language).
I like the syntax very much. Maybe we can support
similar syntax in Dylan.
I think that everyone know how slot
reference works in Dylan.
(<=> is equivalent.) For getter,
A.B <=> B(A).
For setter,
A.B := C <=> B(A) := C <=> B-setter(C, A).
For the getter, it is the same as Dylan. For the
setter,
A.set_B(C) <=> set_B(A,C).
There is no A.B := C syntax in SCP.
In SCP, one of the reason which I like their
syntax because it is easier to write deep class
hierarchy.
For example, in SCP
(Expression A)
supply_chains.find("My supply
chain").plans.find("Actual plan").horizon.start
is equivalent to
(Expression B)
start(
horizon(
find(
plans(
find(supply_chains,
"My supply chain")
), "Actual plan")
)
)
In my opinion, Expression A is much easier to read
and write than Expression B.
In fact, it seems to me that, Expression A is not
allowed in Dylan.
QUESTION: More explicitly, can we define A.B(C)
is Dylan?
I think: Since Dylan uses method dispatch, we need
to define B(A,C) method. We can't define B(C) as
member function to class A.
If we need to write valid Dylan syntax, it will be
similar to Expression B.
In fact, Expression A can be understood by
listener if the following expressions
are equivalent.
A.B(C,...) <=> B.(A, C, ...).
I don't know how difficult it is to modify the
compiler to use this kind of syntax.
There are several points that I think we can make
Dylan more dynamic.
1. Has load-file("file_name.dylan").
I really like these features.
2. More dynamic to evaluate the Dylan codes.
For example,
define B = "foe";
define code = "A." & B & " := C;";
(Assume & is concatenating.)
evaluate(code) will yield
A.foe : = C;
This kind of feature appears in Perl.
Sent via Deja.com http://www.deja.com/
Before you buy.