Scriptor / pharen

Lisp to PHP Compiler
http://pharen.org
BSD 3-Clause "New" or "Revised" License
218 stars 31 forks source link

Can't use more than one statement inside 'do' #20

Closed domdefelice closed 13 years ago

domdefelice commented 13 years ago

The following code won't compile:

 (defmacro with-database-connected (&body)
   "Executes `body' with database connected. Connection is closed after execution."
   '(do
      (require "open_db.php")
      ~@body
      (require "close_db.php")))

Error is: Fatal error: Call to a member function compile_statement() on a non-object in [...]/pharen/pharen.php on line 1353

Removing "require"s solves the problem. The only way I can use "do" is to put no more than one statement inside it.

Scriptor commented 13 years ago

Looks like the underlying issue is that it has trouble with non-splicing (~@) arguments after one. Eg: It'll compile if both require expressions come before ~@body. Working on this now.