www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Article: Running D without its runtime

reply Guillaume Piolat <first.last gmail.com> writes:
https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html

"Our products now run with the D language runtime disabled. This 
post is both a post-mortem and tutorial on how to live without 
the D runtime. "

This only covers the middle road where you link with the runtime 
and not initialize it.

Basically describes the process of leaving the D runtime disabled 
for products that used to rely on it. I present a simple way to 
have MM exceptions in  nogc (an idea originally from Adam D Ruppe 
I think).

It wasn't very hard just took lots of grunt work. What striked me 
most during the process was the cascade of things that couldn't 
be "nothrow  nogc" because Object.~this isn't. So the workaround 
is rather ugly, and you don't get to reuse things using the 
regular .destroy (like Unique, scoped!, etc.)
Nov 09 2016
next sibling parent reply thedeemon <dlang thedeemon.com> writes:
On Thursday, 10 November 2016 at 00:56:02 UTC, Guillaume Piolat 
wrote:
 https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html
Great post and useful pieces of code, thanks! "every class object's destructor is assumed to throw exceptions and use the GC by default." This is the schizophrenic part of D, since allocations inside destructors are not allowed by its own runtime and cause immediate stop of the program. A sane language would either insist on making all destructors nogc or allow some allocations during the GC phase (like CLR and JVM do, I suppose). And exceptions in destructors should not be allowed: there is no sane place to catch and handle exceptions arising during the GC phase (which can be triggered by arbitrary allocation anywhere in the code), so if we can't reason about them and handle them we shouldn't allow them.
Nov 09 2016
parent Guillaume Piolat <first.last gmail.com> writes:
Thanks for reading!

On Thursday, 10 November 2016 at 06:08:22 UTC, thedeemon wrote:
 This is the schizophrenic part of D, since allocations inside 
 destructors are not allowed by its own runtime and cause 
 immediate stop of the program.
But this restriction is only there when called by the GC. If you have GC and a deterministic object graph, it can be completely safe to allocate in destructor. I feel this is a separate problem, "GC calling destructors".
 And exceptions in destructors should not be allowed: there is 
 no sane place to catch and handle exceptions arising during the 
 GC phase (which can be triggered by arbitrary allocation 
 anywhere in the code), so if we can't reason about them and 
 handle them we shouldn't allow them.
Good point.
Nov 10 2016
prev sibling next sibling parent reply Olivier Pisano <olivier.pisano supersonicimagine.com> writes:
I cannot read your website on Firefox 45 (no text is displayed). 
It works on chromium anyway.
Nov 09 2016
next sibling parent reply Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano 
wrote:
 I cannot read your website on Firefox 45 (no text is 
 displayed). It works on chromium anyway.
I develop it on Firefox. What is your OS?
Nov 10 2016
next sibling parent reply ag0aep6g <anonymous example.com> writes:
On 11/10/2016 12:11 PM, Guillaume Piolat wrote:
 On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano wrote:
 I cannot read your website on Firefox 45 (no text is displayed). It
 works on chromium anyway.
I develop it on Firefox. What is your OS?
I'm on Ubuntu 16.04 and the text is missing for me too. Seems to be an issue with the Fira Sans font.
Nov 10 2016
parent reply Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 10 November 2016 at 11:20:38 UTC, ag0aep6g wrote:
 On 11/10/2016 12:11 PM, Guillaume Piolat wrote:
 On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano 
 wrote:
 I cannot read your website on Firefox 45 (no text is 
 displayed). It
 works on chromium anyway.
I develop it on Firefox. What is your OS?
I'm on Ubuntu 16.04 and the text is missing for me too. Seems to be an issue with the Fira Sans font.
Thanks. Are you behind a proxy? I've had such reports before.
Nov 10 2016
parent reply ag0aep6g <anonymous example.com> writes:
On 11/10/2016 12:21 PM, Guillaume Piolat wrote:
 Thanks. Are you behind a proxy? I've had such reports before.
