medley icon indicating copy to clipboard operation
medley copied to clipboard

The term "meta" is used to describe 2 different value ranges of character codes

Open MattHeffron opened this issue 1 year ago • 1 comments

Describe the bug In the IRM section 2.5:

  1. "meta" is used to describe characters with the # prefix. These characters have the 8th bit (=128) of the character code. E.g., #A.
  2. The forms CHARSET,CHARNUM and CHARSET-CHARNUM put the value of the CHARSET from the CHARACTERSETNAMES alist into the high order byte of the character code as returned from the CHARCODE function (implemented in CHARCODE.DECODE in sources/LLREAD). E.g., Meta,A. "Meta" is a defined CHARSET name, with value 1.

Why setup/persist this obvious ambiguity in terminology?!

To Reproduce Steps to reproduce the behavior:

  1. In any sysout, in an Interlisp EXEC:
  2. Type: (LIST (CHARCODE "#A") (CHARCODE "Meta,A"))
  3. Returns: (193 321)
  4. Type: (READC)
  5. (for an IBM-type keyboard): hold down the left Alt key (the "Meta" key) then press the "," (comma) key, then release both
  6. This displays: # 1,44 (space inserted in comment after the # because of automatic issue reference)
  7. Press the Enter key to go back to the EXEC which returns the # 1,44 character. (like above)
  8. Type: (CHCON1 IT)
  9. Returns: 300

Expected behavior For step 3, I thought that both would return the same value. But I'm not sure which value I expected! For steps 6 and 9, I really wasn't sure which interpretation of "Meta" would be returned.

Additional context It seems that the resolution of this would be to change the term used to describe the # prefix in documentation.

Now a comment in CHARCODE.DECODE in sources/LLREAD make sense. Using the # prefix twice in succession would add 128 twice, and so would be adding 256 which is the same as a Meta, prefix putting 1 into the high order byte. This is actually what happens: (CHARCODE "##A") returns 321. (So the implementation doesn't exactly match the documentation.)

MattHeffron avatar Jan 07 '24 00:01 MattHeffron

I think that this was updated in release notes postdating the IRM - not sure if it was Koto, Lyric, or Medley. Also I remember there being an issue around #n,xxx forms in Medley/Sun systems. Didn't @rmkaplan also make changes in this area within the last couple of years?

nbriggs avatar Jan 08 '24 03:01 nbriggs