guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] object->string should return obj immediately while obj is a


From: dsmich
Subject: Re: [PATCH] object->string should return obj immediately while obj is a string
Date: Tue, 3 Jul 2012 15:34:35 -0400

---- Krister Svanlund <address@hidden> 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" <address@hidden> 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

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