Advice wanted on garbage collection of sockets for c++ programmer using D
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 27 04:57:48 PDT 2017
On Tuesday, 27 June 2017 at 11:43:27 UTC, John Burton wrote:
> 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 :)
Heh, there's no reason you can't, you'll just cause a few head
scratches when you post code while we figure out what it does.
Idiomatic D is rather different to C++ and is centered around
ranges + algorithms, but you can write code in pretty much any
style. Some of the advanced metaprogramming takes a bit to get
your head around.
If you do get stuck do post a question here, we're more than
happy to help.
More information about the Digitalmars-d-learn
mailing list