On 22 Sep 2009, at 5:05 pm, Thomas Lord wrote: >> None of this requires what you actually suggested, though, which is >> storing modifiers in bucky bits. Instead you're storing them in >> prefixes, like M- and S-. > > Nothing *requires* any particular thing in this > space. For the record, so that you're clear how > Emacs is working here, (length "\M-&") => 1 > This simplifies things. The code that handles > a key binding specification doesn't have to have > special cases - it treats the character "\M-&" the > same way it treats the character "x".
If you treat these keysequences as lists of chars and symbols, then you get that, too: (length '((meta #\&))) => 1 (length '((ctrl #\a) #\b 'f11)) => 3 Shoving these modifers into high bits in characters that are represented as some fixed-width cell size is a hack; it constrains you to a character representation, and it gives you a limited number of modifier bits to play with, and both are things you could regret one day. Storing function keys as symbols means you can easily deal with good old Sun keyboards with Open and Help buttons on, and those newfangled media keyboards with Louder and Quieter and Favourites buttons on; and implementing modifiers by wrapping lists around symbols (for function keys) or characters means you can handle as many modifiers as the future throws at you, and have a uniform modifier abstraction covering both. '(escape (meta alt ctrl shift #\cokebottle)) ;-) > > -t > ABS -- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/archives/author/alaric/ _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
