Is phobos too fluffy?

Imperatorn johan_forsberg_86 at hotmail.com
Sat Sep 19 17:11:54 UTC 2020


On Saturday, 19 September 2020 at 15:04:25 UTC, Andrei 
Alexandrescu wrote:
> On 9/19/20 5:15 AM, Imperatorn wrote:
>> On Saturday, 19 September 2020 at 06:59:54 UTC, Jonathan M 
>> Davis wrote:
>>>> > [...]
>> 
>>> [...]
>> 
>> "It's very common practice"
>> 
>> Actually no it is not. D is the only example I've seen that 
>> routinely does this. Virtually all other languages separate 
>> code and tests.
>
> I just read that Python's doctest endorses the same:
>
> * https://docs.python.org/2/library/doctest.html
>
> It seems a matter in which reasonable people may disagree. I 
> know Atila Neves doesn't like it, and he's reasonable. His 
> reason is actually good too, of a practical nature at scale - 
> build times/memory issues. I do agree with that reason, and 
> that's about the only con I can every think of.
>
> There are also a few discussion on that online:
>
> * 
> https://stackoverflow.com/questions/9022547/should-test-code-be-separate-from-source-production-code
>
> * 
> https://softwareengineering.stackexchange.com/questions/188316/is-there-a-reason-that-tests-arent-written-inline-with-the-code-that-they-test
>
> The arguments against seem to come from folks who either never 
> attempted to use inline tests and are doing a 
> gedankenexperiment, or people who did try and were deterred by 
> language limitations.
>
> This is a short article in favor of doing it, or so it seems 
> (not sure what the context is):
>
> * 
> https://techbeacon.com/app-dev-testing/6-reasons-co-locate-your-app-automation-code
>
> For my money, the troika documentation-implementation-unittest 
> is sacrosanct. It's the unit of progress. I honestly consider 
> it unkind of someone to not provide all three together. And 
> there's a synergy of sorts: in the projects with separate 
> unittests, guess what - documentation is absent, too.
>
> The advent of documentation unittests has made the matter all 
> but motherhood and apple pie. Not providing such is almost 
> going out of one's way to be a jerk to the user.

Thanks for a good reply!

I am not really saying it's a bad idea. I actually think it might 
be wise to do so. I mis-read the comment earlier about it being 
common (in other languages).
I have just completed a marathon of going through about 50 
languages, so I felt I had something to say about it, that's all.

Anyway, since I'm here, at the D-Forum is kind of a good sign, 
right? :) I do believe D is a great language with a good deal of 
hope. In the coming months I will (at our company) actually port 
some C# to D and if it all works out I'll be really happy about D.


More information about the Digitalmars-d mailing list