[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reply to DESTRUCTURING considered harmfull.

The only place I have seen destructuring used is in the processing
S-EXPRESSION's which have been produced by a READER or PARSER. The
three most common applications being in lisp macros, various
lisp-style assemblers, and the alpha-conversion (first-pass) of lisp

For these purely syntactical uses the SYNTACTIC destructuring
of DEFMACRO and [maclisp] LET is great, made-to-order one might say.
The other kind of destructuring is SEMANTIC, e.g. in "(SETF <FOO> X)"
one must look at "<FOO>" as a lisp program, and know about
order-of-evaluation and other considerations. [Although the LispM
design decision was to treat SETF purely syntactically for simplicity.]

A problem with the semantic destructuring is that one can express
arbitrary pattern-matching in it, and that is known to loose.

* Let us look at the syntactic destructuring when one has a read
  syntax for structures. *

(defstruct foo a b c) 
(make-foo a 1 b 2 c 3) => #{FOO A: 1 B: 2 C: 3} ; print SYNTAX

Therefore it is reasonable to assume that

(DSETQ #{FOO A: X B: Y} Z) ; syntactic destructuring SETQ

will expand into

      Y (FOO-B Z)).

So you see that it is possible to get the destructured abstraction
you spoke of within the purely syntactic realm of maclisp DSETQ and LET.
Therefore fear not.