Odd TADS 2 compiler error

I’m writing a small modification to the Thing class in TADS 2 that will allow the player to push things to another room. However, whenever I compile the source, I get the message “error TADS-300: expected semicolon.” Below is the code in question:

modify thing
allowPushDir(actor) = {
local v = parserGetObj(PO_VERB);
local d = parserGetObj(PO_DOBJ);
local mvl, dl, dvl, i;

mvl = [ moveEVerb moveNVerb moveWVerb moveSVerb
         moveNEVerb moveNWVerb moveSEVerb moveSWVerb ]
dl = [ &east, &north, &west, &south, &ne, &nw, &se, &sw ]
dvl = [ eVerb nVerb wVerb sVerb
        neVerb nwVerb seVerb swVerb ]
i = find(mvl, v)

if (i) {
  if (proptype(actor.location, dl[i])) != DTY_NIL) {
    execCommand(actor, dvl[i]);
} else {
  if (v == moveUVerb || v == moveDVerb) {
    "Not that way %you% can't. "; break;
  } else {
    "That's not a direction. "; return nil;

[/code]The compiler always points the error at the line where I have “dl = [ &east, &north,…,&sw ]” which I find odd - it’s a list definition, and TADS 2 usually does not require semicolons at the end of those statements AFAIK. The verbs moveEVerb, moveNVerb, etc. are verbs I defined to allow something like

doMoveN(actor) = { self.allowPushDir(actor); } to work by adding an empty verDo method (say, verDoMoveN(actor)) on the intended object. The empty verDo method then allows the player to push the object northward.

I do have #pragma C+ and case sensitivity set for this WIP’s source code, if that helps. Thanks in advance!

You need to terminate statements with semicolons. An assignment is a statement. This:

mvl = [ moveEVerb moveNVerb moveWVerb moveSVerb moveNEVerb moveNWVerb moveSEVerb moveSWVerb ]
is not a list definition. Only the part after the assignment operator is a list definition. In whole, it’s an assignment (you’re assigning the list to the “mvl” variable.) Therefore you need to terminate it properly.

Right. I’m probably used to seeing list assignments as part of an object’s properties (so naturally they won’t need semicolons to terminate). “mvl” is a local variable, so an assignment like this would still need that. :blush:

Thanks. :smiley:

Which is why I try to be consistent and use the same syntax everywhere. You can define and/or modify classes and objects like this:

modify thing { someProp = someVal; someFunc() = { /* ... */ } }

Which keeps it consistent. Allowing the second syntax (without the braces and semicolons) was, IMO, a design mistake. Simply because of the resulting inconsistency.

I don’t think that’s allowed in TADS 2. You probably mean TADS 3, right?

It isn’t? Man, I do forget quickly :stuck_out_tongue: