RE: namespace
- Posted by Derek Parnell <Derek.Parnell at SYD.RABOBANK.COM> Jul 10, 2002
- 412 views
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C227F3.D7A69530 charset=iso-8859-1 > -----Original Message----- > From: Jiri Babor [mailto:jbabor at PARADISE.NET.NZ] > Subject: Re: namespace > > > > Hi, Derek! You wrote: > > >I believe that RDS is considering issuing a warning whenever > a declaration > >overrides another one. However, which behaviour are you > upset over - the > >missing warning or the overriding? > > > >I would like the overide functionality to continue. But I > wonder if, when we > >get the warning message facility, the programmer could code > something like > >... > > > > override constant a = 2 > > > >This would do two things: Skip the message being issued and > alert the reader > >of the code to the fact that the override is deliberate. > > I must admit I do not see your point in having this sort of > 'functionality'. If > the 'constant' is no longer a constant, make it into a > variable and simply > re-assign it. It's not so much that a 'constant' is changing value, but more that somebody is using the name I wanted to use. For example, if I use somebody's include file that just happens to contain the line ... global constant True = 1, False = 0 but in my program I also want to use these names, and I don't care what that somebody is using them for. constant True = ".T.", False = ".F." This is were overriding is useful. Because I no longer have to be concerned about the names that other people have chosen for identifiers. > The behaviour is also inconsistent: for instance we are not > allowed to override > user defined routines, where it would be, often, very useful. You are very correct here. The same principle should apply - I shouldn't have to worry about the names other people have chosen for identifiers, be they variables, constants or routines. However, a warning message would be nice to alert me to a possible mistake I might be making. > >Another point, Jiri. The style of coding you demonstrate > above, seems to say > >that you knew that 'a' had been declared in test.e (thus the > first "? a" > >command). You then declare another 'a', knowing that the > first one existed. > >The problem for a code reader is then - is this second > declaration a mistake > >or deliberate? > > Sorry, Derek, that was just an illustration, simplified. In > actual case I am > currently updating a large application with a number of > cascading includes, > cutting and pasting, also using several versions. It just > happened I had the > same constants (flags) declared at different levels with > slightly different > values - and it took me two days to trace the bug... Point taken. ---------- Derek. ================================================================== De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. ================================================================== The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail. ================================================================== ------_=_NextPart_000_01C227F3.D7A69530 Content-Type: application/ms-tnef