www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D: pay for what you use?

reply "Rel" <relmail rambler.ru> writes:
Hello! I really enjoy D and some brilliant concepts in the 
language, like scope(exit) for example. But what I dislike about 
D is the druntime, where each single function depends on 100 
other functions. I'd like to be able to develop system level code 
in D (like windows drivers or linux kernel modules or do osdev), 
but I can not do it, as D is very dependent on the druntime. It 
would be great if D would have the same "pay for what you use" 
way, as C/C++ do. So I'd like to ask several questions:

1) Is it possible to fully disable exceptions? Generally I tend 
not to use exceptions in C++ as well, as exception path may take 
a whole lot of a time. Also returning error codes or using 
something like Expected<T> is more readable in most cases. 
Obviously I'm not going to use exceptions in my code, and I won't 
be linking with code that throws/catches exceptions.

2) Is it possible to fully disable runtime type information? I 
understand that being able to get different information about 
object type in the runtime may be very useful, but I've never 
used it. However D compilers do generate RTTI-tables no matter 
what with all class names, module names and etc.

3) Is it possible to fully disable garbage collection? Sometimes 
having GC is a good thing, but I'd rather do manual memory 
management or use automatic reference counting instead.

4) What compiler is better to use when I want to compile and run 
D on "bare bones" (running code without operating system)? Is it 
DMD? Or is it LDC? Or GDC?

5) Does anyone try to make a tiny druntime library? Did it work 
out well for you? And can I have a look at it?

PS I know that these kind of questions come out in the D 
community from time to time, but there's a lot of things I'd like 
to discuss on this subject, so I decided to make a new thread... 
sorry...
Feb 13 2014
next sibling parent "Sean Kelly" <sean invisibleduck.org> writes:
You can disable GC, for example by linking to gcstub (backed by 
malloc and free).  But for the rest, it sounds like what you want 
is the "betterC" proposed by Walter recently.
Feb 13 2014
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 1) Is it possible to fully disable exceptions?

Don't implement _d_throw in druntime and they won't link. I'm pretty sure the tables are still generated but they won't be used (and are pretty small anyway.
 2) Is it possible to fully disable runtime type information?

alas, not at this time.
 3) Is it possible to fully disable garbage collection?

Again, just don't implement it and it won't link if you try to use it.
 4) What compiler is better to use when I want to compile and 
 run D on "bare bones" (running code without operating system)? 
 Is it DMD? Or is it LDC? Or GDC?

Any should work since it is more of a linker script question than a compiler one; I used dmd for my playing with it but I'm sure the others can do the same things.
 5) Does anyone try to make a tiny druntime library? Did it work 
 out well for you? And can I have a look at it?

http://arsdnet.net/dcode/minimal.zip That's one with exception support (you can remove that sort of with a -version switch but i like exceptions), classes, and much the rest of the language but only comes out to ~30 KB executable, zero outside dependencies (see also Makefile.bare that can make a bare metal image bootable with grub). It might not compile with the newest dmd, I'm not sure since I haven't kept up with the changes over the last several months. Ripping out druntime and doing it all yourself is liable to break without warning. An independent try at doing the same thing is here: https://bitbucket.org/timosi/minlibd I haven't used it myself though.
Feb 13 2014
prev sibling next sibling parent reply "Gary Willoughby" <dev nomad.so> writes:
On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 Hello! I really enjoy D and some brilliant concepts in the 
 language, like scope(exit) for example. But what I dislike 
 about D is the druntime, where each single function depends on 
 100 other functions. I'd like to be able to develop system 
 level code in D (like windows drivers or linux kernel modules 
 or do osdev), but I can not do it, as D is very dependent on 
 the druntime. It would be great if D would have the same "pay 
 for what you use" way, as C/C++ do. So I'd like to ask several 
 questions:

It's a good job i don't believe in conspiracies. http://forum.dlang.org/thread/lddug4$jgv$1 digitalmars.com
Feb 13 2014
parent Martin Nowak <code dawg.eu> writes:
On 02/13/2014 07:51 PM, Rel wrote:
 Oh, that is funny! I didn't notice that topic, as I haven't been much
 into D community. Thanks for pointing it out! I really hope that these
 features will be included in D compiler eventually...

