Word chunk includes punctuation

Richard Gaskin ambassador at fourthworld.com
Wed Aug 15 11:24:47 EDT 2012


Peter M. Brigham wrote:
 > If I put the following into a field:
 >    How many "words are in this field?"
 > and then try
 >    put the number of words of fld "f"
 > I get
 >    3
 > That is not what *I* would expect. There was a discussion last year
 > on this list of the pros and cons of maintaining the HC convention of
 > regarding anything in quotes as a single word. I still don't think it
 > makes sense. In my universe the answer is 7.

But your universe wasn't designed by Apple, and Apple's universe has a 
dent in it. ;)

There are more than a few oddities the HyperTalk designers implemented, 
and when the MetaCard engine was born in '92 it made good sense to 
support them.  20 years later the relevance of HT compatibility may be 
dismissible, but now that we have 20 years of 
MetaTalk/Transcript/RevTalk/LiveCode lying around, it wouldn't be 
realistic to expect that to change.

For myself, when I need an actual word count and run up against quotes, 
I just do this before getting the number of words:

    replace quote with space in tMyText

If LiveCode is lucky enough to be around in another 20 years we can 
expect that many more users to have shaken their heads in disbelief that 
this is necessary.

But most if not all languages have some gotchas which are accidents of 
its history, and LiveCode is no exception.

So as with any other language: we try something, it doesn't work as 
expected, we learn how to deal with it, add a line of code, and move on.

Maybe somewhere down the road we can see LiveCode2, an optional which 
could be activated with a flip of a global property to make for a more 
sensible set of syntax for the sanity of newcomers.

In the meantime we are where we are, and warts and all it's not a bad 
place to be.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys




More information about the use-livecode mailing list