ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Inc() does not work with external variables #451

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a TdwsUnit.  Declare a variable in it of type Variant, and assign 
Read and Write handlers that track some external variable.
2. Create a script that can see this unit
3. Call inc() on this variable, or use a += or similar operator.

What is the expected output? What do you see instead?
Expected: this should work.
Observed: Syntax Error: ":=" expected

What version of the product are you using?
SVN r2362

Original issue reported on code.google.com by anthony....@gmail.com on 23 Dec 2013 at 3:12

GoogleCodeExporter commented 8 years ago
Inc() requires a "var" parameter, external variables are more like global 
properties, which don't support Inc() either.

And compound operators currently have some unresolved ambiguities in the two 
flavors of Pascal that support them, namely FreePascal and Oxygene resolve them 
differently for properties (for FreePascal "a+=1" is "a:=a+1" while Oxygene is 
more "a.Add(1)"), so at the moment DWScript doesn't allow compound operators on 
properties, until the ambiguity is resolved/decided upon.

Original comment by zar...@gmail.com on 23 Dec 2013 at 8:43

GoogleCodeExporter commented 8 years ago
At the risk of looking ignorant, what's the difference and why is it 
significant?  Assuming that A is an integer and not something with exotic 
overload tricks, it doesn't seem like it would make any difference.

Original comment by anthony....@gmail.com on 23 Dec 2013 at 5:20