It already is, though it might not be fully implemented yet. Try 'dmd -betterC'.
Feb 13 2014
prev sibling next sibling parent "Asman01" <jckj33 gmail.com> writes:
On Thursday, 13 February 2014 at 17:15:06 UTC, Gary Willoughby 
wrote:
 On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 Hello! I really enjoy D and some brilliant concepts in the 
 language, like scope(exit) for example. But what I dislike 
 about D is the druntime, where each single function depends on 
 100 other functions. I'd like to be able to develop system 
 level code in D (like windows drivers or linux kernel modules 
 or do osdev), but I can not do it, as D is very dependent on 
 the druntime. It would be great if D would have the same "pay 
 for what you use" way, as C/C++ do. So I'd like to ask several 
 questions:

It's a good job i don't believe in conspiracies. http://forum.dlang.org/thread/lddug4$jgv$1 digitalmars.com

I believe it's a God's signal.
Feb 13 2014
prev sibling next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Rel:

 It would be great if D would have the same "pay for what you 
 use" way, as C/C++ do.

While D is nearly a system language, its design doesn't follow that C++ rule fully. In some cases paying a little is OK for D, if it makes lot of other code safer, shorter, nicer, etc. Bye, bearophile
Feb 13 2014
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 13.02.2014 19:06, schrieb bearophile:
 Rel:

 It would be great if D would have the same "pay for what you use" way,
 as C/C++ do.

While D is nearly a system language, its design doesn't follow that C++ rule fully. In some cases paying a little is OK for D, if it makes lot of other code safer, shorter, nicer, etc. Bye, bearophile

I agree, I rather pay a little more like in Modula-2 and Ada, than have what C++ has become. It is always a mess to link in third party libraries if they have decided to pay for a different set of things one is willing to pay for. And to be honest, even when I used to do systems level programming back in MS-DOS days and my early UNIX days, I never felt the need for such approach. I think it was a design decision to bring to C++, the C developers that use it as a portable macro assembler. -- Paulo
Feb 13 2014
prev sibling next sibling parent "Rel" <relmail rambler.ru> writes:
On Thursday, 13 February 2014 at 17:14:05 UTC, Adam D. Ruppe 
wrote:
 Don't implement _d_throw in druntime and they won't link. I'm 
 pretty sure the tables are still generated but they won't be 
 used (and are pretty small anyway.

Maybe I'm too pedantic about my code, but I don't want to have useless tables in data sections. Sadly on practice this stuff isn't cut off by optimizations.
 http://arsdnet.net/dcode/minimal.zip

 That's one with exception support (you can remove that sort of 
 with a -version switch but i like exceptions), classes, and 
 much the rest of the language but only comes out to ~30 KB 
 executable, zero outside dependencies (see also Makefile.bare 
 that can make a bare metal image bootable with grub).

 It might not compile with the newest dmd, I'm not sure since I 
 haven't kept up with the changes over the last several months. 
 Ripping out druntime and doing it all yourself is liable to 
 break without warning.


 An independent try at doing the same thing is here:
 https://bitbucket.org/timosi/minlibd

 I haven't used it myself though.

Thanks, I will look at it. But I agree that in general it may be hard to keep your own minimal runtime library up to date with the latest compiler version. That is a bad thing about it too...
Feb 13 2014
prev sibling next sibling parent "Rel" <relmail rambler.ru> writes:
On Thursday, 13 February 2014 at 17:15:06 UTC, Gary Willoughby 
wrote:
 It's a good job i don't believe in conspiracies.

 http://forum.dlang.org/thread/lddug4$jgv$1 digitalmars.com

Oh, that is funny! I didn't notice that topic, as I haven't been much into D community. Thanks for pointing it out! I really hope that these features will be included in D compiler eventually...
Feb 13 2014
prev sibling next sibling parent reply "Mike" <none none.com> writes:
On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 4) What compiler is better to use when I want to compile and 
 run D on "bare bones" (running code without operating system)? 
 Is it DMD? Or is it LDC? Or GDC?

