Inconsistent comma requirements

Ralph DiMola rdimola at evergreeninfo.net
Sat Jun 24 13:20:37 EDT 2017


I have had several of these typos in the past and they never caused
problems. In the example below pParam is argument 1. The comma is ignored.

command test, pParam
   answer pParam
end test

The parser is much better in v8 but could still be tightened up a bit. An
example is extraneous closing parens in "if" or "repeat" expression
constructs are no longer ignored. They didn't cause parsing errors prior to
v8.

My comma in the above example is minor compared to the other LC goals at
hand for the team.


Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Richard Gaskin via use-livecode
Sent: Saturday, June 24, 2017 11:38 AM
To: How to use LiveCode
Cc: Richard Gaskin
Subject: Inconsistent comma requirements

Apparently commas are optional in a handler definition, e.g.:

    on DoSomething a b

But they are not optional when passing arguments to a definition, e.g.:

     Doomething a b

...throws a compilation error, but this:

     DoSomething a,b

...works.

Because most languages require commas separating arguments, and because
calling a handler explicitly requires them, it never occurred to me that the
definition would allow them to be optional.

Ideally the same rules would apply on both sides.

I can kinda understand why they don't here, but if we had comma-free
arguments we could add syntactic sugar to make things more English-like,
e.g.:

   DoSomething with a and b


Two questions:

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

For those who've known about this, were you confused to discover that this
only works for definitions but not calls?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

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





More information about the use-livecode mailing list