February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Friday, 28 February 2014 at 11:54:52 UTC, Mike Parker wrote: > On 2/28/2014 8:43 PM, Dicebot wrote: > >> >> Most problems I have with D data structures come from qualifiers, not >> from resource management. I really don't understand why this looks that >> much of a problem. That said, my background very influenced by plain C >> and that results in different habits and expectations. > > I have a strong C background as well and have never had any complaints about resource management in D. Every complaint I've seen has come from people trying to do C++-like RAII. And, though I don't understand it either, it does seem to be a big issue for them. It really is, RAII is the most important idiom in C++, in short no RAII == buggy code. I mean proper C++ not C-with-classes-no-templates-no-exceptions bs. So to sum up: C folks are not really happy, C++ folks are not really happy and C# folks are not really happy :P |
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | On Friday, 28 February 2014 at 12:15:21 UTC, Szymon Gatner wrote:
> It really is, RAII is the most important idiom in C++, in short no RAII == buggy code. I mean proper C++ not C-with-classes-no-templates-no-exceptions bs.
>
> So to sum up: C folks are not really happy, C++ folks are not really happy and C# folks are not really happy :P
Repeating this again and again - you can use RAII. Just not with GC. It is importan idiom and it is supported. But it is not "one true way" so it is not supported for everything.
|
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Friday, 28 February 2014 at 11:43:58 UTC, Dicebot wrote:
> On Friday, 28 February 2014 at 11:28:01 UTC, Szymon Gatner wrote:
>> I didn't mean "basic" in the sense of "easy" but in the sense of something that has to dealt with all the time / is common requirement.
>
> Yes, it needs to be dealt with all the time but in a different ways. Problem is with getting sensible defaults. D makes a reasonable assumption that most applications don't actually care about tight bullet-proof resource management and defaults to GC. I may not like it but it fits criteria "built-in resource management" and pretty much shows that it is not as basic as one may think.
>
Not really different tho. Actual function call swqence might be different but the scheme is always the same: acquire resource, allocate, connect, take from pool vs release, deallocate, disconnect, return to pool. All of those fall under resource management - there is a finite amout of a resouce whether it is a memory, a system process, a file or a databese connection and it is crucial to the system stability that all of them are properly returned / released AND in proper order (which is of course reverse to "acquisition").
|
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Friday, 28 February 2014 at 12:17:22 UTC, Dicebot wrote:
> On Friday, 28 February 2014 at 12:15:21 UTC, Szymon Gatner wrote:
>> It really is, RAII is the most important idiom in C++, in short no RAII == buggy code. I mean proper C++ not C-with-classes-no-templates-no-exceptions bs.
>>
>> So to sum up: C folks are not really happy, C++ folks are not really happy and C# folks are not really happy :P
>
> Repeating this again and again - you can use RAII. Just not with GC. It is importan idiom and it is supported. But it is not "one true way" so it is not supported for everything.
I know I can, my point is that it is more difficult and I don't like it ;)
|
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | On 2/28/2014 9:15 PM, Szymon Gatner wrote:
>
> So to sum up: C folks are not really happy, C++ folks are not really
> happy and C# folks are not really happy :P
I'm a C folk and I'm really happy :)
|
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Friday, 28 February 2014 at 12:48:47 UTC, Mike Parker wrote:
> On 2/28/2014 9:15 PM, Szymon Gatner wrote:
>
>>
>> So to sum up: C folks are not really happy, C++ folks are not really
>> happy and C# folks are not really happy :P
>
> I'm a C folk and I'm really happy :)
C'mon, GC has to be an itch for you mallocers :)
Come to the dark side...
|
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | On Friday, 28 February 2014 at 12:52:28 UTC, Szymon Gatner wrote: >> I'm a C folk and I'm really happy :) +1 > C'mon, GC has to be an itch for you mallocers :) > > Come to the dark side... It sometimes is. In that case we don't use GC. Don't get me wrong - there are issues with current GC enforcement and it is a major problem for real-time applications, there are lot of threads with debates on topic (with me acting on against-the-GC side). But it is a very small subset of applications most programmers will never even write once in their life, for everything else existing tools are pretty good. I really think it is more of C++ architectural habit that itches you right now :) |
February 28, 2014 Re: GC for noobs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szymon Gatner | Le 28/02/2014 13:22, Szymon Gatner a écrit :
> On Friday, 28 February 2014 at 11:43:58 UTC, Dicebot wrote:
>> On Friday, 28 February 2014 at 11:28:01 UTC, Szymon Gatner wrote:
>>> I didn't mean "basic" in the sense of "easy" but in the sense of
>>> something that has to dealt with all the time / is common requirement.
>>
>> Yes, it needs to be dealt with all the time but in a different ways.
>> Problem is with getting sensible defaults. D makes a reasonable
>> assumption that most applications don't actually care about tight
>> bullet-proof resource management and defaults to GC. I may not like it
>> but it fits criteria "built-in resource management" and pretty much
>> shows that it is not as basic as one may think.
>>
>
> Not really different tho. Actual function call swqence might be
> different but the scheme is always the same: acquire resource, allocate,
> connect, take from pool vs release, deallocate, disconnect, return to
> pool. All of those fall under resource management - there is a finite
> amout of a resouce whether it is a memory, a system process, a file or a
> databese connection and it is crucial to the system stability that all
> of them are properly returned / released AND in proper order (which is
> of course reverse to "acquisition").
I had a lot of difficulties too with the release order of resources. Of course I am coming from c++, in which it's to ease to manage.
I got some head-hack for the resource management, maybe a DIP must be done here about a module dedicated to the resource management? Or at least a tutorial in the wiki?
I finally solve my issues, but I am not happy, cause the way it's done seems to be too much error prone (resource leaks).
I used to work on mobile devices and some kind of resources have to be released as soon as possible. I also don't really like having a lot of applications running on devices never releasing resources, it can break the principle of multi-task OS. Just try to launch many Java/C# applications at the same time, you'll have to buy more memory.
|
Copyright © 1999-2021 by the D Language Foundation