Re: Idea for 'documenting' unused values
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 20, 2004
- 492 views
cklester wrote: > > Derek Parnell wrote: > > > > In other words, whenever you want to tell people who read your code, that > > you are deliberately ignoring a value (eg. a parameter or function return), > > you just wrap it inside 'ignore()'. > > The "old way" is faster and just as clean (if not cleaner, just by > saving keystrokes and the overhead of one or more function calls). > > VOID = Foo(12,2) > > Even IGNORE = Foo(12,2) is one keystroke and two function calls > less than the proposed ignore(). > > Maybe you could provide a good example that would clearly show a > distinct benefit of ignore(). I was trying to create a single approach to handle TWO different situations. One is when you want to ignore a function return value. And the other is when you want to ignore passed parameters. Currently we use two or more different ways to handle these situations. For ignoring function returns, the common methods are ... x = func( . . . ) where 'x' is commonly called VOID or junk or whatever... Another method is ... if func( .. . .) then end if But that only works for atomic return values. For ignoring parameters we have our good friend 'without warning'. The problems with this is that it can accidently hide warnings we *are* concerned about (because we forget to turn warnings back on). It also turns off other warning messages that having nothing to do with unused parameters -- such as unused local constants, or functions without any return value, etc... My approach, with ignore(), handles both situations and is very specific about what we are doing and with what we are doing it to. How many people have ways around all those warnings that are generated by using Win32lib event handlers? global procedure Click_Button(integer self, integer event, sequence parms) Most of these handlers never use 'self' or 'event' and only sometimes use 'parms'. -- Derek Parnell Melbourne, Australia