Setter Variables and Re: Multiple Values 
Author Message
 Setter Variables and Re: Multiple Values

  I do not see where on pp. 61-62, it states that X-SETTER is not used
  except with the "extended form" version of set!.  I do see that it
  "must" be used with the extended form.

Its says "If _place_ is a variable name, then _new value_ is stored in
the corresponding variable."  That's it.  There's no way to do what
you describe:

  I thought the idea was to allow a programmer to "override" a setter
  function thereby gaining access to all which set a variable.  I
  believe this can be done with slots, and my question was if it can
  be done with module variables.

No.  That might be a useful mechanism, but it's not provided.

  Why doesn't (SET! X 42) check for an X-SETTER and call it if it
  exists? ... Is it the way it is primarily for performance reasons?

If for no other reason than because X-SETTER is what would be used by
the form (SET! (X FOO) 42).  But I think you're confusing the
variables with the values.  X-SETTER isn't necessarily bound at
compile-time, and neither X nor X-SETTER (the symbols) necessarily
exist at run-time (indeed, strictly speaking, symbols are only
syntactic constructs in Dylan), and so what should the expansion of
(SET! X 42) check?

Also, I think you're correct in that the gist of what you're
describing would be deemed hideously expensive, as most programmers
expect variable access to be a few instructions AT MOST.

Regarding multiple values, Richard writes:

    (PRINT (VALUES 1 2 3))
  would print:
  But (on p. 30):
    (VALUES 1 2 3)
  Does this mean that the "READ-EVAL-PRINT" loop in Dylan has built-in
  knowlege of how to print multiple values?

Yes, it must, except, of course, that such a thing is not defined as
part of the language.

  This would imply that the REV loop could not be written in Dylan
  wouldn't it?

No, BIND could be used to capture a list of values, which could then
be iterated over.  Here's an example:

  => (1 2 3)

BTW, I've never actually programmed in Dylan, not even Thomas.  I'm
making all this up from extensive CommonLisp experience and the
printed Dylan material.  Hope it's useful nonetheless.

John Burger

Sat, 09 Dec 1995 05:40:44 GMT  
 [ 1 post ] 

 Relevant Pages 

1. variable with multiple values

2. Setter Variables

3. (values (multiple-value-form)) whats the point?

4. Multiple-value-list with no values.

5. value of value of a variable ?

6. treat value in a variable as a variable

7. values of variable variable-names

8. return multiple values from an awk function?

9. ???Eiffel idiom for multiple return values???

10. Tuples, iterators, and multiple return values in Eiffel?

11. Wait ms Timer Multiple returning inaccurate timer value


Powered by phpBB® Forum Software