[parenscript-devel] Parenscript questions
Hi, I'm a Common Lisp newbie playing with Parenscript and WebGL. The source of 'http://learningwebgl.com/lessons/lesson01/index.html' contains a very simple example, with identifiers like gl.LEQUAL or gl.ARRAY_BUFFER. I can't figure out how to write those in Parenscript. I read the Symbol Conversion section of the manual ('http://common-lisp.net/project/parenscript/reference.html#section-symbolconv') but couldn't figure out what syntax to use. I ended up trying with a bigger hammer and modifying function encode-js-identifier in utils.lisp. That allowed me to write gl.*lequal* and get gl.LEQUAL. Is there a way to write these symbols without patching Parenscript? (BTW, modified function at 'https://gist.github.com/841088'). Many thanks, -- Miron Brezuleanu
Miron, It's ugly, but here's one way to do it: (ps (@ gl :*l-e-q-u-a-l)) => "gl.LEQUAL" The leading asterisk capitalizes the first letter; letters following dashes are capitalized. See the PS definition of the INNER-HTML macro for a simple way to encapsulate such a thing. Daniel On Wed, Feb 23, 2011 at 1:25 PM, Miron Brezuleanu <mbrezu@gmail.com> wrote:
Hi,
I'm a Common Lisp newbie playing with Parenscript and WebGL.
The source of 'http://learningwebgl.com/lessons/lesson01/index.html' contains a very simple example, with identifiers like gl.LEQUAL or gl.ARRAY_BUFFER. I can't figure out how to write those in Parenscript. I read the Symbol Conversion section of the manual (' http://common-lisp.net/project/parenscript/reference.html#section-symbolconv ') but couldn't figure out what syntax to use. I ended up trying with a bigger hammer and modifying function encode-js-identifier in utils.lisp. That allowed me to write gl.*lequal* and get gl.LEQUAL. Is there a way to write these symbols without patching Parenscript? (BTW, modified function at 'https://gist.github.com/841088').
Many thanks,
-- Miron Brezuleanu
_______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
The thing is that gl.LEQUAL is not an identifier: the '.' is the property access operator in JavaScript. So it's an expression. The Parenscript equivalent form for gl.LEQUAL would be (getprop gl '*lequal*) There are the '@' and 'chain' macros to make this more convenient: (@ gl *lequal*) If you enable case inverted symbols (upcoming PS release or repository version): (@ gl LEQUAL) Vladimir On Wed, Feb 23, 2011 at 3:25 PM, Miron Brezuleanu <mbrezu@gmail.com> wrote:
Hi,
I'm a Common Lisp newbie playing with Parenscript and WebGL.
The source of 'http://learningwebgl.com/lessons/lesson01/index.html' contains a very simple example, with identifiers like gl.LEQUAL or gl.ARRAY_BUFFER. I can't figure out how to write those in Parenscript. I read the Symbol Conversion section of the manual ('http://common-lisp.net/project/parenscript/reference.html#section-symbolconv') but couldn't figure out what syntax to use. I ended up trying with a bigger hammer and modifying function encode-js-identifier in utils.lisp. That allowed me to write gl.*lequal* and get gl.LEQUAL. Is there a way to write these symbols without patching Parenscript? (BTW, modified function at 'https://gist.github.com/841088').
Many thanks,
-- Miron Brezuleanu
_______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
participants (3)
-
Daniel Gackle
-
Miron Brezuleanu
-
Vladimir Sedach