Rob Cameron wrote:
> Thanks Cosmin, Doug and Rob - all helpful suggestions which I shall
> incorporate
> in my coding.  Comments are all over my code, up to lengthy essays in
> method and
> unit headers - but even so it's quite easy to get complacent: "Yeah, that
> function always works OK", forgetting that it may have buried limitations
> that
> can't always be predicted and handled.
>
> I don't want to focus too much on the parameter type issue, even though
> that's
> what prompted me to post my question in the first place. Some methods may
> have
> (multiple) judgement calls (explicit and implicit) in the algorithms that
> are
> 'good enough' for the projects in hand but may not always be good enough.
> I want
> something that reminds me to check.
>
> One of the attractions to me of the redundant parameter is that it shows
> up at
> the actual moment I type in the method name and the code completion hint
> displays the parameters list. Instant reminder to check the comments, code
> and
> any docs I wrote.
>
> Is it possible to mark methods so that they raise home-made compiler
> warnings/hints?

You can mark a function as deprecated or platform-specific, which will
warn you each time you use it. You can use $WARN, I think, to make the
compiler print a warning when it encounters that directive.

You can also write unit tests for your functions. Then they'll fail, and
they'll be a constant reminder that your functions aren't finished yet --
as long as you're disciplined enough to run the unit tests on every
compile.

All these options mean you're going to get warning about things you have
no intention of fixing before you ship your product. You're going to grow
complacent about seeing compiler warnings, and then you're going to stop
paying attention to them altogether, so in addition to ignoring these
"intentional" warnings, you'll ignore the real ones, too.

-- 
Rob


_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to