Re: Key word suggestions?

Hans Christian Falkenberg <[email protected]> Mon, 8 Sep 2008 23:35:45 +0200 (CEST)
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <[email protected]>
Dunno, I didn't even check if CA1716 specifically complains about "using".
I just know that it complains about keyword clashes, which in my
opinion is a valid complaint, because of syntax highlighting
and understandability.

But certainly there are many FxCop violations in .NET libraries,
which is at least part reason of why FxCop was created*

Probably it will complain about List<T>.ForEach as well,
but just because someone has erred in the past doesn't
mean that we shouldn't make attempts to do better in new
libraries :)

+ Hans Christian

*http://blogs.msdn.com/fxcop/archive/2004/01/08/48853.aspx

On Mon, 8 Sep 2008, Vaughn, Clifton wrote:

> This is a pretty interesting point.  I don't have FxCop, but what does
> it say about List<T>.ForEach()?
>
> Thanks
>
> cliff
>
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On
>> Behalf Of Charlie Poole
>> Sent: Monday, September 08, 2008 4:05 PM
>> To: 'Hans Christian Falkenberg'
>> Cc: [email protected]
>> Subject: Re: [nunit-developer] Key word suggestions?
>>
>> Hi Hans Christian,
>>
>>>> I'm pretty sure there's no confusion with C# using.
>>>
>>> Except in poor syntax highlighters. Which I'm sure there
>> are at least
>>> a couple of (think code posted on the web).
>>> FxCop warns against this (CA1716)
>>> http://msdn.microsoft.com/en-us/library/ms182248(VS.80).aspx
>>>
>>> Indeed if you look at the MS documentation shipped with
>> Visual Studio
>>> for System.Random.Next(), the Visual Basic code example incorrectly
>>> highlights the method as a keyword.
>>>
>>> My vote is on UsingComparer because it avoids keywords clashes and
>>> makes it perfectly clear what it is you are using from a glance.
>>
>> Point taken. I'll not use using. :-)
>>
>> Charlie
>>
>>> + Hans Christian
>>>
>>>> Charlie
>>>>
>>>>> -----Original Message-----
>>>>> From: [email protected]
>>>>> [mailto:[email protected]] On
>>> Behalf Of
>>>>> Olof Bjarnason
>>>>> Sent: Monday, September 08, 2008 12:08 PM
>>>>> To: Charlie Poole
>>>>> Cc: [email protected]
>>>>> Subject: Re: [nunit-developer] Key word suggestions?
>>>>>
>>>>> 2008/9/8 Charlie Poole <[email protected]>:
>>>>>> Hi Olof,
>>>>>>
>>>>>> A good idea... here are two sets using different constraints
>>>>>>
>>>>>>  Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
>>>>>>  Assert.That( data,
>> Is.EqualTo(expected).CompareWith(myComparer);
>>>>>>  Assert.That( data, Is.EqualTo(expected).Using(myComparer);
>>>>>>  Assert.That( data,
>> Is.EqualTo(expected).UseComparer(myComparer);
>>>>>
>>>>> Just playing a little:
>>>>>
>>>>> Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
>>>>> Assert.That( data,
>> Is.EqualTo(expected).UsingComparer(myComparer);
>>>>> Assert.That( data,
>>> Is.EqualTo(expected).WhereEqualMeans(myComparer);
>>>>>
>>>>>
>>>>>>        etc.
>>>>>>
>>>>>> and
>>>>>>
>>>>>>  Assert.That(myCollection,
>>> Is.OrderedBy("Key").Comparer(myComparer);
>>>>>>  Assert.That(myCollection,
>>>>>> Is.OrderedBy("Key").CompareWith(myComparer);
>>>>>>  Assert.That(myCollection,
>> Is.OrderedBy("Key").Using(myComparer);
>>>>>>  Assert.That(myCollection,
>>>>>> Is.OrderedBy("Key").UseComparer(myComparer);
>>>>>
>>>>> Assert.That(myCollection,
>>>>> Is.OrderedBy("Key").UsingComparer(myComparer);
>>>>>
>>>>> Reading it aloud:
>>>>>
>>>>> 'Assert that myCollection is ordered by "Key" using comparer
>>>>> myComparer'
>>>>>
>>>>> If forced to choose one for both scenarios my choice would be
>>>>> "UsingComparer", even though it is not on your original list :)
>>>>>
>>>>>
>>>>>>      etc.
>>>>>>
>>>>>> Currently those are the only two places where this modifier
>>>>> is used,
>>>>>> but I see making more use of it in future. My working
>>> assumption is
>>>>>> that it will generally be easier for users if we use the
>>>>> same word in
>>>>>> all cases, even though they are technically independent.
>>>>>>
>>>>>> Charlie
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Olof Bjarnason [mailto:[email protected]]
>>>>>>> Sent: Monday, September 08, 2008 10:51 AM
>>>>>>> To: Charlie Poole
>>>>>>> Cc: [email protected]
>>>>>>> Subject: Re: [nunit-developer] Key word suggestions?
>>>>>>>
>>>>>>> Charlie could we get a complete line of sourcecode to make
>>>>> a better
>>>>>>> judgement..?
>>>>>>>
>>>>>>> 2008/9/6 Charlie Poole <[email protected]>:
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> EqualConstraint takes a modifier "Comparer(IComparer
>>>>>>> comparer)", which
>>>>>>>> causes the specified IComparer to be used when testing
>>>>> for equality.
>>>>>>>>
>>>>>>>> This same feature is being added in other constraints, like
>>>>>>>> OrderedCollectionConstraint.
>>>>>>>>
>>>>>>>> Before we get too many of them, I want to ask if "Comparer"
>>>>>>>> is the best way to express this. Other options that
>>> come to mind
>>>>>>>> are
>>>>>>>>
>>>>>>>>  CompareWith(IComparer)
>>>>>>>>  CompareUsing(IComparer)
>>>>>>>>  UseComparer(IComparer)
>>>>>>>>  Using(IComparer)
>>>>>>>>  ...
>>>>>>>>
>>>>>>>> It's a smallish issue, but I thought I'd ask.
>>>>>>>>
>>>>>>>> Charlie
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>
>> ---------------------------------------------------------------------
>>>>>>> -
>>>>>>>> --- This SF.Net email is sponsored by the Moblin Your Move
>>>>>>> Developer's
>>>>>>>> challenge Build the coolest Linux based applications with
>>>>>>> Moblin SDK &
>>>>>>>> win great prizes Grand prize is a trip for two to an Open
>>>>>>> Source event
>>>>>>>> anywhere in the world
>>>>>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>>>>>> _______________________________________________
>>>>>>>> nunit-developer mailing list
>>>>>>>> [email protected]
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --------------------------------------------------------------
>>>>> -----------
>>>>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's
>>>>> challenge Build the coolest Linux based applications with
>>> Moblin SDK
>>>>> & win great prizes Grand prize is a trip for two to an
>> Open Source
>>>>> event anywhere in the world
>>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>>> _______________________________________________
>>>>> nunit-developer mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>> ----------------------------------------------------------------------
>>>> --- This SF.Net email is sponsored by the Moblin Your Move
>>> Developer's
>>>> challenge Build the coolest Linux based applications with
>>> Moblin SDK &
>>>> win great prizes Grand prize is a trip for two to an Open
>>> Source event
>>>> anywhere in the world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> nunit-developer mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>>>
>>>
>>> --------------------------------------------------------------
>>> -----------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge Build the coolest Linux based applications with
>> Moblin SDK &
>>> win great prizes Grand prize is a trip for two to an Open
>> Source event
>>> anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> nunit-developer mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>>
>>
>>
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge Build the coolest Linux based
>> applications with Moblin SDK & win great prizes Grand prize
>> is a trip for two to an Open Source event anywhere in the
>> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> nunit-developer mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/