What's your target platform (x86, ARM, etc...)? My platform is ARM Cortex-M bare metal. DMD doesn't support ARM. LDC and GDC do to some extent. LCD crashed when I omitted some of the TypeInfo stuff. A fix was created [1], but I'm waiting for it to be released in a binary with an ARM Thumb backend before I test it again. I'm currently using GDC, and am making good progress with it. I'm using the -fno-emit-moduleinfo switch and consider it essential for going minimal. My wiki describes everything I'm doing, and many of your questions will be answered there if you take the time to read through it [2].
 Hello! I really enjoy D and some brilliant concepts in the 
 language, like scope(exit) for example. But what I dislike 
 about D is the druntime, where each single function depends on 
 100 other functions. I'd like to be able to develop system 
 level code in D (like windows drivers or linux kernel modules 
 or do osdev), but I can not do it, as D is very dependent on 
 the druntime. It would be great if D would have the same "pay 
 for what you use" way, as C/C++ do. So I'd like to ask several 
 questions:

I'm doing just that. My first step was to build a minimal "hello world" (no C, no runtime, no phobos). I created a wiki post about it [3]. I've expanded on this in my repository's "hello world", and have been able to get it down to 56 bytes [4].
 1) Is it possible to fully disable exceptions? Generally I tend 
 not to use exceptions in C++ as well, as exception path may 
 take a whole lot of a time. Also returning error codes or using 
 something like Expected<T> is more readable in most cases. 
 Obviously I'm not going to use exceptions in my code, and I 
 won't be linking with code that throws/catches exceptions.

I don't think there's any way to prevent you from using exceptions except by not implementing the specific runtime hooks, and getting linker errors if you attempt to use exceptions. I, for one, fully intend to use exceptions even though I'm targeting the most minimal of hardware. I believe it is a useful idiom if used tastefully.
 2) Is it possible to fully disable runtime type information? I 
 understand that being able to get different information about 
 object type in the runtime may be very useful, but I've never 
 used it. However D compilers do generate RTTI-tables no matter 
 what with all class names, module names and etc.

I use -ffunction-sections and -fdata-sections, in collusion with ld's --gc-sections to strip out stuff I'm not using. This can also be done with a custom linker script. Again, my wiki describes this. To get GDC just to compile my code, I've had to stub out the TypeInfo stuff in object.d/di. I have a 20 line object.d that allows me to declare structs [6]. With one or two more stubs, I can have classes with static properties. I have the code, but I haven't checked it in yet. There was an excellent discussion about this on the forum [7]. I encourage you to read it if you're really serious about your pursuit of this knowledge.
 3) Is it possible to fully disable garbage collection? 
 Sometimes having GC is a good thing, but I'd rather do manual 
 memory management or use automatic reference counting instead.

If you throw away the runtime from the start, and pay as you go from there, yes. That is the approach I have taken. I have a malloc/free [8], and as far as I know its the only malloc written in D. It's naive and not well tested, but working for what I need so far. I believe this could be used with the gcstub [14], but I haven't made it that far yet.
 5) Does anyone try to make a tiny druntime library? Did it work 
 out well for you? And can I have a look at it?

Timo Sintonen's minlibd [9] Vladimir Panteleev's SlimD [10] Adam D. Ruppe's minimal D [11] Daniel Murphy's microD [12] Mine, which is hardly even started [13] Are there others? Please let me know by posting a response.
 PS I know that these kind of questions come out in the D 
 community from time to time, but there's a lot of things I'd 
 like to discuss on this subject, so I decided to make a new 
 thread... sorry...

I wouldn't mind seeing more discussion and participation a bare metal D effort. As you can tell by my verbose posts, I'm quite excited about it. Mike [1] https://github.com/ldc-developers/ldc/issues/551 [2] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.0-Introduction [3] http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22 [4] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki 1.1---Hello,-World! (watch the ending '!') [5] http://wiki.dlang.org/Runtime_Hooks [6] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/structs/source/object.d [7] http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org [8] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/master/source/memory.d [9] https://bitbucket.org/timosi/minlibd [10] https://github.com/CyberShadow/SlimD [11] http://arsdnet.net/dcode/minimal.zip [12] https://github.com/yebblies/dmd/tree/microd [13] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study [14] https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d
Feb 13 2014
next sibling parent "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"tcak"  wrote in message news:uzfigplgmfommvttnvfm forum.dlang.org...

 I would like support for PIC 8bit/16bit/32bit as well, though probably 
 that will never happen. At least for 8bit and 16bit PIC microprocessors.

