REBOL3 tracker
  0.9.12 beta
Ticket #0001315 User: anonymous

Project:



rss
TypeWish Statusreviewed Date4-Nov-2009 04:53
Versionalpha 94 CategoryDatatype Submitted byabolka
PlatformAll Severityminor Prioritynormal

Summary MAP! should be case-sensitive for any-string! and char! keys
Description I can see the convenience of having case-insensitive comparison for WORD! keys, especially when using the m/key notation.

But for almost every other series key, this behaviour is more often than not outright harmful. For STRING!s it's highly counter-intuitive; for FILE!s and URL!s it is simply wrong in many cases. Etc.

I'd therefore suggest to get rid of all key-lowercasing for MAP!s. Or at least make case-sensitivity the default and special-case for the "REBOL-internal" datatypes (word!, refinement!, path!, ...).
Example code
>> make map! ["foo" 1 "FOO" 2 %foo 1 %FOO 2]
== make map! ["foo" 2 %foo 2]

;; EXPECTED: == make map! ["foo" 1 "FOO" 2 %foo 1 %FOO 2]

Assigned ton/a Fixed in- Last Update8-Jan-2013 06:26


Comments
(0001778)
BrianH
14-Nov-2009 23:15

This sidesteps the knotty issue of Unicode case insensitivity, but it does conflict with the REBOL standard of case-insensitive by default, case sensitive where /case is specified. Arguably it is a loss of information (which is bad). But it is a bit of a stretch to say it would be unexpected since this kind of behavior is the default throughout REBOL.

Still, it could be a good idea to have STRICT-EQUAL? comparison of characters and string types in map! keys, and it might be more efficient. We'll need to see if this conflicts with the default case insensitivity of SELECT, the most commonly used method of accessing data in a map! - at least SELECT/case would work.

Summary changed to show actual types affected.
(0003350)
abolka
8-Jan-2013 06:26

Also see the related suggestion in #1774 of creating an additional, case-sensitive map type (tentatively called strict-map!).

Date User Field Action Change
8-Jan-2013 06:26 abolka Comment : 0003350 Modified -
8-Jan-2013 06:26 abolka Comment : 0003350 Added -
14-Nov-2009 23:15 BrianH Comment : 0001778 Added -
14-Nov-2009 23:04 BrianH Summary Modified MAP! should be case-sensitive for (almost?) all key datatypes => MAP! should be case-sensitive for any-string! and char! keys
14-Nov-2009 23:04 BrianH Description Modified -
14-Nov-2009 23:04 BrianH Code Modified -
14-Nov-2009 23:04 BrianH Version Modified alpha 95 => alpha 94
14-Nov-2009 23:04 BrianH Status Modified submitted => reviewed
14-Nov-2009 23:04 BrianH Type Modified Bug => Wish
4-Nov-2009 04:53 abolka Ticket Added -