scheme as a virtual machine – III

After experimenting with CPSCM, I have to drop it. The final now consists of two implementations: Chicken and Gambit.

For closures, CPSCM relies on the host language. It works well for Scheme, Lisp and JavaScript backends, but no luck for PHP.

function getMyFunc($a){
  return create_function('$b', 'print "a='.$a.', b=$b";');
}
$f1 = getMyFunc(1);
$f1(2);

The code above and a few tricks to emulate lambdas do not work in PHP 4. As I was told on Stackoverflow, “…some changes have been made starting with PHP 5.3, but even there you don’t have your expected variable scopes that would allow you to do what you have in your examples.”

http://stackoverflow.com/questions/4155254/anonymous-functions-lambdas-closures-in-php-4

Anyway, despite of dropping, I like CPSCM.

18.11.2010, update

The same problem is with Chicken. The final winner is Gambit.

2 Responses to “scheme as a virtual machine – III”

  1. sdfadsf Says:

    What about Guile?

    https://secure.wikimedia.org/wikipedia/en/wiki/GNU_Guile

  2. olpa Says:

    Guile does not fit to the requirements described in the part I:
    http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-i/

    In particular, Guile is not intended to create new backends.

Leave a Reply