digitalmars.D - Is anything being done about exceptions & nogc?
- weaselcat (6/6) Apr 09 2015 Hi,
- Adam D. Ruppe (5/5) Apr 09 2015 The most serious proposal I saw was making a reference counted
- weaselcat (3/8) Apr 09 2015 is this related to or orthogonal to the recent class-ref
- Adam D. Ruppe (3/5) Apr 09 2015 That's it. My understanding is that Throwable woudl be the first
- Andrei Alexandrescu (3/7) Apr 10 2015 Yah. DIP25 and DIP77 pave the way for DIP74, which will be the basis of
- w0rp (19/25) Apr 10 2015 One thing that can be done now at least is that allocating
Hi, the biggest blocker to converting a _lot_ of code to nogc is exceptions. Has there been anything proposed to help alleviate this? I couldn't find anything. thanks.
Apr 09 2015
The most serious proposal I saw was making a reference counted class hierarchy, parallel to the GC one, which would automatically add and release reference. Then Throwable can become one of those. Even Walter seems onboard so it might be implemented eventually.
Apr 09 2015
On Friday, 10 April 2015 at 03:23:08 UTC, Adam D. Ruppe wrote:The most serious proposal I saw was making a reference counted class hierarchy, parallel to the GC one, which would automatically add and release reference. Then Throwable can become one of those. Even Walter seems onboard so it might be implemented eventually.is this related to or orthogonal to the recent class-ref proposals(DIP 74) from andrei and walter?
Apr 09 2015
On Friday, 10 April 2015 at 03:36:25 UTC, weaselcat wrote:is this related to or orthogonal to the recent class-ref proposals(DIP 74) from andrei and walter?That's it. My understanding is that Throwable woudl be the first one that uses the new proposal.
Apr 09 2015
On 4/9/15 8:23 PM, Adam D. Ruppe wrote:The most serious proposal I saw was making a reference counted class hierarchy, parallel to the GC one, which would automatically add and release reference. Then Throwable can become one of those. Even Walter seems onboard so it might be implemented eventually.Yah. DIP25 and DIP77 pave the way for DIP74, which will be the basis of refcounted exceptions. -- Andrei
Apr 10 2015
On Friday, 10 April 2015 at 03:13:53 UTC, weaselcat wrote:Hi, the biggest blocker to converting a _lot_ of code to nogc is exceptions. Has there been anything proposed to help alleviate this? I couldn't find anything. thanks.One thing that can be done now at least is that allocating exceptions statically. So the stack trace will be off by one line and you can't pass in any runtime values to the exception, realisitcally, but you can use them in a nogc function. nogc void foo (bool value) { if (value) { static immutable exception = new Exception("message"); throw exception; } } nogc void main(string[] argv) { foo(false); // fine foo(true); // throws } Passing exceptions by value, or via reference counting, would solve exceptions without garbage collection more generally.
Apr 10 2015