Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Sean Kelly via Digitalmars-d
On Tuesday, 8 July 2014 at 02:31:50 UTC, Átila Neves wrote: On Monday, 7 July 2014 at 18:15:32 UTC, Sean Kelly wrote: With asynchronous event-driven code (ie. server code), I don't see any way to avoid all use of new / delete. std::make_unique and std::make_shared are what you're supposed

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Sean Kelly via Digitalmars-d
On Tuesday, 8 July 2014 at 14:24:10 UTC, Sean Kelly wrote: But you're ultimately passing something as a void* to a library call and receiving it later as the context for a callback. That value has to live on the heap. Well to be fair, you could make the context an index into an array.

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Atila Neves via Digitalmars-d
On Tuesday, 8 July 2014 at 14:24:10 UTC, Sean Kelly wrote: On Tuesday, 8 July 2014 at 02:31:50 UTC, Átila Neves wrote: On Monday, 7 July 2014 at 18:15:32 UTC, Sean Kelly wrote: With asynchronous event-driven code (ie. server code), I don't see any way to avoid all use of new / delete.

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Sean Kelly via Digitalmars-d
On Tuesday, 8 July 2014 at 15:23:30 UTC, Atila Neves wrote: On Tuesday, 8 July 2014 at 14:24:10 UTC, Sean Kelly wrote: On Tuesday, 8 July 2014 at 02:31:50 UTC, Átila Neves wrote: On Monday, 7 July 2014 at 18:15:32 UTC, Sean Kelly wrote: With asynchronous event-driven code (ie. server code),

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Brad Anderson via Digitalmars-d
On Tuesday, 8 July 2014 at 17:55:15 UTC, Sean Kelly wrote: Well sure, but you can't use a class instance living on the stack as the context for a callback. At that point, whatever smart pointer you're using has to be discarded. This is actually why I find little use for

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Sean Kelly via Digitalmars-d
On Tuesday, 8 July 2014 at 18:04:14 UTC, Brad Anderson wrote: Maybe I'm misunderstanding but why not just use reset()? reset deletes the currently referenced object.

Re: Languages for servers (Go, D, and more)

2014-07-08 Thread Brad Anderson via Digitalmars-d
On Tuesday, 8 July 2014 at 18:23:41 UTC, Sean Kelly wrote: On Tuesday, 8 July 2014 at 18:04:14 UTC, Brad Anderson wrote: Maybe I'm misunderstanding but why not just use reset()? reset deletes the currently referenced object. Oh, I see what you were going for now.

Re: Languages for servers (Go, D, and more)

2014-07-07 Thread Kagamin via Digitalmars-d
On Saturday, 5 July 2014 at 16:28:13 UTC, Dicebot wrote: This is what I have been referring to in my earlier comment. These utilities provide RAII experience very similar to one in C++ and work pretty good if you stick to certain style of programming. But they are implemented by using struct

Re: Languages for servers (Go, D, and more)

2014-07-07 Thread Sean Kelly via Digitalmars-d
On Saturday, 5 July 2014 at 06:43:31 UTC, Russel Winder via Digitalmars-d wrote: On Fri, 2014-07-04 at 20:25 +, Chris Cain via Digitalmars-d wrote: […] The big problem with that is C++ style memory management implies we're going to have new/delete which AFAIK delete is depreciated and new

Re: Languages for servers (Go, D, and more)

