Characters that can be used in an array key

Richard Gaskin ambassador at fourthworld.com
Mon Apr 30 17:44:03 EDT 2012


Dar Scott wrote:

 > On Apr 30, 2012, at 9:54 AM, Richard Gaskin wrote:
 >
 >> While that article is still being finished, from what I've seen in
 >> Mark Waddingham's example code it seems that the only character we
 >> must avoid in array keys is NULL, since that's used internally as
 >> a delimiter between the key and the value.
 >
 > I think this limitation is a feature we can do without.  I think most
 > people have run across it and some not recognizing it have pulled
 > their hair out.
 >
 > This will come up more as people explore unicode.  You will not see
 > NULs in UTF-8 except for the actual original NUL.  You can use UTF-8
 > safely as a key.  However, someone might reasonably try some form of
 > UTF-16 in which the NUL will show up as a ghost character.
 >
 > This also might come up with binary.  A person might try using the
 > binary form of an identifier of some sort not realizing the zero
 > bytes would cause trouble.

I agree that it would be nice to support this for Unicode, but doing so 
would require changing at least the format of arrayEncode/arrayDecode, 
if not substantial portions of the underlying code for both arrays and 
custom properties.  Doable (everything ultimately is in computing), and 
for Unicode arguably essential, but not likely to happen next week.


 > I would support the removal of this feature and, in general, all
 > special meanings of NUL in all of LiveCode.  (It can stay in legacy
 > external interfaces.)

So many people have found arrays so useful for so many thousands of 
things that I'm not sure I would advocate removing them because their 
keys can't handle the subset of data which may contain NULL characters.

While worth revising at first opportunity, to date I don't recall it 
being reported as an issue here or in the forums.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv




More information about the use-livecode mailing list