---- Krister Svanlund <adsumm...@gmail.com> wrote: 
> Shouldn't the function return a string representing the object.rather than
> the object itself, even for a string. It should be up to your application
> to handle if it's a string imho.
> On Jul 3, 2012 2:42 PM, "Nala Ginrut" <nalagin...@gmail.com> wrote:
> 
> > hi guys!
> > I realized that our object->string will do some unnecessary works for
> > a string object.
> > --------------code--------------
> >  (object->string "\n")
> > ==> "\\n"
> > ---------------end--------------
> >
> > It's illogical! I get several errors when I'm reading xml files. It
> > generates too many "\\" that I must delete them with redundant
> > operations.
> > I believe we should return the object directly when it's a string.

Object->string takes an optional "printer" argument.  The default is write,
but you can also use display.

scheme@(guile-user)> (help object->string)
`object->string' is a procedure in the (guile) module.

 -- Scheme Procedure: object->string obj [printer]
     Return a Scheme string obtained by printing OBJ.  Printing
     function can be specified by the optional second argument PRINTER
     (default: `write').

 
scheme@(guile-user)> (object->string "\n")
$1 = "\"\\n\""
scheme@(guile-user)> (object->string "\n" display)
$2 = "\n"

-Dale

Reply via email to