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: Nala Ginrut
Subject: Re: [PATCH] object->string should return obj immediately while obj is a string
Date: Wed, 4 Jul 2012 09:58:56 +0800

@Krister
I thought it should be a generic requirement. And dsmich's answer
proved it. It should be the duty of this API but the user choose the
output policy.

@dsmich
I confess I didn't read the manual carefully. Thanks for reminding.

On Wed, Jul 4, 2012 at 3:34 AM,  <address@hidden> wrote:
>
> ---- 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]