std.experimental.testing PR review

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 27 09:44:48 PDT 2015


On Friday, 26 June 2015 at 15:46:28 UTC, Dicebot wrote:
> On Friday, 26 June 2015 at 15:32:47 UTC, Jacob Carlborg wrote:
>> On 26/06/15 15:32, Dicebot wrote:
>>> Just in case it wasn't clear : I will vote "no" on this 
>>> proposal as long
>>> as it features longish "readable" names like "shouldEquals".
>>
>> You would vote "no" because of this?
>
> Totally. Remember - this is effectively will make specific API 
> a language standard which will propagate it to all sort of 3d 
> party libraries. I find it unacceptably unreadable and verbose, 
> to the point it will make working with those libraries 
> considerably harder.
>
> I use `test!"=="(a. b)` which is:
> - short
> - robust (supports any binary operator D has)
> - straight to the point (it is about testing, not about what 
> program should/must do)
>
> The fact that examples uncourage UFCS abuse makes it even 
> worse. Something that looks like this:
>
> `2.timesTwo.shouldEqual(4)`
> .. gets immediately marked as garbage in my book.

Your UFCS abuse is my UFCS awesomeness. It doesn't _make_ you use 
UFCS though, nobody would stop you from writing 
`shouldEqual(timesTwo(2), 4)` instead, which I think is nearly as 
readable. "Nearly" because I prefer UFCS. The advantage of using 
a word like "should" is that it enables UFCS, which "test" 
doesn't. After that it's a question of code style preferences 
whether or not you use it.

Atila


More information about the Digitalmars-d mailing list