"Try it now"

Adam D. Ruppe destructionator at gmail.com
Wed Apr 13 18:04:25 PDT 2011


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]"

but it's not as compact with some examples and it doesn't quite
show the same thing - writeln's implementation could change things
there and those details are really beside the point of the example.

On the other hand, having output there might be more interesting
to look at than "yay the asserts all passed!".

I could go either way.


But, regardless, there's nothing much my compile helper and
javascript can do here. The examples in the documentation would
have to be changed.

> I agree, it's slow, and speeding it up a little will be an
> important improvement.

Yeah, I'd like to speed it up too, but I've gotta strike a balance
between being useful without being easily abused or expensive.
Right now, it has a separate VM, but still shares a physical
server with some of my other sites (otherwise I wouldn't be doing
this at all... dedicating a whole server to a free toy is too rich
for my blood).

I can't let it affect those other sites, so full speed isn't really
an option.


More information about the Digitalmars-d mailing list