REBOL3 tracker
  0.9.12 beta
Ticket #0001832 User: anonymous

Project:



rss
TypeWish Statuswaiting Date19-Jan-2011 17:16
Versionalpha 110 CategoryUnspecified Submitted byCh.Ensel
PlatformAll Severityminor Prioritynormal

Summary /CASE-refinement is inapropriate name, would better be /STRICT
Description For SELECT, FIND, REPLACE and ALTER the /CASE refinement is inapropriate naming, since it doesn't only extend the functions behaviour to case-sensivity but makes the function do STRICT-EQUAL? comparisons instead of EQUAL? comparisons.

The name for the refinement therefor would better be /STRICT.
Example code
>> select/case   [a 1 a: 2] quote a:
>> select/strict [a 1 a: 2] quote a:

>> find/case   [a :a] quote :a
>> find/strict [a :a] quote :a

>> replace/case   [a :a] quote :a quote a:
>> replace/strict [a :a] quote :a quote a:

>> alter/case   [a] [:a]
>> alter/strict [a] [:a]

Assigned ton/a Fixed in- Last Update31-Mar-2015 01:46


Comments
(0003035)
maxim
19-Jan-2011 17:18

DEFINITELY!

/CASE makes no sense whatsoever. reading it in code, I couldn't understand what's going on.
(0003036)
BrianH
19-Jan-2011 23:56

It's not strictly STRICT-EQUAL? compatible, so /strict would be confusing too. Binding is not considered:

>> select/case reduce [use [a] ['a] 1 'a 2] 'a
== 1
>> strict-equal? use [a] ['a] 'a
== false

Nor should binding be considered, as it would be rare for the value being searched for have the same binding as the data that the /case or /strict functions would be applied to.

Don't forget that the set functions (DIFFERENCE, UNIQUE, UNION, INTERSECT and EXCLUDE) would need the /strict refinement as well if we are doing this. And all functions with /case currently would need to keep the /case refinement for compatibility - /strict would need to be a new refinement - so we would have to consider what it means when the options would be combined or not.

All in all, it might be a good idea to add a refinement to make this distinction, but it shouldn't be called /strict.
(0003038)
BrianH
20-Jan-2011 02:06

This ticket could be rewritten slightly to be option 4 of the rewritten ticket #1830. Waiting until that ticket is resolved.
(0004620)
abolka
31-Mar-2015 01:46

#1834 proposes getting rid of binding checks in strict comparisons. So if #1834 is implemented, /STRICT would become a slightly more appropriate name.

Even with #1834, strict comparison would still heed datatype differences, though -- so we still need an answer to how that would map to scenarios when a total order is required (such as in SORT). We currently seem to have _some_ answer for that in place already, so maybe we should just continue doing what we are doing already:

>> sort [foo "foo" bar "bar"]
== ["bar" "foo" bar foo]

Date User Field Action Change
31-Mar-2015 02:06 abolka Comment : 0004620 Modified -
31-Mar-2015 01:52 abolka Comment : 0004620 Modified -
31-Mar-2015 01:46 abolka Comment : 0004620 Added -
20-Jan-2011 02:06 BrianH Comment : 0003038 Added -
20-Jan-2011 02:05 BrianH Status Modified submitted => waiting
20-Jan-2011 00:01 BrianH Comment : 0003036 Modified -
19-Jan-2011 23:56 BrianH Comment : 0003036 Added -
19-Jan-2011 23:47 BrianH Description Modified -
19-Jan-2011 23:47 BrianH Code Modified -
19-Jan-2011 23:47 BrianH Version Modified alpha 111 => alpha 110
19-Jan-2011 17:18 maxim Comment : 0003035 Modified -
19-Jan-2011 17:18 maxim Comment : 0003035 Added -
19-Jan-2011 17:16 Ch.Ensel Ticket Added -