[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Restricting eval

From: Panicz Maciej Godek
Subject: Restricting eval
Date: Sat, 30 Nov 2013 21:26:35 +0100

I am still working on the implementation
of Chess in Scheme that I mentioned before.

For now, the most important part is to provideĀ 
a language to describe rules of board games.
Until recently, the descriptions were all
pattern-based, which was a rather natural
approach, but it turned out that it was limited
too, because it didn't allow me to specify
e.g. that neither a king nor a rook was allowed
to move before castling, or that the captured
pawn's move must have been made in a previous
turn in case of the en-passent capture.

So I decided provide an environment where
some arbitrary Scheme code (specified in the
ruleset) could be executed, and where certainĀ 
functions would reside that could be called
by that code.

And now I have a decision to make. One option
would be to create my own, restricted meta-circular
evaluator for a minimalistic subset of Scheme
(or use one that is already available). But I think
that it would be reinventing the wheel which is
already present in Guile Scheme, and is called
"eval" (or perhaps even "compile").

And hence my question: is there any way to restrict
the execution environment of eval, e.g. to specify
which symbols should be available? (For security
reasons, I wouldn't want functions like "system"
or "exit" to be present in that environment)

Or perhaps there's some better way to do that?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]