Advice wanted on garbage collection of sockets for c++ programmer using D

John Burton via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 27 04:43:27 PDT 2017


On Tuesday, 27 June 2017 at 10:14:16 UTC, Jonathan M Davis wrote:
> On Tuesday, June 27, 2017 09:54:19 John Burton via 
> Digitalmars-d-learn wrote:
>> I'm coming from a C++ background so I'm not too used to 
>> garbage collection and it's implications. I have a function 
>> that creates a std.socket.Socket using new and connects to a 
>> tcp server, and writes some stuff to it. I then explicitly 
>> close the socket, and the socket object goes out of scope.

Thank you for the advice everyone.

The hardest part about learning D isn't the language, or how to 
program, it's unlearning what you know from C++ and learning the 
proper way to do things in D. I've tried D several times before 
and eventually stopped when I get to the stage of "how do I do 
this c++ thing in d" proves to be hard.

Instead this time, I've started writing D programs as "better C" 
and then slowly started adding in higher level d features. It's 
going much better as I'm no longer trying so hard to write bad 
C++ in D :)





More information about the Digitalmars-d-learn mailing list