John Williams skribis 2004-04-14 13:36 (-0600): > On Wed, 14 Apr 2004, Juerd wrote: > > I propose to use ` as a simple hash subscriptor, as an alternative to {} > > and <<>>. It would only be useable for \w+ keys or perhaps -?\w+. > > As with methods, a simple "atomic" (term exists only in perlreftut, > > afaix, but I don't know another word to describe a simple scalar > > variable) scalar should be usable too. > > %hash`$key > > oops, you contradicted yourself here. "only be useable for \w+ keys"
Oops, part of my message wasn't read as it was intended. $key is a simple "atomic" scalar and "should be usable too". Just like how $object.$method works, %hash`$key should too. > > $0`15 # $0[15] > > $0`alpha # $0{'alpha'} > You are repeating the errors of javascript. $0[15] != $0{15} "After all, [] and {} are still available if you need to be explicit." Javascript's "error" (design) is that it has only [] and no {}. > I think I would prefer something more intuitive, like :baz=quux That reads to me as assigning the result of quux() to a pair that has the value 1. To avoid that it reads like an assignment, => could be used: :bar=>quux But ehm, then there's not much point anymore, as bar => 'quux' already does the same and is much easier to read. > Any [^\w\s] character could be used there unambiguously, and = has the > already existing parallel with command-line args, but ` is just an unused > character. Command line arguments (assuming a specific kind of parsing) also use -- instead of : and have > > and ` is in an extremely easy to type place. > ... on a us/english keyboard ... On a US keyboard (qwerty/dvorak), it's in the upper left corner. Very convenient indeed. On German and Danish keyboards, it is the key left of backspace, shifted. This sounds terrible, but not quite as terrible as Alt Gr plus 7 and 0 respectively. German/Danish keyboard has: / ( ) = ? ` <-- Shift 7 8 9 0 sz ' <-- no modifier { [ ] } prc \ <-- Alt Gr On Dutch keyboards (that aren't used much, but do exist), it is two keys left of Enter. It also requires the awkward Alt Gr for { and }, but in better positions: - ( ) ' <-- Shift 7 8 9 0 <-- no modifier pnd { } <-- Alt Gr H J K L plm ` <-- Shift h j k l + ' <-- no modifier With whatever keyboard Matthijs uses, the ` is right of the left Shift. So that's already 6 keyboard layouts in which ` is much easier than {}. It appears French keyboards have { as Alt Gr + 4 and } all the way over on the right side, as Alt Gr + =. It has ` as Alt Gr + 7. But this layout looks terrible for any typing, natural AND programming languages. http://www.datacal.com/dce/catalog/french-layout.htm If on your keyboard ` is in a worse place than {}, I'd like to know where it is. Juerd