Exit before second main with -funittest

Brian Tiffin btiffin at gnu.org
Fri Jul 30 05:51:41 UTC 2021


On Friday, 30 July 2021 at 04:22:12 UTC, Mathias LANG wrote:
> On Friday, 30 July 2021 at 03:45:21 UTC, Ali Çehreli wrote:
>> Almost all of my programs are in the following pattern:
>>
>> ```D
>> import std.stdio;
>>
>> void main(string[] args) {
>>   version (unittest) {
>>     // Don't execute the main program when unit testing
>>     return;
>>   }
>> }
>> ```
>
> Are you aware that this isn't necessary since v2.090.0 ?
> https://dlang.org/changelog/2.090.0.html#unittest-default

Thanks for that.  `DRT-` env vars look worth looking into.  I'm 
on gdc-11.1.0, and it has been running main after tests with 
`-funittest` here.

Willing to put up with hacky for the caves I'm exploring, for 
now, and will aim for `DRT-` insider tectonics while climbing up 
the D ladder.

And for the interested and influencers.  58, started programming 
on a TRS-80, late 1970s-ish.  Self taught, BASIC and Z-80 
assembler.  Wrote a relocatable debugger on the 8K machine, 
source saved and loaded using audio cassette tape.  Programming 
languages have been my hobby since day 1.  Count as an over 
10,000 hour *expert* in Forth, C, COBOL, REBOL, Unicon.  (Well, 
maybe not 10,000 hours each, but books and articles written).  
50+ languages studied purely for interest, and when directed by 
management.  Perl, Python, PHP, on and on. That is to set the 
frame of how I'm seeing and experiencing the learning curve and 
onboarding with D.  ;-)

Onboarding is working out to be awesome.  Thanks to the community 
and active participants. That is meant both as a fact, and a 
personal thanks.

Had some troubles with `dmd` install packages on 32bit Ubuntu at 
first, now working fine.  `dmd` was generating code that abended 
during the init for main, and never got to main.  Problem gone in 
the 2.097.1 package.  So it's more fun with rdmd, and dub, and 
the reference implementation.  I volunteer with GNU as a 
maintainer, so I lean `gdc`, and will probably not explore `ldc` 
that much, but that is part of fulfilling wants and desires with 
options left over.

Curiousities fulfilled quickly, thanks to the forums.

For the learning curve.  There is an immediate sense of 
recognition, lasts about 3 programs beyond Hello, world.  Then an 
initial wall of *oh, these are new angles, and syntax 
requirements, more reading before not confused*.

Then you find Ali's book and spend a few hours in information 
soak time, awaiting the osmosis.  Over the wall, and start up the 
steps.  Say level 3 now. Can read D source fairly quickly, but 
would have a tough time writing code with the various 
combinations of attributes in a high quality way.  Unlikely to 
invent a code path that hasn't been explored by someone else 
already.  Monkey see, monkey do, with some *ok, let's try this* 
thrown in.

With level 10 being the goal of enlightenment, say level 6 to 
qualify for a paying gig as a junior with mentor, and 8 being 
self reliant and trusted to give advice, perhaps on a logarithmic 
scale at the higher levels of *getting it without needing to 
slowly mentally unwind the syntax and semantics*, I've been about 
10 to spurts of more hours in a given week or two, getting up 
each step (quickness of mental translation of syntax, and sense 
of deepness and correctness of semantic understanding. Level 3, 
maybe 4 now. Getting close to 100 hundreds hours of reading an 
twiddling.  Not as fast as in the younger days, but a satisfying 
pace.  Have not needed to program in D *in anger*, no deadlines 
or on the job stress inducing time expectations.  Not yet.  
Looking forward to first opportunity though, and will jump.  ;-)

**Kudos team and contributors.**

Can't really suggest that many improvements to resources needed 
for learning D, as a hobbyist not on a clock, being new still and 
low enough to not know what detail interactions might be less 
approachable.  So far, very approachable.  Not confusing, but 
tantalizing caves to explore and integrate into knowing about 
potentials, super powers, and dark corners that may need to be 
accounted for.

And friendly people to pester with random brain train new here 
questions.

Have good, make well, and thanks.


More information about the Digitalmars-d-learn mailing list