unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Maciek Godek" <pstrychuj@gmail.com>
To: "Clinton Ebadi" <clinton@unknownlamer.org>
Cc: guile-user@gnu.org, "Kjetil S. Matheussen" <k.s.matheussen@notam02.no>
Subject: Re: References/locations
Date: Mon, 18 Aug 2008 10:09:50 +0200	[thread overview]
Message-ID: <e2ceda030808180109i775c6805l734bb73293b52488@mail.gmail.com> (raw)
In-Reply-To: <87bpzu1ixq.fsf@unknownlamer.org>

Clinton Ebadi:

>> I've been thinking of implementing this "location" stuff
>> as a smob, but you've got the point that it is (probably)
>> impossible to implement the location system without
>> redefining set! and define.
>
> You may want to read a few documents on functional programming to see
> why your locations concept is not good. There are a number of
> additional issues as well: one that comes to mind is the interaction
> of the garbage collector with pointers into the middle of a vector.

That's what I wanted to hear :)
(The other thing is the ambiguity: if we create a location to another
variable, say (set! y (location x)), then we can't redefine the meaning
of y easily:
(set! y 5) ; sets x to 5, which is unexpected behavior of set!
I think there would be many many more disadvantages)

> What is so wrong with forms like `(set! (vector-ref foo index) ...)'?

In scheme the only problem is that they don't work, unless we
redefine vector-ref:
(define vector-get vector-ref)
(define vector-ref (make-procedure-with-setter vector-get vector-set!))

> It's generally bad practice to go around destructively modifying data
> structures anyway.

Perhaps I'm not an experienced lisper, but I'd rather say it's generally
a bad practice to generalize overly: everything depends on what you're
doing. I'm currently working on an object system that is based on a local
state and it would be a stubbornness to implement it using purely
functional paradigm.

Regards
M.




  reply	other threads:[~2008-08-18  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cmu-lmtpd-5833-1218211546-4@mail-imap1.uio.no>
2008-08-08 18:34 ` References/locations Kjetil S. Matheussen
2008-08-10 23:00   ` References/locations Maciek Godek
2008-08-15 10:14   ` References/locations Maciek Godek
2008-08-15 13:55     ` References/locations Clinton Ebadi
2008-08-18  8:09       ` Maciek Godek [this message]
2008-08-18 16:15         ` References/locations Clinton Ebadi
2008-08-08  1:50 References/locations Maciek Godek
2008-08-10  7:51 ` References/locations Stephen Compall
2008-08-15  9:35   ` References/locations Maciek Godek
     [not found]   ` <e2ceda030808141732r524fc0cehb8ae7c6007550ea6@mail.gmail.com>
     [not found]     ` <m2wsihltfv.fsf@member.fsf.org>
     [not found]       ` <e2ceda030808200441q52d9858bv63323055e0f6308a@mail.gmail.com>
2008-08-21  5:05         ` References/locations Stephen Compall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2ceda030808180109i775c6805l734bb73293b52488@mail.gmail.com \
    --to=pstrychuj@gmail.com \
    --cc=clinton@unknownlamer.org \
    --cc=guile-user@gnu.org \
    --cc=k.s.matheussen@notam02.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).