Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!ZURICH.AI.MIT.EDU!jinx From: jinx@ZURICH.AI.MIT.EDU ("Guillermo J. Rozas") Newsgroups: comp.lang.scheme Subject: Bug in MIT-Scheme Message-ID: <9003221201.AA11816@zurich.ai.mit.edu> Date: 22 Mar 90 12:01:42 GMT References: <2063@laura.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jinx@zurich.ai.mit.edu Organization: The Internet Lines: 60 Date: 21 Mar 90 13:46:55 GMT From: Holger Muenx I think I found a small bug in MIT-Scheme V7.0. Look at the following transcript: 1 ]=> (string->symbol "loadConst") ;Value: loadConst The resulting symbol consists of upcase und lowercase letters. It's a bit disturbing if you look at these lines: 1 ]=> (eq? (string->symbol "loadConst") 'loadConst) ;Value: () 1 ]=> (eq? (string->symbol "loadConst") 'loadconst) ;Value: () Any idea? -Holger The R3RS report, in the section for symbols (sectin 6.4) reads: "The string->symbol procedure, however, can create symbols for which this write/read invariance may not hold because their names contain special characters of letters in the non-standard case." Given that MIT Scheme uses lower case as the standard case, the print name for symbol 'loadConst is "loadconst", and (string->symbol "loadConst") returns a symbol whose print name is "loadConst", so they are clearly distinguishable. In other words, there is no way to type the symbol whose print name is "loadConst", since READ canonicalizes 'loadConst to 'loadconst and (eq? 'loadConst 'loadconst) -> #t It would be nice if the reports included a procedure called INTERN (or something like that) which when given a string, would canonicalize it (transform it to the standard case) and then use string->symbol on it. The report does not have such functionality, although it can be defined portably (using some inessential procedures), albeit somewhat awkwardly: (define intern (let ((standard-is-lower? (string=? "a" (symbol->string 'A)))) (lambda (string) (string->symbol (list->string (map (if standard-is-lower? char-downcase char-upcase) (string->list string))))))) MIT Scheme (>= 7.0) has INTERN pre-defined.