Defining "public" functions 
Author Message
 Defining "public" functions

Hi, I'm just programming an IRC bot in scheme
( http://www.*-*-*.com/ ) and i'd like users to be able
to script the bot without having access to all the internal functions
(that means without being able to have the bot perform functions that
could make him quit, remove users from his lists, etc...) Im coding the
thing with guile, so if there are guile-specific ways to determine which
functions will be available and which not, it wont bother me. The only
thing i could make up was to write a custom eval function.

Any help ?

Manuel Odendahl

--
In the strict scientific sense we all feed on death -- even vegetarians.
                -- Spock, "Wolf in the Fold", stardate 3615.4



Sat, 02 Nov 2002 03:00:00 GMT  
 Defining "public" functions

Quote:
> Hi, I'm just programming an IRC bot in scheme
> ( http://www.*-*-*.com/ ) and i'd like users to be able
> to script the bot without having access to all the internal functions
> (that means without being able to have the bot perform functions that
> could make him quit, remove users from his lists, etc...) Im coding the
> thing with guile, so if there are guile-specific ways to determine which
> functions will be available and which not, it wont bother me. The only
> thing i could make up was to write a custom eval function.

> Any help ?

  Doesn't Guile provide a module/closed-off environment system?  I don't know,
however, if that's sufficient for your needs..

  Have you worried about other things like this?

(define evil-{*filter*}-hack
  (lambda ()
    (evil-{*filter*}-hack)))

  Using Guile, I think your best bet is probably to set an alarm and terminate
the user code after a given amount of time -- I don't know whether preemption
at the Scheme level is possible or not.

  I wrote a program recently that had to worry about this stuff, and I ended
up writing my own tiny Scheme dialect.  (admittedly, I also did that for the
challenge of doing it :) )

  Daniel

--
Hi, I'm a .signature virus!  Copy me into your .signature to help me spread!



Sat, 02 Nov 2002 03:00:00 GMT  
 Defining "public" functions

Quote:


> > Hi, I'm just programming an IRC bot in scheme
> > (http://rocloiso.planet-d.net/larve/weedy) and i'd like users to be able
> > to script the bot without having access to all the internal functions
> > (that means without being able to have the bot perform functions that
> > could make him quit, remove users from his lists, etc...) Im coding the
> > thing with guile, so if there are guile-specific ways to determine which
> > functions will be available and which not, it wont bother me. The only
> > thing i could make up was to write a custom eval function.

> > Any help ?

>   Doesn't Guile provide a module/closed-off environment system?  I don't know,
> however, if that's sufficient for your needs..

Yeah.  The problem is that you must import the root module, but if I
remember correctly Michael Livshin has posted a hack which allows you
to selectively import bindings.  Check the mailing list archive.

Jost



Sun, 03 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

2. Function names and "filter" function

3. Visibility and access to "public" attributes

4. Need an "exceptional" public VHDL project

5. "Go" tools - new public forum

6. Visibility and access to "public" attributes

7. Meaning of "Duplicate public name"

8. Public Domain PROTO: "Rotator"

9. "on public" problem (lame)

10. define "variable" word

11. Redesigning "define interface"

12. defining "|" as or in Poplog Prolog

 

 
Powered by phpBB® Forum Software