1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Fix docstring for symbol->string, string->symbol

* libguile/symbols.c (scm_symbol_to_string, scm_string_to_symbol):
Remove some confusing documentation that assumes that Guile is
case-insensitive, and which uses a word that may be perceived as a slur.
* module/ice-9/test.scm:
* test-suite/tests/r4rs.test: Rename a test to avoid using a slur.
This commit is contained in:
Andy Wingo 2023-09-18 16:03:41 +02:00
parent 850b724f85
commit 8441d8ff56
3 changed files with 8 additions and 48 deletions

View file

@ -1,4 +1,4 @@
/* Copyright 1995-1998,2000-2001,2003-2004,2006,2009,2011,2013,2015,2018,2022
/* Copyright 1995-1998,2000-2001,2003-2004,2006,2009,2011,2013,2015,2018,2022,2023
Free Software Foundation, Inc.
This file is part of Guile.
@ -301,29 +301,8 @@ SCM_DEFINE (scm_make_symbol, "make-symbol", 1, 0, 0,
SCM_DEFINE (scm_symbol_to_string, "symbol->string", 1, 0, 0,
(SCM s),
"Return the name of @var{symbol} as a string. If the symbol was\n"
"part of an object returned as the value of a literal expression\n"
"(section @pxref{Literal expressions,,,r5rs, The Revised^5\n"
"Report on Scheme}) or by a call to the @code{read} procedure,\n"
"and its name contains alphabetic characters, then the string\n"
"returned will contain characters in the implementation's\n"
"preferred standard case---some implementations will prefer\n"
"upper case, others lower case. If the symbol was returned by\n"
"@code{string->symbol}, the case of characters in the string\n"
"returned will be the same as the case in the string that was\n"
"passed to @code{string->symbol}. It is an error to apply\n"
"mutation procedures like @code{string-set!} to strings returned\n"
"by this procedure.\n"
"\n"
"The following examples assume that the implementation's\n"
"standard case is lower case:\n"
"\n"
"@lisp\n"
"(symbol->string 'flying-fish) @result{} \"flying-fish\"\n"
"(symbol->string 'Martin) @result{} \"martin\"\n"
"(symbol->string\n"
" (string->symbol \"Malvina\")) @result{} \"Malvina\"\n"
"@end lisp")
"Return the name of @var{symbol} as a string. The resulting\n"
"string is immutable.")
#define FUNC_NAME s_scm_symbol_to_string
{
SCM_VALIDATE_SYMBOL (1, s);
@ -334,26 +313,7 @@ SCM_DEFINE (scm_symbol_to_string, "symbol->string", 1, 0, 0,
SCM_DEFINE (scm_string_to_symbol, "string->symbol", 1, 0, 0,
(SCM string),
"Return the symbol whose name is @var{string}. This procedure\n"
"can create symbols with names containing special characters or\n"
"letters in the non-standard case, but it is usually a bad idea\n"
"to create such symbols because in some implementations of\n"
"Scheme they cannot be read as themselves. See\n"
"@code{symbol->string}.\n"
"\n"
"The following examples assume that the implementation's\n"
"standard case is lower case:\n"
"\n"
"@lisp\n"
"(eq? 'mISSISSIppi 'mississippi) @result{} #t\n"
"(string->symbol \"mISSISSIppi\") @result{} @r{the symbol with name \"mISSISSIppi\"}\n"
"(eq? 'bitBlt (string->symbol \"bitBlt\")) @result{} #f\n"
"(eq? 'JollyWog\n"
" (string->symbol (symbol->string 'JollyWog))) @result{} #t\n"
"(string=? \"K. Harper, M.D.\"\n"
" (symbol->string\n"
" (string->symbol \"K. Harper, M.D.\"))) @result{}#t\n"
"@end lisp")
"Return the symbol whose name is @var{string}.")
#define FUNC_NAME s_scm_string_to_symbol
{
SCM_VALIDATE_STRING (1, string);

View file

@ -1,4 +1,4 @@
;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 2006 Free Software Foundation, Inc.
;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 2006, 2023 Free Software Foundation, Inc.
;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -399,7 +399,7 @@
;;; Not for Guile
;(test #t eq? 'mISSISSIppi 'mississippi)
;(test #f 'string->symbol (eq? 'bitBlt (string->symbol "bitBlt")))
(test 'JollyWog string->symbol (symbol->string 'JollyWog))
(test 'HeyJeffrey string->symbol (symbol->string 'HeyJeffrey))
(SECTION 6 5 5)
(test #t number? 3)

View file

@ -1,5 +1,5 @@
;;;; r4rs.test --- tests for R4RS compliance -*- scheme -*-
;;;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2001, 2006 Free Software Foundation, Inc.
;;;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2001, 2006, 2023 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -413,7 +413,7 @@
;;; Not for Guile
;(test #t eq? 'mISSISSIppi 'mississippi)
;(test #f 'string->symbol (eq? 'bitBlt (string->symbol "bitBlt")))
(test 'JollyWog string->symbol (symbol->string 'JollyWog))
(test 'HeyJeffrey string->symbol (symbol->string 'HeyJeffrey))
(SECTION 6 5 5)
(test #t number? 3)