On 2017-06-26 01:42, Monte Goulding via use-livecode wrote:
On 25 Jun 2017, at 1:37 am, Richard Gaskin via use-livecode <use-livecode@lists.runrev.com> wrote:

How many of you have never before known that commas are optional between definition arguments?

I have seen it before in user scripts but never used it myself. It’s
one of those things you discover (like when {} could be used
interchangeably with []) that you quickly realise you should never
rely on so you forget pretty quickly ;-)

It is a HyperCard or SuperCard script compatibility thing I believe...

The ability to not have commas in the parameter declaration list does no real harm, although as a couple of people have pointed out means error detection in that specific case is less 'strong' so is probably best avoided for that reason, if no other.

FWIW it actually wouldn’t be _that_ hard to add the ability to specify
some syntactic sugar to your handlers and have the parser ignore said
sugar:

e.g:

command Foo “with” pBar

end Foo

Foo with pBar

However this is somewhat less than and conflicts with the open
language concept so it’s probably best not to consider it too
seriously.

That suggestion is essentially the same as Richard's - whilst it is certainly an idea it means that errors in syntax can't be detected except at runtime (as you can have multiple handlers processed in the message path, and they can change dynamically). Also, in the case of just passing through 'keywords' as string literals you are moving parsing into the command handler - which means that parsing is then on the onus of the script writer, which means just making more work for scripts for what is probably of little benefit.

There's also an issue in that you can't really use any connecting words which are used to form expressions:

  doSomething dA and dB and dC

There's no way to know (with the 'ignore connectives' idea) how to process this - dA and dB (and all combinations) is a valid boolean expression. So in this case I might mean a command taking two parameters (ignoring 'and' in the first or second case), or one taking one parameter (dA and dB and dC).

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to