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

Naive T Design Questions

1. What is the advantage of having #T and '() not EQ??

2. Why isn't BOUND? known to Orbit (especially since *BOUND? exists)?

3. Why was VALUES renamed to RETURN?  RETURN seems to imply change of the
   control flow which return does not do!

4. (This is not a design question.)  Is there a place where T code may be
   deposited for the purpose of making it generally available?  For example,
   I have some code:
	a version of T3 that runs on SUN-2s,
	a T version of OPS5 (for whatever that's worth),
	and a DEFINE-FUNCTION macro that accepts all the Common LISP DEFUN
		bells and whistles,
   that I would gladly make available if I could (we have no anonymous FTP).
   In general, I think code sharing amoung T users should be encouraged as
   much as possible so that we are not all running around recoding simple
   tools in T.

5. The Ellisp macro package for Maclisp had a macro for then and else
   clauses in if statements.  This greatly improved the readablility of all
   but the simplest if constructs in a program.

       (if (predicate? foo)
	   (then (f1 ...)
		 (fn ...))
	   (else (g1 ...)
		 (gn ...)))


       (if (predicate? foo)
	   (block (f1 ...)
		  (fn ...))
	   (block (g1 ...)
		  (gn ...)))

   Why not include this in T?  (I know, INSIPID FEATURISM!, but it does seem
   to make code easier to read.)  I even have a macro that expands all three
   legal combinations of THEN and ELSE, presence and absents (see below).

6. Is this really the best way to implement self evaluating keywords in T:
   (define (read-keyword port ch rt)
     (let ((keyword (read-atom port rt ch)))
       (*lset (the-environment) keyword keyword)))?
   I've tried several things with QUOTE but they all fail in some obscure
   way, and I don't want to touch EVAL and friends!

Despite the fact that I borrow freely from other dialects, T is the best,
and cleanest LISP that I've used!

	Thanks in advance,


I am including the IF THEN ELSE code here because it is short.

;;; The macro is for improving the readablility of if statements.  It allow
;;; the use of THEN and ELSE instead of BLOCK for extending then and else
;;; clauses.  For example on can write (IF test (THEN . yes) (ELSE . no))
;;; instead of (IF test (BLOCK . yes) (BLOCK . no)), where yes and no are
;;; lists of forms to be evaluated when test is true or false repectively.
;;; It also returns nil if the test fails and there is no else clause.

(define-syntax (if test then-expr . rest)
  (let ((else-expr (car rest)))
    (cond ((null? rest)
	   `(,(t-syntax 'if) ,test
	     ,(if (and (pair? then-expr)
		       (eq? (car then-expr) 'then))
		  `(block ,@(cdr then-expr))
	  ((= 1 (length rest))
	   `(,(t-syntax 'if) ,test
	     ,(if (and (pair? then-expr)
		       (eq? (car then-expr) 'then))
		  `(block ,@(cdr then-expr))
	     ,(if (and (pair? else-expr)
		       (eq? (car else-expr) 'else))
		  `(block ,@(cdr else-expr))
	  (else (error "Wrong number of arguments to if: ~a~%"
		       `(if ,test ,then-expr ,@rest))))))