[Mono-dev] "AvoidBadAsCast" Gendarme rule? (was: Re: [PATCH] The big "as" cast cleanup)
sebastien.pouliot at gmail.com
Sun Jan 13 16:37:48 EST 2008
On Sun, 2008-01-13 at 19:25 +0100, "Andrés G. Aragoneses" wrote:
> Miguel de Icaza escribió:
> >> I don't like to change working code unnecessarily just for your
> >> preference. I'd wait for another patch that removes any extra changes.
> > I agree with Atsushi's statement, and also:
> >> Personally I like as operator which sometimes makes the sources
> >> more readable and kind enough for code completion depending on
> >> the editor/IDE.
> > miguel.
> Hey Miguel, I don't agree :)
> Readability is a good thing, but not when it makes your code incorrect.
> Nobody should use "as" if afterwards there is not a check to see if the
> result is null or not. BTW, maybe this is a good candidate for a
> Gendarme rule?
Yes it is. I'm forwarding the idea to gendarme's mailing-list - but it
would be even better if you want to contribute the rule too ;-)
p.s. Seo Sanghyeon already emailed another rule based on the same "big
as cleanup" (to prefer using "is" then "as + null check" ;-)
More information about the Mono-devel-list