Re: Variables with scoped destruction in closures

2016-10-15 Thread Walter Bright via Digitalmars-d-learn

On 10/14/2016 3:18 AM, Nordlöw wrote:

t_scope.d(23,6): Error: variable t_scope.below.s has scoped destruction, cannot
build closure


  https://github.com/dlang/dmd/blob/master/src/toir.d#L820

The problem is the closure is generated when it is expected that the delegate 
will survive past the end of the scope (it's the whole point of a closure). But 
with a destructor that runs at the end of the scope, it cannot survive, and so 
the user of the closure will be referring to a destroyed object.


There is a current PR to improve the closure decision so that fewer closures are 
necessary,


  https://github.com/dlang/dmd/pull/5972

I don't know if that will resolve the issue you're having.

(A smaller test case would be nice!)


Re: Missing functionality in std.process?

2016-10-15 Thread rikki cattermole via Digitalmars-d-learn

On 15/10/2016 5:33 AM, Andre Pany wrote:

Hi,

I developed an application which starts and stops other applications
like NodeJS HTTP server applications or Java Tomee Servlets. A typical
NodeJS application has a process tree of 4-5 levels.
I had to switch really fast from std.process functionality like kill and
wait to OS specific functionality because the child processes were not
killed entirely leading to effects like blocked ports/files/directories.
I have to use windows command taskkill.exe with parameter "Child tree
kill".

What I miss is s.th. to get the child Pids of a parent Pid. Again I can
use OS dependent functionality to retrieve the processIDs of the
children, but how to convert these processIDs to Pids for usage with
kill/wait functions?

Do I miss s.th. fundamental with std.process?

Kind regards
André



Yeah we don't support that right now in std.process.


Re: Should I brush up on my C before plunging fully into D?

2016-10-15 Thread WhatMeForget via Digitalmars-d-learn

On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote:
I'm mainly a scripting language, .NET, and SQL programmer. I've 
been looking for a good programming language for Linux/BSD 
other than Python. I've surveyed the options and D appears to 
be a sane modern choice for me. (Thanks Ali Çehreli and others!)


The only hitch is that many of the projects and libraries I'm 
interested in using or maybe porting are mainly C based. (My 
overall C-fu is weak...) Should I review a good C book or 
tutorial before jumping in to fully learning D? Or should I 
just eschew any C exposure until I master D?


(As a side note, many of the C libraries I'm interested in seem 
to be confusing messes of header files and "organic" code. But 
who am I to judge?)


I would jump right into D and then veer off into C on a need to 
know basis. This link might be of interest:


https://dlang.org/ctod.html

Also, are you aware of the libraries at the DUB registry?

And finally, Chapter 9 of Mike Parker's "Learning D" has lots of 
info on libraries.





Re: Should I brush up on my C before plunging fully into D?

2016-10-15 Thread Nicholas Wilson via Digitalmars-d-learn

On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote:
I'm mainly a scripting language, .NET, and SQL programmer. I've 
been looking for a good programming language for Linux/BSD 
other than Python. I've surveyed the options and D appears to 
be a sane modern choice for me. (Thanks Ali Çehreli and others!)


The only hitch is that many of the projects and libraries I'm 
interested in using or maybe porting are mainly C based. (My 
overall C-fu is weak...) Should I review a good C book or 
tutorial before jumping in to fully learning D? Or should I 
just eschew any C exposure until I master D?


(As a side note, many of the C libraries I'm interested in seem 
to be confusing messes of header files and "organic" code. But 
who am I to judge?)


It is possible to write in a C style in D and they are similar 
enough (when writing like C) that learning D should cover you for 
most of the C (sans macros), but obviously D can do a whole lot 
more.
D has the philosophy that it should work the same way as C or not 
compile at all.


As always Ali's book is excellent (and free!), so start with that.

There are many bindings for C libraries available for D, see 
code.dlang.org or try dstep as mentioned above.


Re: Should I brush up on my C before plunging fully into D?

2016-10-15 Thread Ryan via Digitalmars-d-learn

On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote:
I'm mainly a scripting language, .NET, and SQL programmer. I've 
been looking for a good programming language for Linux/BSD 
other than Python. I've surveyed the options and D appears to 
be a sane modern choice for me. (Thanks Ali Çehreli and others!)


The only hitch is that many of the projects and libraries I'm 
interested in using or maybe porting are mainly C based. (My 
overall C-fu is weak...) Should I review a good C book or 
tutorial before jumping in to fully learning D? Or should I 
just eschew any C exposure until I master D?


(As a side note, many of the C libraries I'm interested in seem 
to be confusing messes of header files and "organic" code. But 
who am I to judge?)


I came from a python/java background when I started to learn D. I 
had a programming class many-many years ago in C, and I only knew 
it well enough to do small programs. I started learning D almost 
2 years ago, and then started in on C++ after that.


I think D is by far the easiest compiled language to "learn". You 
can get into to it pretty easy (easier than C++) and write 
something useful pretty quick. Then there's always more to learn.




Re: Should I brush up on my C before plunging fully into D?

2016-10-15 Thread bachmeier via Digitalmars-d-learn

On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote:
I'm mainly a scripting language, .NET, and SQL programmer. I've 
been looking for a good programming language for Linux/BSD 
other than Python. I've surveyed the options and D appears to 
be a sane modern choice for me. (Thanks Ali Çehreli and others!)


The only hitch is that many of the projects and libraries I'm 
interested in using or maybe porting are mainly C based. (My 
overall C-fu is weak...) Should I review a good C book or 
tutorial before jumping in to fully learning D? Or should I 
just eschew any C exposure until I master D?


(As a side note, many of the C libraries I'm interested in seem 
to be confusing messes of header files and "organic" code. But 
who am I to judge?)


Jump in and learn C as you go. C can be a beast at times, 
particularly if it involves the C preprocessor, and delaying 
learning D won't help.


Have you seen
https://github.com/jacob-carlborg/dstep


Should I brush up on my C before plunging fully into D?

2016-10-15 Thread Chris Nelson via Digitalmars-d-learn
I'm mainly a scripting language, .NET, and SQL programmer. I've 
been looking for a good programming language for Linux/BSD other 
than Python. I've surveyed the options and D appears to be a sane 
modern choice for me. (Thanks Ali Çehreli and others!)


The only hitch is that many of the projects and libraries I'm 
interested in using or maybe porting are mainly C based. (My 
overall C-fu is weak...) Should I review a good C book or 
tutorial before jumping in to fully learning D? Or should I just 
eschew any C exposure until I master D?


(As a side note, many of the C libraries I'm interested in seem 
to be confusing messes of header files and "organic" code. But 
who am I to judge?)