Nope. No proxy.
Nov 10 2016
parent Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 10 November 2016 at 11:31:43 UTC, ag0aep6g wrote:
 On 11/10/2016 12:21 PM, Guillaume Piolat wrote:
 Thanks. Are you behind a proxy? I've had such reports before.
Nope. No proxy.
I'll check with Ubuntu + Firefox in about 10 hours
Nov 10 2016
prev sibling parent Olivier Pisano <olivier.pisano supersonicimagine.com> writes:
On Thursday, 10 November 2016 at 11:11:17 UTC, Guillaume Piolat 
wrote:
 On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano 
 wrote:
 I cannot read your website on Firefox 45 (no text is 
 displayed). It works on chromium anyway.
I develop it on Firefox. What is your OS?
I am on Debian Jessie, with Firefox ESR 45.4.0.
Nov 10 2016
prev sibling next sibling parent reply Russel Winder via Digitalmars-d-announce writes:
On Thu, 2016-11-10 at 06:52 +0000, Olivier Pisano via Digitalmars-d-
announce wrote:
 I cannot read your website on Firefox 45 (no text is displayed).=C2=A0
 It works on chromium anyway.
I see only some (bold?) test items, the basic text is not visible. I am using Chrome Stable =C2=A054.0.2840.90 (64-bit) on Debian Sid. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Nov 10 2016
parent Guillaume Piolat <spam spam.org> writes:
On Thursday, 10 November 2016 at 17:32:36 UTC, Russel Winder 
wrote:
 On Thu, 2016-11-10 at 06:52 +0000, Olivier Pisano via 
 Digitalmars-d- announce wrote:
 I cannot read your website on Firefox 45 (no text is 
 displayed).
 It works on chromium anyway.
I see only some (bold?) test items, the basic text is not visible. I am using Chrome Stable  54.0.2840.90 (64-bit) on Debian Sid.
This seems to be https://github.com/google/fonts/issues/206 Can't reproduce on FF 47 + Ubuntu, will probably change the font...
Nov 10 2016
prev sibling parent reply Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano 
wrote:
 I cannot read your website on Firefox 45 (no text is 
 displayed). It works on chromium anyway.
FWIW it should work now
Nov 11 2016
parent Russel Winder via Digitalmars-d-announce writes:
On Fri, 2016-11-11 at 22:51 +0000, Guillaume Piolat via Digitalmars-d-
announce wrote:
 On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano=C2=A0
 wrote:
 I cannot read your website on Firefox 45 (no text is=C2=A0
 displayed). It works on chromium anyway.
=20 FWIW it should work now
Definitely does. Thanks for making the change. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Nov 12 2016
prev sibling parent reply qznc <qznc web.de> writes:
On Thursday, 10 November 2016 at 00:56:02 UTC, Guillaume Piolat 
wrote:
 https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html

 "Our products now run with the D language runtime disabled. 
 This post is both a post-mortem and tutorial on how to live 
 without the D runtime. "
For runtime users the good news is that speed is already fine. :) The hacks you needed to go through are ugly. Any ideas how this could be improved? (animated background arrrrg...)
Nov 10 2016
parent Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 10 November 2016 at 10:30:36 UTC, qznc wrote:
 On Thursday, 10 November 2016 at 00:56:02 UTC, Guillaume Piolat 
 wrote:
 https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html

 "Our products now run with the D language runtime disabled. 
 This post is both a post-mortem and tutorial on how to live 
 without the D runtime. "
For runtime users the good news is that speed is already fine. :) The hacks you needed to go through are ugly. Any ideas how this could be improved?
Barely. I'm not wise enough to know what this would imply. In my uninformed opinion, making attribute inference work on destroy() and making class destructors "nothrow nogc" would go a long way. As it is, doing D without the runtime isolates you in a tiny universe. About exceptions, if we modify Throwable to have a "release()" virtual function called (or better own an allocator?), then we could have the caller catch exception regardless of how they are allocated.
Nov 10 2016