slib-discuss
[Top][All Lists]
Advanced

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

[Slib-discuss] Minor printf bug?


From: Kris De Volder
Subject: [Slib-discuss] Minor printf bug?
Date: Sun, 07 Dec 2008 12:10:24 -0800

Hi again,

Thanks Aubrey for your helpful pointers so far. 

I ran across a problem with the SLIB printf library, which I *suspect*
may be a minor bug. I say *suspect* because it is of course also
possibly a bug in my code or my understanding of how things ought to
work, instead of a bug in slib code. Either way I'd like to do something
about the bug... whatever kind of bug it may be :-)

The Slib FAQ doesn't talk about reporting bugs. So I gather the list may
be a good place. I apologize if it is not. If so, please point me to a
good way/place to report bugs in the future.

Now for the "bug report".

Steps to reproduce:

  1) you will need a Scheme implementation which does not support the 
       multiarg-apply feature.

   E.g. you could outcomment ;multiarg apply line in XXX-init file and
   then

   (define apply 
      (let ((old-apply apply))
         (lambda (p a) (old-apply p a))))

  2) In a Scheme repl evaluate following

> (require 'printf)
slib:load: "file:/home/kdvolder/workspaces/kscheme/ca.kscheme/bin/slib/printf"
slib:load: "file:/home/kdvolder/workspaces/kscheme/ca.kscheme/bin/slib/strcase"
slib:load: "file:/home/kdvolder/workspaces/kscheme/ca.kscheme/bin/slib/sc4opt"
> (printf "Hello World")

The following error is reported (by my Scheme implementation, which is
not yet publically available)

> (printf "Hello world")
ca.kscheme.interp.ErrorWithCont: Applying primitive #apply with rands
(#procedure<(port format  . args) ((let ((cnt 0 ) ) (apply stdio:iprintf
(lambda (x ) (cond ((string? x ) (set! cnt (+ (string-length x ) cnt ) )
(display x port ) true ) (else (set! cnt (+ 1 cnt ) ) (display x port )
true ) ) ) format args ) cnt ) )> address@hidden Hello
world null )
line: 6  col: 1
   (printf Hello world )
line: 555 col: 3 in
file:/home/kdvolder/workspaces/kscheme/ca.kscheme/bin/slib/printf.scm
   (apply stdio:fprintf (current-output-port ) format args )
Caused by: ca.kscheme.data.KSchemeException: Assertion failed: number of
argumens expected: 2 but was 4

It appears that the printf module is using multiarg apply, which is not
provided (yet) by my implementation.

When I check slib:features
> slib:features
-> (rev4-optional-procedures string-case printf dynamic-wind source
vicinity srfi-59 srfi-96 r4rs ieee-p1178 full-continuation defmacro)

Is this a bug? I reasoned that it is, because the printf library should
either
  - somehow explicitly or implicitly require the 'multiarg-apply feature
  - or not use multi-arg apply

>From the slib:features list, it appears this environment does not
purport to support multiarg-apply...

Or maybe I am missing something and support of multiarg apply is implied
by one of the features that is in the list above, and my implementation
is in error because it did not actually provide multiarg apply while
(implicitly) claiming that it does?

Anyway, I plan to resolve this issue by implementing multiarg-apply, but
I would still like to report this problem (if it is indeed a bug) or
clarify my misunderstanding (if it is not).

Thanks,

Kris





reply via email to

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