« first day (340 days earlier)      last day (128 days later) » 

1:11 AM
@MarkI Sorry if I was a little brusque. Our discussion was about whether it is better for Map keys in Red to be case sensitive or not.
I was advocating for case sensitivity consistency between words and map keys. (And still am).
 
1:25 AM
@earl I like to believe that consistency between words, paths and map keys in Rebol 3 was a design choice thought through by Carl. This belief is based on this code:
b: [a 1]
o: make object! [a: 1]
m: make map! [a 1]

f: func [it [block! object! map!]] [
    it/A
]

print f b
print f o
print f m
Rebol 3 prints 1 in all cases.
Red returns 1 for the block, gives a script error with an object! (I suspect this is a bug) and would return none from a map!
You could argue that coding it/A is clearly a programming error so either raising an error or returning none are the best options in the circumstances. If that was the case, then shouldn't it be "caught" as an error in all cases?
 
1:59 AM
@DocKimbel I looking into case sensitivity, i noticed a couple of oddities in how object! is handling case sensitivity. The first is that it seems the path is being treated as case sensitive. The second is that it appears that the uppercase version of a word is ignored when being processed by make).

The following console session (latest master) demonstrates the issue.

When you've had a little time to think about the desired behaviour, let me know and I'l add tests to reflect it.
red>> o: make object! [a: 1]
== make object! [
    a: 1
]
red>> o/A
*** Script error: A has no value
*** Where: try
red>> in o 'A
== none
red>> o2: make object! [a: 1 A: 2]
== make object! [
    a: 1
]
red>> o/A
*** Script error: A has no value
*** Where: try
red>> probe o
make object! [
    a: 1
]
== make object! [
    a: 1
]
red>> o3: make object! [a: 1 if true [A: 2]]
== make object! [
    a: 1
]
red>> o3/a
== 1
 
3:00 AM
@PeterWAWood That will get you nothing but my admiration and full support, thanks for clarifying.
 
 
7 hours later…
10:08 AM
@PeterWAWood Pushed fixes for these issues, thanks for reporting them.
@PeterWAWood Notice that map! is not yet in Red repo, only in qtxie's one.
With regard to casing sensitivity in map keys, I haven't made my mind about it yet.
@earl That's the right question. I haven't dug that topic yet, I will give it a first pass with @qtxie, once back in Beijing.
 
@DocKimbel Thanks. I'll add some tests later.
 
10:24 AM
@PeterWAWood Since your examples are for words, I'm still left wondering; How do you feel about map! having case-insensitive word! keys and case-sensitive string! and char! keys?
 
10:35 AM
@WiseGenius Personally, I don't like the thought of introducing inconsistency between values that have a single literal form.
 
About the map! discussion, please keep in mind that in Red (unlike in Rebol), we'll have both map! and hash! datatypes. Hash! will be pretty much the same as in Rebol2. So we don't have the same constraints as in Rebol3, with only one datatype to serve different purposes.
 
Then I would prefer everything to be case sensitive by default. Personally, I see little value in words, strings and char being treated as case insensitive. It's main use appears to be when comparing strings (in which case, the language provides both case sensitive and case insensitive comparisons) and when programmers mistype word names. (As 99.99% of the words that I have seen in Rebol are lower case, I think this second use case is quite often over stated.)
2
Pragmatically, case insensitivity makes little difference to me whereas consistency does.
 
11:34 AM
@PeterWAWood - so you want your map words to bomb out by someone mispelling the word, while in other areas case insensitivity would prevail?
 
 
1 hour later…
12:37 PM
@pekr No.
It is others who want case sensitive map words. I want either all words to be case sensitive or all words to be case insensitive.
Please take a look at the function that I posted about 12 hours ago. I would much prefer to get consistent results, as Rebol 3 gives. For me, the consistency is more important than whether words are case sensitive or not.
By the way, I really cannot remember seeing any Upper Case letters being used as Rebol words so I don't think that misspelling words due to incorrect casing is of genuine concern.
 
 
3 hours later…
3:45 PM
@PeterWAWood That matches my preference indeed, but this seems very much a minority opinion in Rebol land. Many Rebolers seem to very adamantly prefer their case insensitivity.
Also, I remember seeing quite a bit of code using very "odd" (to my eyes, of course) capitalisation for words. Much more so than I'd prefer.
@PeterWAWood Fair enough. I think I have to then repeat the question WiseGenius asked. You prefer consistency between words, paths, and words as map keys and them being case insensitive (but -preserving).
How do you feel about case sensitivity for string map keys?
And you have given the answer above as well, I think. If I understand you correctly, you also prefer to extend that case insensitivity to string map keys, in the name of consistency.
 
as for me, I would not mind map string keys being case sensitive ... but maybe I am not good to think about all possible consequences ...
 
As also stated before, the problem with this kind of consistency is, that while totally understandable, it makes map! useless for its primary use case.
Hence the challenge I mentioned before:
2 days ago, by earl
So the challenge I see is: how can we retain the full utility of a case-sensitive map! and unite that with the rest of the (by default case-ignorant but -preserving) language.
Having words case-insensitive in map! while strings are treated case-sensitively would be one possible solution.
I think from a consistency standpoint, it's an inferior one, but that is certainly open to discussion.
 
@earl When you say that solution is “an inferior one” are you only comparing it to making everything case-sensitive, or to some other solution?
 
