On 10 October 2013 03:13, Michel Fortin <michel.for...@michelf.ca> wrote:

> On 2013-10-09 16:51:03 +0000, Manu <turkey...@gmail.com> said:
>
>  On 10 October 2013 01:40, Johannes Pfau <nos...@example.com> wrote:
>>
>>  But if someone really wants to strip the GC _completely_ there's a huge
>>> issue with memory management of Exceptions.
>>>
>>
>> Exceptions have a pretty well defined lifetime... can't they be manually
>> cleaned up by the exception handler after the catching scope exits?
>>
>
> Exceptions don't need a well-defined lifetime for things to work.
>
> D exceptions are classes and are heap-allocated. So if everything becomes
> reference-counted, exceptions would be reference-counted too. The exception
> handler would be the one decrementing the reference count once it has done
> with the exception (all this under the hood, managed by the compiler).
>
> Alternatively an exception handler could return the exception to the
> parent function (as a return value), store the exception elsewhere, or
> throw it again, in which case the decrement operation would be balanced by
> an increment, and both increment and decrement should be elided by the
> compiler as they're cancelling each other.
>
> I fail to see an issue.


I was talking about using exceptions without any sort of GC at all.
I think it's the only critical language feature left that relies on a GC in
some form.
If would be nice if at least the fundamental language concepts were usable
without a GC of any sort.
Most other things can be reasonably worked around at this point.

Reply via email to