This is not that unrealistic, either with gdc or emitting C then compiling with pic for the usual compiler. Of course most features won't work, IIRC some PICs don't even have a real stack.
Feb 14 2014
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/14/14, 7:48 AM, Rel wrote:
 On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 [1] https://github.com/ldc-developers/ldc/issues/551
 [2]
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.0-Introduction

 [3] http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22
 [4]
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.1---Hello,-World!
 (watch the ending '!')
 [5] http://wiki.dlang.org/Runtime_Hooks
 [6]
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/structs/source/object.d

 [7] http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org
 [8]
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/master/source/memory.d

 [9] https://bitbucket.org/timosi/minlibd
 [10] https://github.com/CyberShadow/SlimD
 [11] http://arsdnet.net/dcode/minimal.zip
 [12] https://github.com/yebblies/dmd/tree/microd
 [13] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study
 [14]
 https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d

Oh, that's a huge list, I'll take a look at it, thanks for your answer!

Should plop this list in a wiki page or promote to a page on dlang.org! Andrei
Feb 14 2014
prev sibling next sibling parent "tcak" <tcak pcak.com> writes:
On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 4) What compiler is better to use when I want to compile and 
 run D on "bare bones" (running code without operating system)? 
 Is it DMD? Or is it LDC? Or GDC?

What's your target platform (x86, ARM, etc...)? My platform is ARM Cortex-M bare metal. DMD doesn't support ARM. LDC and GDC do to some extent. LCD crashed when I omitted some of the TypeInfo stuff. A fix was created [1], but I'm waiting for it to be released in a binary with an ARM Thumb backend before I test it again. I'm currently using GDC, and am making good progress with it. I'm using the -fno-emit-moduleinfo switch and consider it essential for going minimal. My wiki describes everything I'm doing, and many of your questions will be answered there if you take the time to read through it [2].
 Hello! I really enjoy D and some brilliant concepts in the 
 language, like scope(exit) for example. But what I dislike 
 about D is the druntime, where each single function depends on 
 100 other functions. I'd like to be able to develop system 
 level code in D (like windows drivers or linux kernel modules 
 or do osdev), but I can not do it, as D is very dependent on 
 the druntime. It would be great if D would have the same "pay 
 for what you use" way, as C/C++ do. So I'd like to ask several 
 questions:

I'm doing just that. My first step was to build a minimal "hello world" (no C, no runtime, no phobos). I created a wiki post about it [3]. I've expanded on this in my repository's "hello world", and have been able to get it down to 56 bytes [4].
 1) Is it possible to fully disable exceptions? Generally I 
 tend not to use exceptions in C++ as well, as exception path 
 may take a whole lot of a time. Also returning error codes or 
 using something like Expected<T> is more readable in most 
 cases. Obviously I'm not going to use exceptions in my code, 
 and I won't be linking with code that throws/catches 
 exceptions.

I don't think there's any way to prevent you from using exceptions except by not implementing the specific runtime hooks, and getting linker errors if you attempt to use exceptions. I, for one, fully intend to use exceptions even though I'm targeting the most minimal of hardware. I believe it is a useful idiom if used tastefully.
 2) Is it possible to fully disable runtime type information? I 
 understand that being able to get different information about 
 object type in the runtime may be very useful, but I've never 
 used it. However D compilers do generate RTTI-tables no matter 
 what with all class names, module names and etc.

I use -ffunction-sections and -fdata-sections, in collusion with ld's --gc-sections to strip out stuff I'm not using. This can also be done with a custom linker script. Again, my wiki describes this. To get GDC just to compile my code, I've had to stub out the TypeInfo stuff in object.d/di. I have a 20 line object.d that allows me to declare structs [6]. With one or two more stubs, I can have classes with static properties. I have the code, but I haven't checked it in yet. There was an excellent discussion about this on the forum [7]. I encourage you to read it if you're really serious about your pursuit of this knowledge.
 3) Is it possible to fully disable garbage collection? 
 Sometimes having GC is a good thing, but I'd rather do manual 
 memory management or use automatic reference counting instead.

If you throw away the runtime from the start, and pay as you go from there, yes. That is the approach I have taken. I have a malloc/free [8], and as far as I know its the only malloc written in D. It's naive and not well tested, but working for what I need so far. I believe this could be used with the gcstub [14], but I haven't made it that far yet.
 5) Does anyone try to make a tiny druntime library? Did it 
 work out well for you? And can I have a look at it?