2014-07-07 Thread via Digitalmars-d
On Monday, 7 July 2014 at 18:15:32 UTC, Sean Kelly wrote: On Saturday, 5 July 2014 at 06:43:31 UTC, Russel Winder via Digitalmars-d wrote: On Fri, 2014-07-04 at 20:25 +, Chris Cain via Digitalmars-d wrote: […] The big problem with that is C++ style memory management implies we're going to

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread Russel Winder via Digitalmars-d
On Fri, 2014-07-04 at 20:25 +, Chris Cain via Digitalmars-d wrote: […] The big problem with that is C++ style memory management implies we're going to have new/delete which AFAIK delete is depreciated and new is currently hardcoded to use the GC. […] All the C++ folk are saying that with

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread bearophile via Digitalmars-d
Chris Cain: http://dlang.org/phobos/std_typecons.html#.Unique I'd like to read a little tutorial for the usage of that Unuque in D. Bye, bearophile

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread ponce via Digitalmars-d
On Saturday, 5 July 2014 at 06:43:31 UTC, Russel Winder via Digitalmars-d wrote: All the C++ folk are saying that with C++14 is you are using any heap at all you are more than likely doing it wrong. Modern C++ idiom is for completely new/delete free code. Minor nitpick, it is indeed devoid

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread Russel Winder via Digitalmars-d
On Sat, 2014-07-05 at 11:46 +, ponce via Digitalmars-d wrote: On Saturday, 5 July 2014 at 06:43:31 UTC, Russel Winder via Digitalmars-d wrote: All the C++ folk are saying that with C++14 is you are using any heap at all you are more than likely doing it wrong. Modern C++ idiom

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread Brian Rogoff via Digitalmars-d
On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: On Friday, 4 July 2014 at 16:16:35 UTC, Meta wrote: With @nogc and the -vgc compiler switch, I think it would fairly easy now to do C-style memory management and know that there are no hidden GC allocations in your program. Whether you would

Re: Languages for servers (Go, D, and more)

2014-07-05 Thread Dicebot via Digitalmars-d
On Friday, 4 July 2014 at 21:15:00 UTC, Chris Cain wrote: On Friday, 4 July 2014 at 21:09:05 UTC, Remo wrote: By C++ style memory management I do not mean naked new/delete or malloc/free. What I mean is RAII, smart pointers and destructor's. What is the proper replacement for std::unique_ptr

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Brian Rogoff via Digitalmars-d
On Friday, 4 July 2014 at 14:10:29 UTC, bearophile wrote: D: y u no distinguish between ints/longs/floats/doubles and pointers when taking out the trash? You argue that internal pointers make implementing a precise garbage collector (which wouldn’t mistake numbers for pointers) impossible, but

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Meta via Digitalmars-d
On Friday, 4 July 2014 at 15:29:06 UTC, Brian Rogoff wrote: On Friday, 4 July 2014 at 14:10:29 UTC, bearophile wrote: D: y u no distinguish between ints/longs/floats/doubles and pointers when taking out the trash? You argue that internal pointers make implementing a precise garbage collector

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Remo via Digitalmars-d
On Friday, 4 July 2014 at 16:16:35 UTC, Meta wrote: On Friday, 4 July 2014 at 15:29:06 UTC, Brian Rogoff wrote: On Friday, 4 July 2014 at 14:10:29 UTC, bearophile wrote: D: y u no distinguish between ints/longs/floats/doubles and pointers when taking out the trash? You argue that internal

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: Who want to use C-style memory management today ? How about C++ style memory management, is this easy to this in D2 now ? The big problem with that is C++ style memory management implies we're going to have new/delete which AFAIK delete is

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 20:25:24 UTC, Chris Cain wrote: depreciated deprecated*. I swear I say it correctly and when I'm coding I type it correctly there XD

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Dicebot via Digitalmars-d
On Friday, 4 July 2014 at 20:25:24 UTC, Chris Cain wrote: On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: Who want to use C-style memory management today ? How about C++ style memory management, is this easy to this in D2 now ? The big problem with that is C++ style memory management

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Dmitry Olshansky via Digitalmars-d
05-Jul-2014 00:25, Chris Cain пишет: On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: Who want to use C-style memory management today ? How about C++ style memory management, is this easy to this in D2 now ? The big problem with that is C++ style memory management implies we're going to

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Remo via Digitalmars-d
On Friday, 4 July 2014 at 20:43:01 UTC, Dicebot wrote: On Friday, 4 July 2014 at 20:25:24 UTC, Chris Cain wrote: On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: Who want to use C-style memory management today ? How about C++ style memory management, is this easy to this in D2 now ? The

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 21:09:05 UTC, Remo wrote: By C++ style memory management I do not mean naked new/delete or malloc/free. What I mean is RAII, smart pointers and destructor's. What is the proper replacement for std::unique_ptr and std::shared_ptr in D2 ? Of course with move support