Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 20-Sep-2006 11:05
User is offline View Users Profile Print this message


Martin Erdelen

Posts: 15
Joined: 14-Aug-2006

Greetings,

this is just an undeclared war story for the benefits of future generations; the problem itself is solved.

I had a script which
  • worked just fine when loaded into the DXL Interaction window and run from there;
  • worked just fine when called from a module's User menu entry;
  • worked just fine when called from startup.dxl on starting the DOORS client.
but
  • crashed the client (both DOORS 7.1 and 8.1) when first run from startup.dxl, and then later run from the User menu. Message: "Internal error, please submit a problem report."

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:

  • Autodeclare function
    ("You should be beware of using the Autodeclare function of Doors. I think, it will not ever do what you wanted to do ", Reik Schroeder)

  • AutoDeclareToggle.dxl
    A nice tool from Louie Landale to switch AutoDeclare on and off as required.

  • XFLAGS_ and pragma
    ("The only XFLAG I have used is autoDeclare_. Everyone should use this." Tony Goodman)
    Indeed.


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
Report this to a Moderator Report this to a Moderator
 20-Sep-2006 22:05
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 21-Sep-2006 08:25
User is offline View Users Profile Print this message


Martin Erdelen

Posts: 15
Joined: 14-Aug-2006

quote:

Originally posted by: Louie Landale
 . . . Having so many alternatives for syntax is also near the top of the list...


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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.