Re: [U2] Why did this compile??
Out of curiosity, how many people avoid VARanything It's certainly one of the things that used to trip up students when I used to teach UniVerse. There was always at least one instance in any class when someone would hit it and wonder why their program compiled and was operating in the way that it did, simply because they had forgotten to type an operator: so on the one hand, being used to it, I've grown to like it - but it is confusing, especially as there is no equivalent null operator that I can think of in any other language. So a $OPTION to turn it off would get my vote. As would a $OPTION EXPLICIT and a $OPTION CASE.INSENSITIVE. Having the ability to create variables without declaring them is great, but I had a brilliant programmer once who just couldn't type .. so in the end I wrote a routine to code check and warn for variable and case transpositions like CustList to Custlist.. Adding $OPTIONS specifically to strengthen code would be a good thing, and shouldn't raise any objections as they would only *be* options. Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
Cache has a $OPTION that makes identifiers in mvbasic case-insensitive (it has no effect on string literals or expression evaluation though so ONE=one is still untrue). reserved words are already case-insensitive as they are in universe and are in unidata with a compile time flag. I don't think anyone has a $OPTIONS EXPLICIT though. That would be nice. On unidata (and I think universe) you can have the compiler print a symbol table so it's easy enough to find mistyped identifiers if you want to, but the compiler itself doesn't warn on it. Would be nice. On Jun 10, 2012, at 7:08 AM, Brian Leach wrote: Out of curiosity, how many people avoid VARanything It's certainly one of the things that used to trip up students when I used to teach UniVerse. There was always at least one instance in any class when someone would hit it and wonder why their program compiled and was operating in the way that it did, simply because they had forgotten to type an operator: so on the one hand, being used to it, I've grown to like it - but it is confusing, especially as there is no equivalent null operator that I can think of in any other language. So a $OPTION to turn it off would get my vote. As would a $OPTION EXPLICIT and a $OPTION CASE.INSENSITIVE. Having the ability to create variables without declaring them is great, but I had a brilliant programmer once who just couldn't type .. so in the end I wrote a routine to code check and warn for variable and case transpositions like CustList to Custlist.. Adding $OPTIONS specifically to strengthen code would be a good thing, and shouldn't raise any objections as they would only *be* options. Brian ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
On 07/06/12 21:24, Tony Gravagno wrote: When I was working at Pick Systems I found that anything can be passed into format masks from BASIC, OCONV, or an F-correlative. If it doesn't blow up some code deep down in the parser then it's just ignored. I think the theory is that if someone knows enough to get down that far into the bowels of the system then they'll be able to diagnose errors resulting from faulty codes. It's sort of like not putting a Be careful of falling trees sign in a forest where lumberjacks work. The compiler doesn't know that ~ is an invalid mask, since that's a runtime feature. So VARanything will compile, which is unfortunate because it's probably safe to say that ALL of us have tripped on this exact same issue at some point, maybe every few months for some of us. I guess the only thing that amazes me is that none of the MVDBMS providers (to my knowledge) have ever added an optional runtime trap or log option when an invalid mask is detected at runtime - seems like they're all just missing a Case 1 or Case True fall-through condition. Which is why I always use what some people might consider excessive whitespace ... TEST.STRING = TRIM(LINE1) : ~ : TRIM(LINE3) ~ : TRIM(LINE4) The missing colon is a bit more obvious here ... And again, Primeisms, but Primos packed whitespace fairly well. If you told the OS that something was a text file, a string of spaces of any length only took two bytes - DC1,n - where n was the number of spaces. So I tend to be pretty free with whitespace. I find the Unix way of using tabs quite a pain ... Cheers, Wol ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
Ditto, I have found using liberal white space has saved me a lot of trouble over the years. Plus now that my eyes are 'of a certain age' I appreciate even more the habit of an easy-read coding style. Marc Rutherford Principal Programmer Analyst Advanced Bionics LLC 661) 362 1754 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists Sent: Friday, June 08, 2012 4:20 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Why did this compile?? On 07/06/12 21:24, Tony Gravagno wrote: When I was working at Pick Systems I found that anything can be passed into format masks from BASIC, OCONV, or an F-correlative. If it doesn't blow up some code deep down in the parser then it's just ignored. I think the theory is that if someone knows enough to get down that far into the bowels of the system then they'll be able to diagnose errors resulting from faulty codes. It's sort of like not putting a Be careful of falling trees sign in a forest where lumberjacks work. The compiler doesn't know that ~ is an invalid mask, since that's a runtime feature. So VARanything will compile, which is unfortunate because it's probably safe to say that ALL of us have tripped on this exact same issue at some point, maybe every few months for some of us. I guess the only thing that amazes me is that none of the MVDBMS providers (to my knowledge) have ever added an optional runtime trap or log option when an invalid mask is detected at runtime - seems like they're all just missing a Case 1 or Case True fall-through condition. Which is why I always use what some people might consider excessive whitespace ... TEST.STRING = TRIM(LINE1) : ~ : TRIM(LINE3) ~ : TRIM(LINE4) The missing colon is a bit more obvious here ... And again, Primeisms, but Primos packed whitespace fairly well. If you told the OS that something was a text file, a string of spaces of any length only took two bytes - DC1,n - where n was the number of spaces. So I tend to be pretty free with whitespace. I find the Unix way of using tabs quite a pain ... Cheers, Wol ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
A Pickism, not a Prime-ism. Prime demanded that you say FMT( TRIM( LINE3, ~ ) if that's what you meant. VLIST the program it will be obvious how it compiled. cds On 6/7/2012 1:47 PM, David Wolverton wrote: Look at this line of code... TEST.STRING = TRIM(LINE1):~:TRIM(LINE3)~:TRIM(LINE4) See how it is missing the : between3)~ ?? Neither did I ... and the program compiled and ran without a complaint in UniData 7.2.12 -- but Obviously I was getting bogus results on the other side!! I'm trying to figure out why this was 'allowed' ... I'm ready this and thinking this should have tripped a compile message of SOME type! Just one of those 'how weird is this' things I thought I'd share since it cost me about an hour to find!! DW ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
I believe that it saw the second tilde as a format string. On 6/7/2012 2:47 PM, David Wolverton wrote: Look at this line of code... TEST.STRING = TRIM(LINE1):~:TRIM(LINE3)~:TRIM(LINE4) See how it is missing the : between 3)~ ?? Neither did I ... and the program compiled and ran without a complaint in UniData 7.2.12 -- but Obviously I was getting bogus results on the other side!! I'm trying to figure out why this was 'allowed' ... I'm ready this and thinking this should have tripped a compile message of SOME type! Just one of those 'how weird is this' things I thought I'd share since it cost me about an hour to find!! DW ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
Exactly correct... ~:TRIM(LINE4) would be used as an output formatting string. Just like TEST.STRING = 12345.678R2#10 would result in the string 12345.68 ... david ... David L. Wasylenko President, Pick Professionals, Inc w) 314 558 1482 d...@pickpro.com -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Allen Egerton Sent: Thursday, June 07, 2012 2:16 PM To: U2 Users List Subject: Re: [U2] Why did this compile?? I believe that it saw the second tilde as a format string. On 6/7/2012 2:47 PM, David Wolverton wrote: Look at this line of code... TEST.STRING = TRIM(LINE1):~:TRIM(LINE3)~:TRIM(LINE4) See how it is missing the : between 3)~ ?? Neither did I ... and the program compiled and ran without a complaint in UniData 7.2.12 -- but Obviously I was getting bogus results on the other side!! I'm trying to figure out why this was 'allowed' ... I'm ready this and thinking this should have tripped a compile message of SOME type! Just one of those 'how weird is this' things I thought I'd share since it cost me about an hour to find!! DW ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Why did this compile??
When I was working at Pick Systems I found that anything can be passed into format masks from BASIC, OCONV, or an F-correlative. If it doesn't blow up some code deep down in the parser then it's just ignored. I think the theory is that if someone knows enough to get down that far into the bowels of the system then they'll be able to diagnose errors resulting from faulty codes. It's sort of like not putting a Be careful of falling trees sign in a forest where lumberjacks work. The compiler doesn't know that ~ is an invalid mask, since that's a runtime feature. So VARanything will compile, which is unfortunate because it's probably safe to say that ALL of us have tripped on this exact same issue at some point, maybe every few months for some of us. I guess the only thing that amazes me is that none of the MVDBMS providers (to my knowledge) have ever added an optional runtime trap or log option when an invalid mask is detected at runtime - seems like they're all just missing a Case 1 or Case True fall-through condition. T From: David L. Wasylenko Exactly correct... ~:TRIM(LINE4) would be used as an output formatting string. Just like TEST.STRING = 12345.678R2#10 would result in the string 12345.68 From: Allen Egerton I believe that it saw the second tilde as a format string. David Wolverton wrote: TEST.STRING = TRIM(LINE1):~:TRIM(LINE3)~:TRIM(LINE4) See how it is missing the : between 3)~ ?? Neither did I ... and the program compiled and ran without a complaint ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users