Alan Manuel Gloria:
> However, having a rule about whether it ends up hooking into a macro
> will then mean having an additional rule that has to be remembered by
> the user of the new reader, as well as possibly the user of any macro
> that has to do scanning of that type.  So I propose that either the
> reader completely handles infix, or it completely ignores it - no
> in-between.

I normally write code so that the macro is never invoked.

> 
> As an aside, at the office we are using a Lisplike with an infix
> notation, however I tend to avoid the infix notation except at repl.

What is "repl."?

> For coding, I use Lisp syntax almost completely, especially after I
> finally "got" macros.

Well, that's the problem with infix implemented as macros - they work unless 
you have complex macros, then they sometimes don't work. Yuk.  I think in most 
cases the reader-based approach has serious advantages, simply because it's 
simple and ALWAYS works.

> #|Assumes existing functions:
> (bracketaccess-generic obj &rest dimensions)
>  - accesses a dimensioned object; the number of dimensions
> given must match the number of dimensions in the actual object
> (get-number-of-dimensions obj)
>  - determines the number of dimensions in the obj
> |#
> (define (bracketaccess o d)
>     (cond
>         ( (listp o)
>             (if (eq (get-number-of-dimensions (car o)) (length o))
>                 (apply #'bracketaccess-generic (append o (list d)))
>                 (append o (list d)) ))
>         ( (neq 1 (get-number-of-dimensions obj))
>             (list o d) )
>         ( t
>             (bracketaccess-generic o d) )))
> #|Creating a congruent setf-macro is left as an exercise to the reader|#
> 
> In the above untested sample, the bracketaccess function never
> actually "reaches in" the object except at the final bracketaccess

Except that get-number-of-dimensions _does_ need to do a slight reach-in. 
That's because "a[x][y]" in sweet-expressions maps to:
(bracketaccess (bracketaccess a x) y)
and so on.

That said, the "reach in" is only when you see "bracketaccess", and only when 
there's a nested "bracketaccess"; this is a highly limited case, and may be 
okay.

--- David A. Wheeler

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to