Handling of final delimter (was Re: "this me"?)

Richard Gaskin ambassador at fourthworld.com
Thu Aug 8 15:40:30 EDT 2013


Geoff Canyon wrote:
> On Thu, Aug 8, 2013 at 1:34 PM, Richard Gaskin wrote:
>>
>> My favorite annoyance with xTalks is the decision by the HyperTalk team to
>> allow some functions to be called as though they're properties - but not
>> all.  You can say "get the abs of -10" or "abs(-10)", and you can say "get
>> offset("l", "hello") but not "get the offset of "l" in "hello".
>>
>> Stranger still, the "abs" function turns out to be an especially good
>> example:  it's an abbreviation for which the long form ("absolute") is not
>> permitted. I kid you not.
>
> These are both going to be correctable in a soon-ish time frame if the new
> language features meet the spec. (waiting breathlessly)

The latter would be useful, but the former need not be expanded.

IMNSHO, allowing property syntax is a bug, not a feature, so further 
encouraging the growing list of "sometimes" rules would seem to hamper 
learnability rather than enhance it.

Parentheses aren't evil.  In fact, they serve as a gentle visual 
reminder that a value is being returned in that place.

I know I'm in a minority on this one, so I won't belabor the point 
beyond this post.  But reading the thread here some months back filled 
with glee at the prospect of inventing dozens of new ways to call a 
function or set a property made me cry at the prospect of having to 
teach all that to someone.

If we were to expand the range of functions that can be called with 
property syntax, at some point we'd be faced with those that have more 
arguments than we can gracefully (or certainly intuitively) string out 
into an "English-like" statement.

And even for those we could accommodate, consider:

   put the offset of "l" in "hello" starting at 2

..as an alternative to the delightfully concise:

   put offset("l", "hello", 2)

And what happens to the scripter who guesses incorrectly that the 
statement would be:

   put the offset of "l" in "hello" beginning with 2

..or:

   put the offset of "l" in "hello" beginning with position 2

..or:

   put the offset of "l" in "hello" beginning with character 2

..or:

   put the offset of "l" in "hello" beginning after character 2

...or:

   put the offset of "l" in "hello" beginning with the second character

..or:

   skipping the first 2 characters, how many characters in "hello" can I 
find "l"

Who has the time to define all those templates, and how big would the 
engine be that contained them?

Even just putting in the meta-rules that would define such templates 
would be a massive beast, or at least complex enough that, honestly, I'd 
rather see the time spent on other priorities (reliable startTime for 
QT-free media playback anyone?).

As one (possibly irrelevant) example, ever look at how much code is 
needed for something as relatively simple as a Porter stemmer?  The 
necessary meta-rules which could obviate the need to define fixed 
templates would turn stemming into true lemmatization - which is why few 
programs attempt lemmatization, cheating with the crudeness of stemming 
instead.

With LC functions, so simple instead to just say functions require parens.

Sure, you need to know the args, but if you don't know what a function 
is for why would you be using it anyway?

I would caution that attempting to make a system that doesn't require 
learning risks being cumbersome if it's even possible at all.

Some things just requiring learning.  Let's keep the number of things 
that have to be learned small, and the rest will take care of itself.

If remembering argument positions is the challenge, I'd love to see 
named args, like we see with XML attributes:

   offset(searchterm="l" searchedText="hello" start=2)

Named arguments would have many useful applications, while creating an 
ever-expanding game of hunt-the-parser seems less productive.

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