[Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
I have a question about how to protect against indirection errors. Imagine this function MyFunct(pRef) new result set result=$get(@pRef) quit result Here are some possible inputs and results: pRef InputOutput -- -- #1

[Hardhats-members] Needed - Physicians GMU students may interview

2006-02-11 Thread Nancy Anthracite
The students in the class I have been helping with at George Mason University have been asked to do a needs assessment for a physicians' office. I know that there are a number of physicians reading this list, so I would appreciate it if you would be willing to have a student interview you

Re: [Hardhats-members] conference call today?

2006-02-11 Thread JohnLeoZimmer
I recorded last week's excellent session... and missed yesterday because of disease and pestilance here in Iowa... Is there an ogg or mp3 available? jlz Did this one g Bhaskar, KS wrote: My understanding was that Rick Marshall would continue the discussion on preventing forking of VistA that

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread James Gray
You could try using DO ^DIM You would have to have Set X=Set RESULT=$Get(_PREF_) to get ^DIM to evaluate the string properly. Does this make sense? Jim - Original Message - From: Kevin Toppenberg [EMAIL PROTECTED] To: Hardhats Sourceforge hardhats-members@lists.sourceforge.net

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Jim Self
Kevin, What do you want to happen when the error is detected? Your third example would give a syntax error. I would expect this to be a programming error. In my work, it seems that the standard error response of logging the error and halting (or dropping back to the MUMPS shell) is generally

Re: [Hardhats-members] conference call today?

2006-02-11 Thread Nancy Anthracite
Hi John, Rick was not on the call to continue last weeks session, so hopefully, next time you, your recorder, and Rick will all be there! On Saturday 11 February 2006 12:58, JohnLeoZimmer wrote: I recorded last week's excellent session... and missed yesterday because of disease and pestilance

Re: [Hardhats-members] Needed - Physicians GMU students may interview

2006-02-11 Thread Kevin Toppenberg
Nancy, I can talk to students, but perhaps you are wanting physicians who have NOT already implemented it into an office? Kevin On 2/11/06, Nancy Anthracite [EMAIL PROTECTED] wrote: The students in the class I have been helping with at George Mason University have been asked to do a needs

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
Interesting. I'll check it out. On 2/11/06, James Gray [EMAIL PROTECTED] wrote: You could try using DO ^DIM You would have to have Set X=Set RESULT=$Get(_PREF_) to get ^DIM to evaluate the string properly. Does this make sense? Jim

Re: [Hardhats-members] Needed - Physicians GMU students may interview

2006-02-11 Thread Nancy Anthracite
I'll take anybody I can get. If I get more than 10, then we can pick an choose! On Saturday 11 February 2006 15:26, Kevin Toppenberg wrote: Nancy, I can talk to students, but perhaps you are wanting physicians who have NOT already implemented it into an office? Kevin On 2/11/06, Nancy

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
See below On 2/11/06, Jim Self [EMAIL PROTECTED] wrote: Kevin, What do you want to happen when the error is detected? I would want the function to have a chance to return a 'failure' value. Your third example would give a syntax error. I would expect this to be a programming error. Not

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Greg Kreis
On calling ^DIM, while it would protect most types of errors if used properly (unless the indirected statement had indirection in it ;-), would be really slow for any significant volume of calls. It is a MUMPS syntax parser written in MUMPS. This is the danger of dynamic, late binding unless

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Gregory Woodhouse
On Feb 11, 2006, at 4:59 PM, Greg Kreis wrote: This is the danger of dynamic, late binding unless you want to go to compile or on-the-fly compiling. But hey, along with the danger comes the great flexibility. Do you want to have your cake and eat it to? ;-) ;-) You can, but it

[Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Kevin Toppenberg
I have a question about the NEW and KILL command. I asked this question long ago, but want to revisit it. Image this code: new i,Var for i=1:1:10 do . kill Var . set Var=i . write Var,! My understanding of how variables are stored in M is to put them into a big symbol table. So I assume that

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gregory Woodhouse
On Feb 11, 2006, at 5:33 PM, Kevin Toppenberg wrote: Image this code: new i,Var for i=1:1:10 do . kill Var . set Var=i . write Var,! Try this: S X=1 D .N X .K X W X === Gregory Woodhouse [EMAIL PROTECTED] Nothing is as powerful than an idea whose time has come. -- Victor

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Kevin Toppenberg
Greg, Are you showing me a better way of coding, or answering my question? I'm not following you here. The result of the code should be 1 Kevin On 2/11/06, Gregory Woodhouse [EMAIL PROTECTED] wrote: On Feb 11, 2006, at 5:33 PM, Kevin Toppenberg wrote: Image this code: new i,Var

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gregory Woodhouse
On Feb 11, 2006, at 6:15 PM, Kevin Toppenberg wrote: Image this code: new i,Var for i=1:1:10 do . kill Var . set Var=i . write Var,! What do you accomplish with new i,Var in this code? === Gregory Woodhouse [EMAIL PROTECTED] Design quality doesn't ensure success, but design failure can

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Kevin Toppenberg
OK. Bad example. Here is a closer one to what I am working on. ... new Array,done set done=0 for do quit:done . kill Array . if $$UpdateInfo(.Array)=1 do SOMETHING . (more logic here) . set done=(some logic) So here we have Array NEW'ed outside the loop. Array is used primarily as an OUT

RE: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Gary Monger
You could validate the string to make sure it is a valid global reference. I'm sure there is a clever pattern match that would serve for most cases. If you want to handle variables in the string like ^VA(200,DUZ,0) you might need a loop. The error trap is faster to build, easier to prove correct

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gregory Woodhouse
On Feb 11, 2006, at 7:55 PM, Kevin Toppenberg wrote: OK. Bad example. Not really. Here is a closer one to what I am working on. ... new Array,done set done=0 for do quit:done . kill Array . if $$UpdateInfo(.Array)=1 do SOMETHING . (more logic here) . set done=(some logic) When you

RE: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gary Monger
NEW Array,done; Array and done pushed on the stack SET done=0; FOR DO Q:done ; DO pushes a new frame on the stack . ; If NEW variable here, value will pop with DO frame . KILL Array ; . I $$Up(.Array) D ...; Array is updated . set done=1 ; . Q

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Kevin Toppenberg
... When you NEW a variable, you basically create a fresh variable with the same name, that shadows the old value until the DO block or extrinsic call exits and the variable name is again associated with the old storage location. Think about it this way: your environment consists of a stack

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Kevin Toppenberg
On 2/11/06, Gary Monger [EMAIL PROTECTED] wrote: NEW Array,done; Array and done pushed on the stack SET done=0; FOR DO Q:done ; DO pushes a new frame on the stack . ; If NEW variable here, value will pop with DO frame . KILL Array ; . I $$Up(.Array) D

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
On 2/11/06, Gary Monger [EMAIL PROTECTED] wrote: You could validate the string to make sure it is a valid global reference. I'm sure there is a clever pattern match that would serve for most cases. If you want to handle variables in the string like ^VA(200,DUZ,0) you might need a loop. The

RE: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gary Monger
The DO inside the loop will create 1000 pushes and 1000 pops. The NEW will push VAR 1000 times. Its usually better to NEW outside the loop, and use SET/KILL inside the loop if you need to reset. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin

RE: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gary Monger
Right. Its killing the Array that you NEWED. The Array that existed before the NEW will still be restored when the bottom QUIT is done. When the frame that held the NEW is popped. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Toppenberg Sent:

RE: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Gary Monger
Check out $QS. If you are doing something dangerous, where the success of the operation is in question because it is beyond your control, you probably should be using an error trap. For example, virtually any device operation, anytime you want to execute strings input by a user, or use a

Re: [Hardhats-members] Making Fileman language independent?

2006-02-11 Thread Jim Self
Kevin wrote: Well, the more I have used M, the more I find that it is much easier to do the low level coding than it is to use the higher level interface. I think that says something significant-- I agree. One thing it says to me is that there could be better API's for programmers. since it

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
excellent, it looks like $qsubscript() is the function I was looking for. My function is not mission critical. I just want to screen for null nodes in a referenct, because $Get() won't protect against these. Thanks! Kevin On 2/12/06, Gary Monger [EMAIL PROTECTED] wrote: Check out $QS. If

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
Oops, that won't work: set x=^TMP(1,2,3,,5) w $ql(x) -- %GTM-E-NOCANONICNAME Value is not a canonic name (^TMP(1,2,3,,5)) w $q2(x,1) -- %GTM-E-NOCANONICNAME Value is not a canonic name (^TMP(1,2,3,,5)) Kevin On 2/12/06, Kevin Toppenberg [EMAIL PROTECTED] wrote: excellent, it looks like

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Kevin Toppenberg
That $q2 was really $qs. I had to hand copy the screen log. Sorry. Kevin On 2/12/06, Kevin Toppenberg [EMAIL PROTECTED] wrote: Oops, that won't work: set x=^TMP(1,2,3,,5) w $ql(x) -- %GTM-E-NOCANONICNAME Value is not a canonic name (^TMP(1,2,3,,5)) w $q2(x,1) -- %GTM-E-NOCANONICNAME

Re: [Hardhats-members] Protecting against indirection errors.

2006-02-11 Thread Jim Self
Kevin wrote: On 2/11/06, Jim Self [EMAIL PROTECTED] wrote: Kevin, What do you want to happen when the error is detected? I would want the function to have a chance to return a 'failure' value. Your third example would give a syntax error. I would expect this to be a programming error.

Re: [Hardhats-members] conference call today?

2006-02-11 Thread Chris Richardson
Dr. Zimmer; I was in class at the same time. I could not get there to record it. Next week I should make it. Chris - Original Message - From: JohnLeoZimmer [EMAIL PROTECTED] To: hardhats-members@lists.sourceforge.net Sent: Saturday, February 11, 2006 9:58 AM Subject: Re:

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Gregory Woodhouse
On Feb 11, 2006, at 9:02 PM, Kevin Toppenberg wrote: So in this code for i=1:1:1000 do . new VAR . set VAR=i Then the frame containing VAR is popped/discarded at the end of each loop, because the do block has concluded, right? We don't get 1000 pushes onto the stack, right? Thanks for you

Re: [Hardhats-members] KILL'ing and NEW'ing -- what's really happening?

2006-02-11 Thread Chris Richardson
It should be noted in this example that the pushes and pops only really push down to the next level and then pop right back up. They never get any deeper unless this code somehow becomes recursive. The dot level has an implied QUIT that pops the stack each time it gets pushed down. Recursion