This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: printing types ?


On Tue, 7 Mar 2000, Han-Wen Nienhuys wrote:

> is there a generic way to print types from within GUILE? eg.
> 
>    1 => integer
> 
>    #t => boolean
> 
> etc.?


I don't think so.  Especially since there are some cases, where it is not
obvious what information is thought of:

(1 2)     -->  pair or list or regular list
(1 . 2)   -->  pair or irregular list
(1 . #0#) -->  pair or infinite list or circular list or ...

1 -> integer or exact integer
...

Thinking of gregs recent patch to improve messages for wrong type
parameters, which added telling you which type was expected, I
also had the idea to add the information, what type was actually
provided.  However, I figured out that you would have to do this
separately for each point in the code where an error message was
generated, as you can see from the following artificial example:

(list->string '(#\a #\b 1))
Error in function list->string: expected list of characters, got pair.
:-)

Best regards
Dirk Herrmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]