I never used map/hash/list. Doc plans on hash! dtype too. Does it anyhow relate?
 
@WiseGenius Inferior in my book compared to the solution of saying "a map! uses strict equality for comparision" which would make it sensitive to both, word and string casing.
I don't really have a better solution than this "strict map", yet. Otherwise I'd sure tell you about it :)
 
4:09 PM
@earl I don't know if DocKimbel is still considering making hash! a property of block!s, but I do wonder how one would set that property? Any idea? Maybe the same solution can be used to set the case sensitivity of a map!?
 
4:33 PM
@WiseGenius I don't know either. And, yes, maybe that could be done, via extended spec blocks as has been discussed for a while.
 
@earl But then how would that mess with the convenience of literal notation?
 
@WiseGenius Would have to make literal notation to map to the right default.
But I'm not yet very convinced that specs for maps would really help much.
 
 
3 hours later…
7:25 PM
@earl Re chat.stackoverflow.com/transcript/message/21817971#21817971, can you please show or direct me to a summary of the reasoning behind it (map! requiring case-sensitive strings)?
 
8:12 PM
@MarkI I have nothing written up ready, it's based on experience. Have you ever used something like a hashtable or a dict (or ... map) in other languages?
Regular uses for me occur in associating some additional data with primary data I do not fully control or cannot (or do not want to) artificially restrict.
Mapping usernames to some user-specific data; or filenames to metadata (such as, a timestamp); keeping a set of authentication tokens; etc etc.
While in some cases those keys can indeed be treated case-insensitively, in many more cases, they cannot. In even more cases, it's something I don't even want to think about and just be sure that my mapping doesn't mess with external data.
Hence: case-insensitive map bad.
3
I stumble across it really almost every time I try to use map!. As is (with the case-insensitivity), it simply doesn't show any utility for the cases I typically want an associative datastructure. I've since almost given up on map! in practical use, and resort to performance-wise suboptimal solutions using blocks and the various case-sensitive functions we have (such as SELECT/case). A sorrowful state of affairs, in my humble opinion.
 
8:51 PM
@earl Very interesting. I try to avoid putting uncontrolled data, well, anywhere.
I always hash it in some way first, and that hashing function can be case-either.
But the important thing is not the hashing, it's the pre-processing, to avoid null or empty keys.
Usernames: almost always case-insensitive. Filenames: should really be case-insensitive, UNIX got this wrong. Authentication tokens: are binaries, not strings.
Which brings up an idea: Why not use strings' binary! form as key if you want case-sensitivity?
Is it that if you have to do any type of conversion on the data your use case is ruined?
 
@MarkI I think that slightly misses the point. It's not about pre-processing per-se, but about useless pre-processing just to cater to the shortcomings of map!.
If I hash my data beforehand, that's certainly possible, but it rather foils the utility of a data structure using hashing to speed up associative lookup.
@MarkI Sure, we can nit-pick every single case, and I can certainly tell my Unix users (myself included) that my software is broken because they chose a file-system that @Markl told me got it wrong.
@MarkI An awful workaround that has been suggested for years, yes.
Thing is, my data is what it is. There's enough inherent nuisance and complexity dealing with that already, adding Rebol's case-sensitivity world-view to the mix makes things only worse.
Sure, I can jump through hoops to achieve what I want to achieve -- but why should I?
@MarkI So no, it's not any conversion that is ruining my use cases, it is conversions that don't add value towards the core of the goal.
Why should I keep my user-mapping with usernames as binary!? When I keep it in a simplistic file-based data store and want to manipulate it by hand, why should I have to know that colour-coding all your messages should have me looking for some #{4D61726B49}?
 
9:11 PM
Er, OK then. I mean, I'm not wedded to case-insensitivity either, really. But the point remains, and has been outlined better by others, that you can use a map! with a case-insensitive key comparator in a case-sensitive fashion via (agreed, annoying) key manipulation. The reverse is impossible.
 
@MarkI Why should the reverse be impossible?
Just case-fold all your keys and be done with it. In fact, you'll more often than not have to do that anyway.
@MarkI Yeah, you could to that. Try it out in practice, and tell me if it's fun. I find it to be utterly and completely ridiculous. So much so, that, as stated before, in all but the most demanding cases I've abandoned using map!s in favour of performance-wise inferior but usage-wise far less ridiculous plain blocks.
 
Sorry @earl, my responses have been too off-the-cuff. There remain serious concerns, but I am not articulating them well at the moment. With your permission, I'll come back to this topic (strings as map keys) after I've had time to be slightly more rigorous about it.
 
@MarkI No worries.
Also, I am the first to admit, that case-sensitive map! is not strictly necessary. You can workaround in many ways.
But I think if we can't get that right, then we better let go of map completely.
It then simply doesn't pull its weight. (There are many more design difficulties associated with fitting map! into the Rebol series! worldview.)
 
9:35 PM
@earl Remind me, was case a problem with hash! in R2?
 
@MarkI No, it wasn't. hash! doesn't touch your data.
Ultimately, hash!'s behaviour is one possible direction for map! as well.
Case-sensitivitiy for storage, but case-insensitivity for lookup (by default).
R2>> d: make hash! [a B A b]
R2== make hash! [a B A b]
R3>> d: make map! [a B A b]
R3== make map! [a b]
 

« first day (340 days earlier)      last day (128 days later) »