![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Auto-declare: Yet Another Trap Topic Summary: a weird side effect of relying on auto-declare... Created On: 20-Sep-2006 11:05 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Greetings,
this is just an undeclared war story for the benefits of future generations; the problem itself is solved. I had a script which
After much "bracketing" *) of code and pulling of hair, the reason turned out to be an inadvertently "auto-declared" variable. Try this stress test at home: //start of test script int a int b a = 11 b = 22 c = a + b print a " + " b " = " c"\n" //end of test script a. run from DXL Interaction window: no worries; b. put into User menu and run from there: no worries; c. put call into startup.dxl and start client: no worries; d. let it run from startup.dxl and then call from User menu: Well? ![]() Rinse, declare "int c", and repeat. Related threads in this forum:
Q: Is this specific effect of auto-declare a known issue? (If so, my apologies for redundancy.) Q: Just for curiosity: Why is it happening? (startup.dxl scope including all of the ensuing session? But should that crash the client?) Bonus Q: Is there any kind of DXL debugger available, beyond print statements? (e.g. Eclipse integration would be nice! ![]() Cheers, Martin *) bracket: "The distance between two impacting shells, the first aimed beyond a target and the second aimed short of it, used to determine the range for artillery fire." (source) Edited: 20-Sep-2006 at 11:51 by Martin Erdelen |
|
![]() |
|
![]() |
|
Autodeclare has got to be near the top of disasterous features of modern computer languages; most of these features are designed to give so much 'flexibility' to need programmers that their code becomes 'write only code', disallowing its understandability and use by other folks.
Having so many alternatives for syntax is also near the top of the list: [1] if (i == 1) print "Yes" else print "No" [2] if i==1 then print "Yes" else print "no" [3] i==1? print "yes" : print "No" What's the point? OK, I feel better now. You cannot turn off autodeclare permanantly since most wizard created layouts make use of it. Also, there are programmers that insist that its their ACLU given rights to use such a feature and will not declare their variables out of some sort of dedication to 'freedom': what's the use of having options if you don't choose them? Putting stuff in 'startup.dxl' adds them to the top DXL context making them available to other DXL code. Thus, your a, b, and c are defined globally. You could, after doing that code in startup, run this from the DXL window: print "a = " a "\n" and it should print 11. Not sure why that would conflict with the Autodeclare of 'c'. DXL Debuggers? That would be Michael Sutherland. - Louie |
|
![]() |
|
![]() |
|
quote: Not to mention print (37 * random length lower name current Folder % length upper name getParentFolder current Module + 10 * level current Module) Quick: Is it valid DXL??? ![]() May look a little bit like "natural language English" (best read from right to left, though), which seems to be considered a plus. But can be very confusing, especially to the newcomer who doesn't yet know by heart all the keywords and functions, and particularly if something is a DXL keyword or function... Martin Edited: 21-Sep-2006 at 08:28 by Martin Erdelen |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Auto-declare: Yet Another Trap
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.