Timo Sintonen's minlibd [9] Vladimir Panteleev's SlimD [10] Adam D. Ruppe's minimal D [11] Daniel Murphy's microD [12] Mine, which is hardly even started [13] Are there others? Please let me know by posting a response.
 PS I know that these kind of questions come out in the D 
 community from time to time, but there's a lot of things I'd 
 like to discuss on this subject, so I decided to make a new 
 thread... sorry...

I wouldn't mind seeing more discussion and participation a bare metal D effort. As you can tell by my verbose posts, I'm quite excited about it. Mike [1] https://github.com/ldc-developers/ldc/issues/551 [2] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.0-Introduction [3] http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22 [4] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki 1.1---Hello,-World! (watch the ending '!') [5] http://wiki.dlang.org/Runtime_Hooks [6] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/structs/source/object.d [7] http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org [8] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/master/source/memory.d [9] https://bitbucket.org/timosi/minlibd [10] https://github.com/CyberShadow/SlimD [11] http://arsdnet.net/dcode/minimal.zip [12] https://github.com/yebblies/dmd/tree/microd [13] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study [14] https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d

I would like support for PIC 8bit/16bit/32bit as well, though probably that will never happen. At least for 8bit and 16bit PIC microprocessors.
Feb 13 2014
prev sibling next sibling parent "tcak" <tcak pcak.com> writes:
On Thursday, 13 February 2014 at 21:35:27 UTC, tcak wrote:
 On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 4) What compiler is better to use when I want to compile and 
 run D on "bare bones" (running code without operating 
 system)? Is it DMD? Or is it LDC? Or GDC?

What's your target platform (x86, ARM, etc...)? My platform is ARM Cortex-M bare metal. DMD doesn't support ARM. LDC and GDC do to some extent. LCD crashed when I omitted some of the TypeInfo stuff. A fix was created [1], but I'm waiting for it to be released in a binary with an ARM Thumb backend before I test it again. I'm currently using GDC, and am making good progress with it. I'm using the -fno-emit-moduleinfo switch and consider it essential for going minimal. My wiki describes everything I'm doing, and many of your questions will be answered there if you take the time to read through it [2].
 Hello! I really enjoy D and some brilliant concepts in the 
 language, like scope(exit) for example. But what I dislike 
 about D is the druntime, where each single function depends 
 on 100 other functions. I'd like to be able to develop system 
 level code in D (like windows drivers or linux kernel modules 
 or do osdev), but I can not do it, as D is very dependent on 
 the druntime. It would be great if D would have the same "pay 
 for what you use" way, as C/C++ do. So I'd like to ask 
 several questions:

I'm doing just that. My first step was to build a minimal "hello world" (no C, no runtime, no phobos). I created a wiki post about it [3]. I've expanded on this in my repository's "hello world", and have been able to get it down to 56 bytes [4].
 1) Is it possible to fully disable exceptions? Generally I 
 tend not to use exceptions in C++ as well, as exception path 
 may take a whole lot of a time. Also returning error codes or 
 using something like Expected<T> is more readable in most 
 cases. Obviously I'm not going to use exceptions in my code, 
 and I won't be linking with code that throws/catches 
 exceptions.

I don't think there's any way to prevent you from using exceptions except by not implementing the specific runtime hooks, and getting linker errors if you attempt to use exceptions. I, for one, fully intend to use exceptions even though I'm targeting the most minimal of hardware. I believe it is a useful idiom if used tastefully.
 2) Is it possible to fully disable runtime type information? 
 I understand that being able to get different information 
 about object type in the runtime may be very useful, but I've 
 never used it. However D compilers do generate RTTI-tables no 
 matter what with all class names, module names and etc.

I use -ffunction-sections and -fdata-sections, in collusion with ld's --gc-sections to strip out stuff I'm not using. This can also be done with a custom linker script. Again, my wiki describes this. To get GDC just to compile my code, I've had to stub out the TypeInfo stuff in object.d/di. I have a 20 line object.d that allows me to declare structs [6]. With one or two more stubs, I can have classes with static properties. I have the code, but I haven't checked it in yet. There was an excellent discussion about this on the forum [7]. I encourage you to read it if you're really serious about your pursuit of this knowledge.
 3) Is it possible to fully disable garbage collection? 
 Sometimes having GC is a good thing, but I'd rather do manual 
 memory management or use automatic reference counting instead.

