Parenscript icon indicating copy to clipboard operation
Parenscript copied to clipboard

ES classes, arrow functions, and a bug. Oh My!

Open pjstirling opened this issue 6 years ago • 0 comments

2 Commits:

  1. A simple bug. lambda-wrap ends up with a lexical binding for *ps-gensym-counter* because the defvar appears later in the file.
  2. es-class and => are the more interesting second commit.

The new es-class parenscript form will output ecmascript classes with support for member/static-member assignment from within the body (some of which is post es-2015, but it only appears in the generated code if you use it)

(ps:ps
  (es-class HelloWorld ()
    (defun constructor ()
      (format t "hello?"))
    (setf id
	  (=> (x) x))
    (static
     (setf proto foo))))
class HelloWorld {
    constructor () {
        return format(true, 'hello?');
    }
    id = (x) => {
        return x;
    }
    static proto = foo
};

pjstirling avatar Jun 29 '18 14:06 pjstirling