Word chunk includes punctuation

Peter M. Brigham pmbrig at gmail.com
Wed Aug 15 12:01:22 EDT 2012

On Aug 15, 2012, at 8:24 AM, Richard Gaskin wrote:

> 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.

Oh, I agree with that wholeheartedly. In the scheme of things it's a minor complaint. My griping does not negate the fact that I love so much about LC overall. And it's possible to work around a lot of these gotchas given the versatility of the language. That's why God made utility libraries!

-- Peter

Peter M. Brigham
pmbrig at gmail.com

More information about the use-livecode mailing list