From: Steve Juranich <sjuranic@gmail.com>
Subject: Re: Using a macro with FOLD alters FOLD procedure!
Date: Fri, 15 Apr 2005 15:20:16 -0700 [thread overview]
Message-ID: <56190b6c05041515205fd8b6a@mail.gmail.com> (raw)
In-Reply-To: <1113594648.3650.8.camel@cslabpc3.evansville.edu>
On 4/15/05, Stephen Compall <s11@member.fsf.org> wrote:
> `fold' in SRFI-1 mentions that KONS is supposed to be a function.
>
> If you give a macro to fold, the macro gets expanded and memoized as
> such, when the macro is called normally, as it is as an optimization in
> the common case of one list. Try passing multiple lists; I bet you will
> get a type error on `apply'.
Thanks for taking the time to reply. Please understand that I'm not
taking a harsh tone with you at all. But this "not quite a bug" bit
me very hard and I'm still stinging a little.
I see your point that the documentation mentions that KONS needs to be
a procedure. But from a user's perspective, I don't think that I
should have to be reading the docs with a lawyer's mindset to avoid
this kind of problem.
Furthermore, the reason I got bit with this was because I was using
REDUCE (an alias for FOLD) with builtin AND as the KONS. Please
observe:
guile> (fold + 0 '(1 2 3 4 5)) ; works
15
guile> (fold and #t '(#t #t #t)) ; seems okay.
#t
guile> (fold + 0 '(1 2 3 4 5)) ; WTF??
0
It will take a lot of fancy talking and beer to make me believe that
the above is not a demonstration of a bug. I would strongly disagree
with the SRFI's author's opinion that "there's little point in
requiring these procedures to do more." In this case, the point would
be to make sure that the user (i.e, me) doesn't render the
painstakingly crafted software completely useless.
> So I would say "it is an error" to pass a macro to fold. Seems like a
> serious error, of course, that leaves the system in an undefined state
> unlike errors that don't modify the implementation :); I am no authority
> on whether this should be fixed (which is the only issue; the fix is
> trivial, but has potential philosophical implications).
Well, speaking on the authority of being a Guile user, is this the
kind of behavior you want Guile to have? This is exactly the reason I
left Perl. There is no good reason to have silently failing software.
This is even worse, as what has happened is that the implementation
has been silently redefined!!
I think that, at the very least, this is a bug in the documentation.
There should be all kinds of flashing red lights and sirens when this
kind of behavior is possible.
--
Steve Juranich
Tucson, AZ
USA
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2005-04-15 22:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-15 18:38 Using a macro with FOLD alters FOLD procedure! Steve Juranich
2005-04-15 19:50 ` Stephen Compall
2005-04-15 22:20 ` Steve Juranich [this message]
2005-04-16 11:46 ` Neil Jerram
2005-04-18 0:45 ` Rob Browning
2005-04-21 6:35 ` Neil Jerram
2005-04-21 22:16 ` Kevin Ryde
2005-04-22 8:27 ` Andy Wingo
2005-04-23 20:18 ` Neil Jerram
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=56190b6c05041515205fd8b6a@mail.gmail.com \
--to=sjuranic@gmail.com \
/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).