more questions 
Author Message
 more questions

What does this return?

        (object-class (values 1 2 3))

Is this legal?

        (define v)
        (set! v (values 1 2 3))
        (bind ((foo bar baz v)) ...)

Thanks again,
        Richard W. (Dick) Kreutzer

Voice:  +1(801)571-2446                                 FAX:    +1(801)571-2448
Mail:   Integra Software Corp.; 1378 Jasmine Avenue; Sandy, UT 84092 (USA)

Mon, 04 Dec 1995 20:10:29 GMT  
 more questions
|> I have a few questions about two Dylan features.  The first few concern setter
|> (module) variables:
|> - When are they defined?  That is, does (define x 1) define x-setter?

When you define classes, you define a set! method for each slot. Since x
is a <symbol>, the setter mehod for x is probably defined when the symbol class
is defined. If you type (set! x-setter ...), there is probably an internal
mecanism that replace <symbol> x by another object, which is probably equivalent
to a singleton, and that make the link variable/setter explicit. It seems to me
that Eiffel makes something like this.

However, that's how I see things, and that's how I would do if I had to write
a Dylan evaluator. With efficiency preoccupation ...

But this is one of the obscure points of Dylan. The Dylan book is interesting
because it gives a good overview of what has been done in OO (in the Lisp Way),
but unresolved problems remain unresolved. And they don't point that out.

|> - How can one capture a built-in setter?  For example, does the following
|>   display "setting x"?
|>   (define x 1)
|>   (set! x-setter (method (val) (print "setting x") (set! x val)))
|>   (set! x 2)
|>   Or does this result in an infinite loop?  If not, what stops the recursion?

What about:

(let ((s x-setter))
  (set! x-setter (method (val) (print "setting x") (s x val))))

|> The other question involves getting/setting slots with allocation type "class"
|> It is often necessary to get/set "class variables" directly (i.e., when an
|> instance is not available). The following example shows what I mean but I don't
|> see where this is legal in the "book":
|>   (define-class <foo> (<object>)
|>           (class-var allocation: class))
|>   (class-var-setter <foo> "something")    ;setter specialized on the class
|>   (class-var <foo>)                 ;getter specialized on the class

Don't know. This is another unclear point. Are class variables slots from the
class (considered as objects)? It would mean you can add slots to classes. But the
design note #4 removes this feature.

Or are they just awailable through an instance? It seems to be the case.

I would say that the core language should have minimal features, and that
classes could have more elaborated behaviours, by defining new meta-classes.
You could now write something like :

  (define-class <foo> (<object>)
     (class-var allocation: class)
      metaclass: class-allowing-access-to-class-variable-through-the-class)

|> What does this return?
|>   (object-class (values 1 2 3))

I would say : an error. values does not return an object. It returns multiple
values, that can be used IMMEDIATLY by forms able to use more than one value.
object-class requires 1 argument, and you give it 3. This is an error.

Your code is equivalent to:

  (apply object-class (list 1 2 3 ))

|> Is this legal?
|>   (define v)
|>   (set! v (values 1 2 3))
|>   (bind ((foo bar baz v)) ...)

Same problem: set! called with 4 arguments.



ETCA CREA-SP                                    Phone:  (33) 1 42 31 99 51
16 bis, avenue Prieur de la Cote d'Or           Fax:    (33) 1 42 31 99 64
94114 Arcueil Cedex FRANCE                      

Tue, 05 Dec 1995 16:13:54 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Questions-Questions-Questions-Answers-Answers

2. Question(Questions, questions...)

3. Newbie Question: Realbasic Question

4. Questions Questions

5. Questions and more questions...

6. Browse Question / Report question

7. ***Data buffering question. Long post, lots of questions

8. questions, questions!

9. Questions, questions!

10. MicroWorlds Pro "QUESTION Set Size" question

11. OS/2 REXX Question (Object REXX Question Inside)

12. Doc question and Mount question


Powered by phpBB® Forum Software