guile-user
[Top][All Lists]
Advanced

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

Re: obscure problem


From: thi
Subject: Re: obscure problem
Date: Sun, 03 Jun 2001 16:51:48 -0700

   From: David Pirotte <address@hidden>
   Date: Mon, 04 Jun 2001 02:18:37 +0200

             (let ((slots '(db-oid))
                   (slot-defs '((db-oid #:accessor db-oid

   is supposed to 'allocate a new list both for slots and slot-defs, at
   every execution, no?

   or maybe should I have defined tyhe let as is:

             (let ((slots (list 'db-oid))
                   (slot-defs (list '(db-oid #:accessor db-oid

yes, this is the crux of the problem.  binding to a quoted object
implies that you (the programmer) do not intend to modify that object;
it can be considered constant.  the second fragment is more correct in
this case because you actually have intent to modify the object, which
is given to you by `list'.

i used to get bitten by this (to me, then) subtle issue a lot but after
awhile, it went away because i stopped coding (hee hee).  actually, what
happened was the nature of my programs started to move away from this
style of object construction / access, and towards a more functional
approach.  the second frag exemplifies how i began that change, which is
still ongoing.

thi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]