|
|
|
|
|
by taradinoc
2619 days ago
|
|
>Quasiquotation pretty much doesn't need to exist because of the ! sequence "operator" for splicing lists into lists and forms. Hmm... I guess I don't know everything quasiquoting is used for in Lisp, but in MDL and ZIL, segments don't really solve the problem that quasiquoting does when it comes to writing macros. That is, I usually want to use macros to generate code according to a template: <PRSI? ,FOO>
should become <==? ,PRSI ,FOO>
The way to write that macro is to call FORM to build the form: <DEFMAC PRSI? (X)
<FORM ==? ',PRSI .X>>
But if it's a complex block of code, and the blanks I want to fill in are deeply nested, the template quickly becomes unreadable, because every structure turns into a form, and every form turns into a call to FORM. |
|
As an example, consider the following possible implementation of PROG1 in terms of LET's implicit PROGN. They both evaluate a sequence of forms in order, but the first returns the value of the first form, and PROGN the last:
A MDL equivalent would be something like (though I admit I'm entirely going off documentation!): Without quasiquotation, the Lisp example would be (without capitalization this time---in Lisp symbols are auto-capitalized): I chose this example to demonstrate how sequences alleviate the pain of splicing things into the middle of things.Backtick is not used in MDL, right? And you're somewhat free to extend the MDL used in Zilf, right? You could get the best of both worlds by adding either a PREFORM type or an REBUILD form. For example:
or The semantics would be that a PREFORM would be evaluated like a LIST, but then it would CHTYPE to FORM. Or, a REBUILD is an FSUBR that expects a structure, and it maps EVAL over the elements of that structure.The macro would look like
I don't know all the consequences of this change to MDL, though.