Pinku,
Print the error message that was returned by eval>str to find out that
you are missing a vocabulary.
When I was using eval, I constructed the string using prepend to add a
`default' set of vocabularies. Be warned though; syntax is the
vocabulary you noticed being available at all times, this means that
any eval can USE: other vocabularies including io.
SYMBOL: eval-vocabs
"USING: kernel math prettyprint ;" " " append eval-vocabs set
: (eval-vocabs) ( str -- 'str ) eval-vocabs get prepend ;
{ } [ "1 1 + ." (eval-vocabs) eval>string print ] with-datastack drop
=> 2
Are you building an IRC bot? That's what I was using eval>str for.
To make the bot `safer' I used the with-datastack combinator to
produce a fresh stack between evaluations but defined words and loaded
vocabularies were remembered as they were in the code heap.
For isolation I used a non-persistent virtual machine to host the
factor instance with an OS image that did not contain sudo or even
root. To access the VM for installation or updates I used the
installation CD to boot with a root shell. I could sftp or scp new
bot code and reload that in factor while the limited OS was running
though. In order to maintain a persistent connection to IRC and
isolate the connection I had planed on using ZNC as an IRC frontend to
reduce join/quit messages upon bot reload and nickserv identification.
-Adam
On Fri, Oct 16, 2009 at 8:03 AM, Pinku Surana <[email protected]> wrote:
> Hi,
> I'd like to evaluate a string at runtime within an environment that uses
> additional vocabularies. The two words I found in the docs are eval( and
> eval>string. I guess both use some default vocabulary, but how can I add
> more without hacking the input string? Even better would be a way to
> construct an environment that has pre-loaded a set of vocabularies and
> denied permission to another set of vocabularies. For example, I'd like to
> disallow people from using anything in the io namespace.
> Also, I can't even make eval>string work. What's wrong with this?
> ( scratchpad ) "USING: kernel ; 1 1 + drop ;" eval>string
> :deprecations - show 6 deprecated word usages
> --- Data stack:
> "1: USING: kernel ; 1 1 + drop ;\n ^\nNo ..."
> ( scratchpad )
>
> Thanks,
> Pinku
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk