"Try it now"

spir denis.spir at gmail.com
Thu Apr 14 08:36:05 PDT 2011


On 04/14/2011 04:24 PM, Andrei Alexandrescu wrote:
> On 4/14/11 7:25 AM, spir wrote:
>> On 04/14/2011 03:04 AM, Adam D. Ruppe wrote:
>>> bearophile wrote:
>>>> > This is a problem. Unittest code is not meant to produce an output,
>>>> > while online snippets to try are meant to nearly always produce a
>>>> > meaningful output.
>>> I don't know - I like the approach Andrei took in the docs, writing
>>> a series of true assertations.
>>>
>>> assert(sort([4, 2]) == [2, 4]);
>>>
>>> does look pretty neat. I guess the alternative is:
>>>
>>> writeln(sort[4, 2]); // prints "[2, 4]"
>>
>> What about
>>
>> // sort([4, 2]) == [2, 4])
>>
>> ? Looks to me both simpler & clearer.
>>
>> Denis
>
> I don't like that one bit. What is it trying to achieve or improve?

assert(sort([4, 2]) == [2, 4]);

What is it trying to achieve or improve?
plus: is this bebug code / error catching; or information to the reader?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list