guile-devel
[Top][All Lists]
Advanced

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

Re: segfault in SRFI-1 partition on non-list input


From: Ludovic Courtès
Subject: Re: segfault in SRFI-1 partition on non-list input
Date: Mon, 28 Apr 2008 17:28:46 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi,

"Julian Graham" <address@hidden> writes:

> Oh, yeah, that's fine -- sorry, didn't realize that was the behavior
> of SCM_VALIDATE_LIST.  Just as long as it doesn't segfault any more,
> I'm happy.

Actually, there are many places where `SCM_VALIDATE_LIST' is used where
it should be avoided.  An example is SRFI-1's `member'.  Try the
following:

  (use-modules (srfi srfi-1)
               (ice-9 time))

  (define l (make-list 1000000 0))
  (time (not (not (member (car l) l))))

  ;; ... versus...

  (time (not (not (member 0 '(0)))))

Looking at SRFI-1 specifically, the spirit is apparently to phrase
things in a way that allows implementations to not actually check
whether arguments are proper lists when proper lists are expected (see,
e.g., [0, 1]).

Thanks,
Ludovic.

[0] http://srfi.schemers.org/srfi-1/mail-archive/msg00061.html

    "[I]t's unlikely that any implementation would ever enforce the
     proper-list typing of its list parameter."

[1] http://srfi.schemers.org/srfi-1/mail-archive/msg00054.html





reply via email to

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