unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Is string-append broken?
@ 2003-12-31  2:08 Bruce Korb
  2003-12-31  2:30 ` string-append *IS* broken!!! Bruce Korb
  2003-12-31  8:56 ` Is string-append broken? Marius Vollmer
  0 siblings, 2 replies; 5+ messages in thread
From: Bruce Korb @ 2003-12-31  2:08 UTC (permalink / raw)


Why is this code "wrong"?

> (string-append (c-string (get "name")) ", ")

As an experiment, I did this:

 (define c-str (c-string (get "name")))
 (shellf "echo 'c-str is set to -->%s<--' >&2" c-str)
 (set!   c-str (string-append c-str ", "))
 (shellf "echo 'c-str is set to -->%s<--' >&2" c-str)

Here is the result:

autogen -T getopt.tpl getpwnam-opts.def
c-str is set to -->"name"<--
c-str is set to -->"name"<--
c-str is set to -->"passwd"<--
c-str is set to -->"passwd"<--
c-str is set to -->"uid"<--
c-str is set to -->"uid"<--
c-str is set to -->"gname"<--
c-str is set to -->"gname"<--

This works:

  (sprintf "%s, " (c-string (get "name")))

but should not be any different.....Am I confused or is this a bug?


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: string-append *IS* broken!!!
  2003-12-31  2:08 Is string-append broken? Bruce Korb
@ 2003-12-31  2:30 ` Bruce Korb
  2003-12-31  8:57   ` Marius Vollmer
  2003-12-31  8:56 ` Is string-append broken? Marius Vollmer
  1 sibling, 1 reply; 5+ messages in thread
From: Bruce Korb @ 2003-12-31  2:30 UTC (permalink / raw)


Who in heck told string-append it "okay" to not do its job if the
first string appeared to be quoted?  That is utterly disgusting
and completely counter-intuitive.  How can you do that?  That
function has absolutely *NO* business trying to understand the
contents of the strings I want to concatenate together.

Bruce Korb wrote:
> 
> Why is this code "wrong"?
> 
> > (string-append (c-string (get "name")) ", ")
> 
> As an experiment, I did this:
> 
>  (define c-str (c-string (get "name")))
>  (shellf "echo 'c-str is set to -->%s<--' >&2" c-str)
>  (set!   c-str (string-append c-str ", "))
>  (shellf "echo 'c-str is set to -->%s<--' >&2" c-str)
> 
> Here is the result:
> 
> autogen -T getopt.tpl getpwnam-opts.def
> c-str is set to -->"name"<--
> c-str is set to -->"name"<--
> c-str is set to -->"passwd"<--
> c-str is set to -->"passwd"<--
> c-str is set to -->"uid"<--
> c-str is set to -->"uid"<--
> c-str is set to -->"gname"<--
> c-str is set to -->"gname"<--
> 
> This works:
> 
>   (sprintf "%s, " (c-string (get "name")))
> 
> but should not be any different.....Am I confused or is this a bug?


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is string-append broken?
  2003-12-31  2:08 Is string-append broken? Bruce Korb
  2003-12-31  2:30 ` string-append *IS* broken!!! Bruce Korb
@ 2003-12-31  8:56 ` Marius Vollmer
  1 sibling, 0 replies; 5+ messages in thread
From: Marius Vollmer @ 2003-12-31  8:56 UTC (permalink / raw)
  Cc: guile development

Bruce Korb <bkorb@veritas.com> writes:

> Why is this code "wrong"?
>
>> (string-append (c-string (get "name")) ", ")

What does this expression evaluate to?  I.e., what is printed when you
type it it the "guile>" prompt?

I get, for example:

  guile> (define c-str "\"passwd\"")
  guile> c-str
  "\"passwd\""
  guile> (string-append c-str ", ")
  "\"passwd\", "
  guile>

which looks correct to me.  Maybe 'shellf' is to blame.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: string-append *IS* broken!!!
  2003-12-31  2:30 ` string-append *IS* broken!!! Bruce Korb
@ 2003-12-31  8:57   ` Marius Vollmer
  2003-12-31 23:41     ` string-append is *NOT* broken!!! Bruce Korb
  0 siblings, 1 reply; 5+ messages in thread
From: Marius Vollmer @ 2003-12-31  8:57 UTC (permalink / raw)
  Cc: guile development

Bruce Korb <bkorb@veritas.com> writes:

> Who in heck told string-append it "okay" to not do its job if the
> first string appeared to be quoted?  That is utterly disgusting
> and completely counter-intuitive.  How can you do that?  That
> function has absolutely *NO* business trying to understand the
> contents of the strings I want to concatenate together.

Heh, of course string-append doesn't do that.  This is no sh or Perl! ;-)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: string-append is *NOT* broken!!!
  2003-12-31  8:57   ` Marius Vollmer
@ 2003-12-31 23:41     ` Bruce Korb
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Korb @ 2003-12-31 23:41 UTC (permalink / raw)
  Cc: guile development

Marius Vollmer wrote:

> Heh, of course string-append doesn't do that.  This is no sh or Perl! ;-)

No, of course not.  It was getting later than I thought and very tired out.
I hit a day one bug in my code that I knew couldn't be there ... I'd used
it too much.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-12-31 23:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-31  2:08 Is string-append broken? Bruce Korb
2003-12-31  2:30 ` string-append *IS* broken!!! Bruce Korb
2003-12-31  8:57   ` Marius Vollmer
2003-12-31 23:41     ` string-append is *NOT* broken!!! Bruce Korb
2003-12-31  8:56 ` Is string-append broken? Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).