Could I add that discussing data typing in MV Basic may not change what we cannot control. The absense of true data typing, ie A, A$, A% or DIM A AS STRING 50 is both a blessing and a curse. Such loose assignments only makes us better and more careful programmers. This is one thing I enjoy about MV in that files and records can be freely copied. I've got many frustrated experiences trying to import/export/merge data in typed environments like MS Access or SQL.
My 1 cent. ----- Original Message ----- From: "Mitchell, Stewart" <[EMAIL PROTECTED]> To: "'U2 Users Discussion List'" <[EMAIL PROTECTED]> Sent: Wednesday, March 31, 2004 3:30 PM Subject: RE: Data typing in MV Basic > Wol, > > It is not how the compiler deals with the information but how the runtime > engine deals with the data. > I have demonstrated the runtime engine types the data based on how it is > entered in the source code. > A = 1 is typed as a numeric by the runtime engine and A = "1" is typed as a > string. In an earlier > post I provided the following proof. > > TST > 0001 DEBUG > 0002 A = 1 > 0003 A = "1" > 0004 STOP > >RUN XP TST > TST: 2: A = 1 > :: S > TST: 3: A = "1" > :: A/ > INTEGER: 1 > :: S > TST: 4: STOP > :: A/ > STRING: T r L=1 `1' > :: > > The program simply sets the variable A to 1 or "1" and when run it goes in > to debug mode. > I then stepped through each line and displayed the contents of the variable > A by typing A/ as you can > see the runtime engine reports each line as INTEGER or STRING depending on > how the data was entered in the > source code. > > Regards, > Stewart > > -----Original Message----- > From: Anthony Youngman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 31 March 2004 19:15 > To: U2 Users Discussion List > Subject: RE: Data typing in MV Basic > > > Why? > > Let's work on the basic principal of "coercion occurs when necessary, > and not before". > > The compiler detects "1" as a string literal. It stores it as a literal. > The compiler detects 1 as a numeric literal. It stores it as a literal. > (The compiler doesn't give a damn about strings or numerics - a literal > is a literal is a literal) > > Therefore 'A = 1' and 'A = "1"' both result in IDENTICAL p-code. > > Therefore, unless you know how the compiler works, your conclusion is > demonstrably flawed. > > Cheers, > Wol > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Mitchell, Stewart > Sent: 31 March 2004 08:31 > To: 'U2 Users Discussion List' > Subject: RE: Data typing in MV Basic > > A = 1 is held as an integer > A = "1" is held as a string > A = "1" + 0 is held as an integer > > Cheers, > Stewart > > -----Original Message----- > From: Anthony Youngman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 31 March 2004 17:00 > To: U2 Users Discussion List > Subject: RE: Data typing in MV Basic > > > You've missed the point! :-) > > These two statements apparently have exactly the same effect - the > question is do they? > > A = 1 > A = "1" > > (In the stuff I'm writing, they'd be the same - everything is a string > until it is forced into numeric.) > > Cheers, > Wol > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Jim Garratt > Sent: 31 March 2004 07:39 > To: U2 Users Discussion List > Subject: Re: Data typing in MV Basic > > Would this not be set by your initialisation of the variable A. > > eg A = '' ;*Alpha/Numeric or String > A = 0 ; Numeric > > > ----- Original Message ----- > From: "Trevor Ockenden" <[EMAIL PROTECTED]> > To: "U2 Users Discussion List" <[EMAIL PROTECTED]> > Sent: Wednesday, March 31, 2004 2:25 PM > Subject: Re: Data typing in MV Basic > > > > Will, I stand corrected on that one. So far in 20 odd years of > programming > > in MV I haven't needed to worry about it. > > > > Now Will raises a terrific question. If A = "1" assigns 1 as numeric. > How > > would you determine if A contained a numeric or a string in this case? > > > > My short answer is - why would I need to know? BUT I'm sure somebody > has a > > good answer to that one. > > > > Cheers > > > > Trevor Ockenden > > Open Systems Professionals > > > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, March 31, 2004 4:10 PM > > Subject: Re: Data typing in MV Basic > > > > > > > In a message dated 3/30/2004 8:19:18 PM Pacific Standard Time, > > > [EMAIL PROTECTED] writes: > > > > > > > > > > A = 1 assigns a numeric integer. The expression need not contain > > operators > > > > (+,-,etc) to be numeric. > > > > A = "1" assigns a string however, as you have explicitly declared > it > to > > be > > > > string. > > > > A = "1" + 2 assigns a numeric integer value (3) as the result is > > numeric. > > > > A = "one" + 2 assigns a zero - according to the error message. > > > > > > yes > > > no > > > yes > > > yes > > > > > > they all assign numerics imho > > > "1" is cast as a numeric because the system is smart enough to > realize > its > > a > > > numeric string and has no purpose casting it as a string > > > Any idea how to test which it is? > > > Will > > > -- > > > u2-users mailing list > > > [EMAIL PROTECTED] > > > http://www.oliver.com/mailman/listinfo/u2-users > > > > > > > > > --- > > Outgoing mail is certified Virus Free by AVG 6.0. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.642 / Virus Database: 410 - Release Date: 25/03/2004 > > > > -- > > u2-users mailing list > > [EMAIL PROTECTED] > > http://www.oliver.com/mailman/listinfo/u2-users > > -- > u2-users mailing list > [EMAIL PROTECTED] > http://www.oliver.com/mailman/listinfo/u2-users > > > > > ************************************************************************ > **** > ******* > > This transmission is intended for the named recipient only. It may > contain > private and confidential information. If this has come to you in error > you > must not act on anything disclosed in it, nor must you copy it, modify > it, > disseminate it in any way, or show it to anyone. Please e-mail the > sender to > inform us of the transmission error or telephone ECA International > immediately and delete the e-mail from your information system. > > Telephone numbers for ECA International offices are: Sydney +61 (0)2 > 9911 > 7799, Hong Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York > +1 > 212 582 2333. > > ************************************************************************ > **** > ******* > > -- > u2-users mailing list > [EMAIL PROTECTED] > http://www.oliver.com/mailman/listinfo/u2-users > -- > u2-users mailing list > [EMAIL PROTECTED] > http://www.oliver.com/mailman/listinfo/u2-users > > > -- > u2-users mailing list > [EMAIL PROTECTED] > http://www.oliver.com/mailman/listinfo/u2-users > -- > u2-users mailing list > [EMAIL PROTECTED] > http://www.oliver.com/mailman/listinfo/u2-users -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
