[plt-scheme] collective eval

From: DTNOIZR (dtnoizerz58 at yandex.ru)
Date: Tue Nov 24 05:34:02 EST 2009

I wanna launch simple collective scheme interpreter
it is not finished - I need to create collective "EVAL"
interpreter have database (PostgreSQL) with functions definitions - strings like "(define f ...)"
users can call functions via web
some fuctions allowed to some users, some fuctions not allowed to some users
user can call only functions, which allowed to him
also, definition of allowed function can use definition of function that not allowed
also, new functions will appear very often, may be every second, when billion people will code (in my dream of future)
I need some pretty mechanism to add new functions to EVAL ("live coding")

how to wrote eval with this possibilities and restrictions?
I wrote some ugly sandbox where I can put ALL functions in one "module"
and include this module with restrictions to every eval for each user
(every set of restrictions - by its own "eval" fucntion)

here is my ugly code

;;module with all fucntions from database
(define ALL `(module ALL scheme (provide ...) ...)) 

;;EVAL with restrictions
(define EVAL-with-restrictions (make-module-evaluator `(module m scheme))
;;attach module ALL to EVAL
;;"only-in" make restrictions for user
(EVAL-with-restrictions `(require (only-in 'ALL f1 f2 f3 ... fn))

this is ugly because if I wanna attach one new function - I have to change the "ALL" value 
and create EVAL-with-restrictions again - this is must be slow because of billion of fucntions and users


Posted on the users mailing list.