If you throw away the runtime from the start, and pay as you go from there, yes. That is the approach I have taken. I have a malloc/free [8], and as far as I know its the only malloc written in D. It's naive and not well tested, but working for what I need so far. I believe this could be used with the gcstub [14], but I haven't made it that far yet.
 5) Does anyone try to make a tiny druntime library? Did it 
 work out well for you? And can I have a look at it?

Timo Sintonen's minlibd [9] Vladimir Panteleev's SlimD [10] Adam D. Ruppe's minimal D [11] Daniel Murphy's microD [12] Mine, which is hardly even started [13] Are there others? Please let me know by posting a response.
 PS I know that these kind of questions come out in the D 
 community from time to time, but there's a lot of things I'd 
 like to discuss on this subject, so I decided to make a new 
 thread... sorry...

I wouldn't mind seeing more discussion and participation a bare metal D effort. As you can tell by my verbose posts, I'm quite excited about it. Mike [1] https://github.com/ldc-developers/ldc/issues/551 [2] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.0-Introduction [3] http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22 [4] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki 1.1---Hello,-World! (watch the ending '!') [5] http://wiki.dlang.org/Runtime_Hooks [6] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/structs/source/object.d [7] http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org [8] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/master/source/memory.d [9] https://bitbucket.org/timosi/minlibd [10] https://github.com/CyberShadow/SlimD [11] http://arsdnet.net/dcode/minimal.zip [12] https://github.com/yebblies/dmd/tree/microd [13] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study [14] https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d

I would like support for PIC 8bit/16bit/32bit as well, though probably that will never happen. At least for 8bit and 16bit PIC microprocessors.

* I meant PIC microcontrollers.
Feb 13 2014
prev sibling next sibling parent "Brad Anderson" <eco gnuk.net> writes:
On Thursday, 13 February 2014 at 21:35:27 UTC, tcak wrote:
 I would like support for PIC 8bit/16bit/32bit as well, though 
 probably that will never happen. At least for 8bit and 16bit 
 PIC microprocessors.

D intentionally dropped support for 8- and 16-bit architectures as a guiding design decision (see http://dlang.org/overview.html for a mentioning of this).
Feb 13 2014
prev sibling next sibling parent "Mike" <none none.com> writes:
On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 2) Is it possible to fully disable runtime type information? I 
 understand that being able to get different information about 
 object type in the runtime may be very useful, but I've never 
 used it. However D compilers do generate RTTI-tables no matter 
 what with all class names, module names and etc.

I use -ffunction-sections and -fdata-sections, in collusion with ld's --gc-sections to strip out stuff I'm not using. This can also be done with a custom linker script. Again, my wiki describes this. To get GDC just to compile my code, I've had to stub out the TypeInfo stuff in object.d/di. I have a 20 line object.d that allows me to declare structs [6]. With one or two more stubs, I can have classes with static properties. I have the code, but I haven't checked it in yet. There was an excellent discussion about this on the forum [7]. I encourage you to read it if you're really serious about your pursuit of this knowledge. [7] http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org

I forgot to add the LDC has some useful features for this [1]. See the LDC_no_typeinfo and LDC_no_moduleinfo pragmas. Mike [1] http://wiki.dlang.org/LDC-specific_language_changes
Feb 13 2014
prev sibling next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 On Thursday, 13 February 2014 at 17:04:44 UTC, Rel wrote:
 5) Does anyone try to make a tiny druntime library? Did it 
 work out well for you? And can I have a look at it?

Timo Sintonen's minlibd [9] Vladimir Panteleev's SlimD [10] Adam D. Ruppe's minimal D [11] Daniel Murphy's microD [12] Mine, which is hardly even started [13] Are there others? Please let me know by posting a response.

I know one more related project: https://github.com/Ingrater/phobos - GC-free Phobos fork.
Feb 13 2014
prev sibling next sibling parent Iain Buclaw <ibuclaw gdcproject.org> writes:
On 14 February 2014 10:52, Daniel Murphy <yebbliesnospam gmail.com> wrote:
 "tcak"  wrote in message news:uzfigplgmfommvttnvfm forum.dlang.org...

 I would like support for PIC 8bit/16bit/32bit as well, though probably
 that will never happen. At least for 8bit and 16bit PIC microprocessors.

