libera/#lisp - IRC Chatlog
Search
8:49:26
mrcom
Changed evaluation of arguments a bit; EVAL is back, and you must quote constant parameters; this is necessary to allow calculating non-constant values for the params.
17:45:46
thymage
Oh I ended up having to wrap some of the defun with (eval-when (:compile-toplevel :load-toplevel :execute) ...
17:47:44
mrcom
That eval-when effectively commented-out that piece of code. Everything in c-mera happens at read or compile time. Nothing at execute.
17:49:51
mrcom
Re-looking at the eval-when, I do see :compile; not sure what it was doing that affected the errors. Except... c-mera is picky about top-level forms.
17:50:45
thymage
But then I get an error and it says that the function is defined but not available.
17:52:44
mrcom
It's just not going to work well interactively. cm sets things up exactly as it wants, processes the lisp source form-by-form, and then spits out the results.
17:54:20
mrcom
(Code changes, submit job, pray it doesn't blow up 44 minutes into 45 minutes run-time.)
18:00:25
thymage
Hey I appreciate eval in this case even though some people want perfect code because I have deadlines and this program generation needs to make hundreds of C programs.
18:04:57
mrcom
EVAL or a roll-you-own equivalent is required when a macro actually processes the parameters passed to it.
18:06:24
thymage
Yeah, I was wondering what to use in place of eval when you've finished building with macros and want the result computed.
18:09:45
thymage
Ok, to begin with I have not only the base primitive types, but I also have every different kind of data structure.
18:10:23
thymage
See that? I need to basically parse some headers automatically to get definitions, add them to the product space list and generate structs that contain unique pairs of these data structures.
18:11:17
thymage
Plus, not only do I need all unique pairs, I need a product on the language grammar.
18:11:46
mrcom
Word of warning: If you get over a few 10s of k lines of generated code it might be slow.
18:12:57
mrcom
The issue is that the "loopy-types" macro puts everything *inside* a top-level form (a PROGN).
18:13:50
mrcom
It will blaze through 100s of K of top-level forms. But one lonnnnng form is sub-optimal.
18:20:18
mrcom
You can even have several _top-level_ invocations of LOOPY-TYPES (or equiv) in one source file.
18:21:47
mrcom
Just don't try calling loopy-types from another macro--that makes them non-top-level, and subject to optimization and other extra compile-time processing.
18:24:45
mrcom
Pedantic mode: A macro issues _one_ form. That can be an atom (a number, symbol, string, etc.), a structure or class instance, or a list.