Tuesday, May 23, 2006

The concept of macros (LAP)

I have been thinking about Lisp, AJAX, and PHP recently. I know the link is tenuous if not non-existent, but bear with me. I think I could define some Javascript object types (think table/form objects) at runtime.

I think I would like the Lisp part of the code generator to take the following form...
(jdeftype jstring "String")
(jdeftype jbool "bool")
(jfunc myfunc "private void" "MyJsFunction" ((jstring strarg) (jbool boolarg))
(...commands that evaluate to JavaScript code...))

When it comes to passing arguments in I think a script tag may look like this...
script type="text/javascript" src="/lisp-bin/lispgen.lisp?genfunc=funcname&arg=value"

I think this would be useful for generating a table type object (think .net DataGrid) that I can create base types for through generated JavaScript. If I make it configurable enough I can define all of its behavior through src="..." arguments. I would then be able to invoke the object and use its methods and operators as defined by the Lisp output.

Once I manage to get an application stable I could generate the JavaScript and save it to a static file. At that point I could change all of the references of the generated lisp to the static JavaScript files. This may involve more interesting code...

I don't know if this will work. I don't know if it's even sensible. I do know it is something I should at least try.

Debug a general code generator that has many useful base object types and you should be able to build with those objects fairly quickly.

Shaun

1 comment:

Anonymous said...

I know you are truly from another planet. It is NOT normal to sit around and think about this stuff. I will find the real "Men in Black" and I will prove it to the world! You are slipping up on trying to be undercover for your planet. I'm not sure if you are some kind of spy or something....because normal humans do not think or talk like you and your language seems to only be understood by you. I will find out! ~Christie