This is not that unrealistic, either with gdc or emitting C then compiling with pic for the usual compiler. Of course most features won't work, IIRC some PICs don't even have a real stack.

I'll have to lift a small restriction in GDC though that causes the compiler to ICE on anything other than 32bit or 64bit systems first though. If anyone is genuinely wanting to give it a whirl, let me know.
Feb 14 2014
prev sibling next sibling parent "Mike" <none none.com> writes:
On Friday, 14 February 2014 at 11:40:19 UTC, Iain Buclaw wrote:
 I'll have to lift a small restriction in GDC though that causes 
 the
 compiler to ICE on anything other than 32bit or 64bit systems 
 first
 though.

 If anyone is genuinely wanting to give it a whirl, let me know.

I was wondering if this was feasible. There's an avr-gcc for Atmel's 8-bit AVR microctonrollers. Is that part of the mainline GCC backend? I was wondering whether GDC could program one of the 8-bit Aurdinos (Atmel AVR based). It could be a big hit given the Arduino's popularity. Mike
Feb 14 2014
prev sibling next sibling parent "Rel" <relmail rambler.ru> writes:
On Thursday, 13 February 2014 at 21:08:01 UTC, Mike wrote:
 [1] https://github.com/ldc-developers/ldc/issues/551
 [2] 
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.0-Introduction
 [3] 
 http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22
 [4] 
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki
1.1---Hello,-World! 
 (watch the ending '!')
 [5] http://wiki.dlang.org/Runtime_Hooks
 [6] 
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/structs/source/object.d
 [7] 
 http://forum.dlang.org/post/jynxfglpulguvqbivrms forum.dlang.org
 [8] 
 https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/blob/master/source/memory.d
 [9] https://bitbucket.org/timosi/minlibd
 [10] https://github.com/CyberShadow/SlimD
 [11] http://arsdnet.net/dcode/minimal.zip
 [12] https://github.com/yebblies/dmd/tree/microd
 [13] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study
 [14] 
 https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d

Oh, that's a huge list, I'll take a look at it, thanks for your answer!
Feb 14 2014
prev sibling next sibling parent "Rel" <relmail rambler.ru> writes:
On Thursday, 13 February 2014 at 19:03:14 UTC, Martin Nowak wrote:
 It already is, though it might not be fully implemented yet.
 Try 'dmd -betterC'.

So you mean the latest DMD release already has it?
Feb 14 2014
prev sibling next sibling parent "Dicebot" <public dicebot.lv> writes:
On Friday, 14 February 2014 at 16:07:21 UTC, Rel wrote:
 So you mean the latest DMD release already has it?

It has been there for ages, undocumented - Walter was using to simplify porting dmd to new platforms. It only removes ModuleInfo though AFAIR.
Feb 14 2014
prev sibling next sibling parent Ziad Hatahet <hatahet gmail.com> writes:
--089e01681598cd82d904f2649341
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Feb 13, 2014 at 11:46 AM, Paulo Pinto <pjmlp progtools.org> wrote:

 I agree, I rather pay a little more like in Modula-2 and Ada, than have
 what C++ has become.

--089e01681598cd82d904f2649341 Content-Type: text/html; charset=ISO-8859-1 <div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 13, 2014 at 11:46 AM, Paulo Pinto <span dir="ltr">&lt;<a href="mailto:pjmlp progtools.org" target="_blank">pjmlp progtools.org</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I agree, I rather pay a little more like in Modula-2 and Ada, than have what C++ has become.<br> <br></blockquote><div><br></div><div>You shouldn&#39;t really need to. Take a look at Rust for instance.</div><div><br></div><div><br></div></div></div></div> --089e01681598cd82d904f2649341--
Feb 14 2014
prev sibling parent "Meta" <jared771 gmail.com> writes:
On Friday, 14 February 2014 at 21:35:23 UTC, Ziad Hatahet wrote:
 On Thu, Feb 13, 2014 at 11:46 AM, Paulo Pinto 
 <pjmlp progtools.org> wrote:

 I agree, I rather pay a little more like in Modula-2 and Ada, 
 than have
 what C++ has become.


Rust has its own costs as compared to C++. There is no free lunch.
Feb 14 2014