Idea for 'documenting' unused values
Any thoughts about this idea...?
I created an include file (ign.e) that contains ...
without warning
global procedure ignore(object x)
end procedure
with warning
then use it like this ...
include ign.e
function Foo(integer a, integer b)
ignore(a)
ignore(b)
return 0
end function
ignore(Foo(12,2))
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()'.
I *know* it adds the overhead of a useless call, but maybe that's worth
it in the long run. It would be nice if this functionality was built-in
to the language/interpreter.
--
Derek Parnell
Melbourne, Australia
|
Not Categorized, Please Help
|
|