|
|||
|
Is there a tool for GTM to check variables in routine? The tool should catch every local variable declared, but not used or used but not declared. Because GTM does not have a good studio to check that, it is pretty common that a variable is declared but a different variable is actually used in thecode. That causes a lot of bugs. Thanks in advance!
|
|
|
||||
|
||||
|
|
|
|||
|
Dne středa, 8. srpna 2012 8:46:38 UTC+2 Andy napsal(a):
> Is there a tool for GTM to check variables in routine? Have you tried ZSHOW or $ZJOBEXAM()? It's not the only debugging tool, take a look here: http://www.mumps.cz/gtm/books/pg/UNI...l/ch02s02.html > The tool should catch every local variable declared, but not used or usedbut not declared. What do you mean by "declaration?" That they're New'd? ZSHOW "V" shows you only variables holding a value; I am not aware of any technique to discover undefined (New'd-only) variables. Would it make some sense to have such a tool? > Because GTM does not have a good studio to check that, What about Serenji and Gambas? http://www.georgejames.com/serenji http://eltranssoft.blogspot.cz/2012/...tm-gambas.html BTW, the best IDE is a well-configured ViM :-) > it is pretty common that a variable is declared but a different variable is actually used in the code. That causes a lot of bugs. Thanks in advance! How often do you work with N[ew] command? If the code is well structured, this should not happen daily. Not with N[ew]! Tom |
|
|||
|
I am creating new code/function every day. Most of the time, I declared a variable in the "new" statement at the top of a function. In the function,when I use the variable, I may have typo in the code which causes all kinds of error. So I need a tool to check a routine to report me any variable declared but not used or variables used but not declared. This is not a run time check. So zshow or zwr does not work.
What is ViM? Is it using Vi to edit M code? Thanks, andy |
|
|||
|
Dne středa, 8. srpna 2012 22:20:04 UTC+2 Andy napsal(a):
> I am creating new code/function every day. Most of the time, I declared a variable in the "new" statement at the top of a function. In the function, when I use the variable, I may have typo in the code which causes all kinds of error. So I need a tool to check a routine to report me any variable declared but not used or variables used but not declared. This is not a run time check. So zshow or zwr does not work. Ah, sorry, I've got it now! So you're looking for something like XINDEX routine from OpenVista then. Haven't tried it personally yet, but I guess it will be seriously tied with the rest of OpenVista.. > What is ViM? Is it using Vi to edit M code? :-) Well, its official name is Vi IMproved, but after few years using it for M development, I can confirm it's also Vi M-proved ;-) (GT.M and Cache) At the other hand, I know at least one person who wrote GT.M code in Cache Studio just to get features you're looking for... |
|
|||
|
On Thursday, August 9, 2012 1:51:50 PM UTC-7, Tomas Morstein wrote:
> Dne středa, 8. srpna 2012 22:20:04 UTC+2 Andy napsal(a): > > > I am creating new code/function every day. Most of the time, I declared a variable in the "new" statement at the top of a function. In the function, when I use the variable, I may have typo in the code which causes all kinds of error. So I need a tool to check a routine to report me any variable declared but not used or variables used but not declared. This is not a run time check. So zshow or zwr does not work. > > > > Ah, sorry, I've got it now! So you're looking for something like XINDEX routine from OpenVista then. Haven't tried it personally yet, but I guess itwill be seriously tied with the rest of OpenVista.. > > > > > What is ViM? Is it using Vi to edit M code? > > > > :-) Well, its official name is Vi IMproved, but after few years using it for M development, I can confirm it's also Vi M-proved ;-) (GT.M and Cache) > > At the other hand, I know at least one person who wrote GT.M code in Cache Studio just to get features you're looking for... I used Cache studio a lot in the past when working on Cache Mumps code. Itis a very nice tool. Hope someone can develop a tool like that. As of the variable check, since I only use GT.M, XINDEX may not work for you. I spent a couple days and wrote a small parser. It may not work for all scenario, but it is good enough for me to do variable validation. Thanks a lot for the help. Andy |
|
|||
|
On Tuesday, August 7, 2012 11:46:38 PM UTC-7, Andy wrote:
> Is there a tool for GTM to check variables in routine? The tool should catch every local variable declared, but not used or used but not declared. Because GTM does not have a good studio to check that, it is pretty commonthat a variable is declared but a different variable is actually used in the code. That causes a lot of bugs. Thanks in advance! A static code analysis tool like you describe is something that has been onmy mind for some time. I just haven't had the bandwidth to do anything about it. There are a lot of other useful things that a tool like this coulddo: * determining F S var=$O(....) Q:VAR="" scenarios * forgetting to New variables * referencing non-existent globals * etc MZ |
|
|||
|
On Friday, August 10, 2012 11:12:13 AM UTC-7, igotmumps wrote:
> On Tuesday, August 7, 2012 11:46:38 PM UTC-7, Andy wrote: > > > Is there a tool for GTM to check variables in routine? The tool shouldcatch every local variable declared, but not used or used but not declared.. Because GTM does not have a good studio to check that, it is pretty common that a variable is declared but a different variable is actually used inthe code. That causes a lot of bugs. Thanks in advance! > > > > A static code analysis tool like you describe is something that has been on my mind for some time. I just haven't had the bandwidth to do anything about it. There are a lot of other useful things that a tool like this could do: > > > > * determining F S var=$O(....) Q:VAR="" scenarios > > * forgetting to New variables > > * referencing non-existent globals > > * etc > > > > MZ If you have more request, post here. I am thinking or make one and share it with the group later. |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|