digitalmars.D - No runtime attribute?
- bearophile (10/10) Dec 10 2014 The #[no_std] attribute is used to avoid the runtime in Rust.
- Stefan Koch (4/14) Dec 10 2014 In a similar vain.
- Mike (8/11) Dec 10 2014 I believe this is already possible with DMD because all druntime
- Mike (9/20) Dec 10 2014 Actually, I just remembered I've done this before with GDC and
- Daniel Murphy (3/7) Dec 10 2014 Why would you ever be writing code at this level and yet somehow not be ...
- John Colvin (7/18) Dec 10 2014 That was my thought too. I don't see the value of having a
- Mike (5/13) Dec 10 2014 Yes, it would be nice to separate *language* from *library*, but
- ketmar via Digitalmars-d (6/22) Dec 10 2014 this can be useful if compiler will generate error message with exact
- Mike (11/19) Dec 10 2014 I just remembered I had an idea for this specific feature that
- Mike (4/14) Dec 10 2014 Here's the previous thread where I discussed this:
Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes). This could give a compilation error: void foo(int[] a) noruntime { int[5] b = a[]; } Bye, bearophile
Dec 10 2014
On Wednesday, 10 December 2014 at 10:46:58 UTC, bearophile wrote:Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes). This could give a compilation error: void foo(int[] a) noruntime { int[5] b = a[]; } Bye, bearophileIn a similar vain. It would be very nice if we could subsitute individual functions of the runtime library by other functions or function pointers.
Dec 10 2014
On Wednesday, 10 December 2014 at 11:15:44 UTC, Stefan Koch wrote:It would be very nice if we could subsitute individual functions of the runtime library by other functions or function pointers.I believe this is already possible with DMD because all druntime functions are compiled as weak symbols. I don't believe this is the case for LDC and GDC, however. If LDC and GDC provided something equivalent to GCC's weak attribute, and the runtime functions were decorated with it, then the same method would work for all compilers. Mike
Dec 10 2014
On Wednesday, 10 December 2014 at 12:18:47 UTC, Mike wrote:On Wednesday, 10 December 2014 at 11:15:44 UTC, Stefan Koch wrote:Actually, I just remembered I've done this before with GDC and LDC. You do it with ld's -wrap switch. Example: http://forum.dlang.org/post/gqyzyldgdqhamtouyvcl forum.dlang.org LD's documentation: http://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html (see the bottom of the page) MikeIt would be very nice if we could subsitute individual functions of the runtime library by other functions or function pointers.I believe this is already possible with DMD because all druntime functions are compiled as weak symbols. I don't believe this is the case for LDC and GDC, however. If LDC and GDC provided something equivalent to GCC's weak attribute, and the runtime functions were decorated with it, then the same method would work for all compilers.
Dec 10 2014
"bearophile" wrote in message news:pibnlncyjzetohcnwyps forum.dlang.org...Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes).Why would you ever be writing code at this level and yet somehow not be able to just use the linker errors?
Dec 10 2014
On Wednesday, 10 December 2014 at 12:04:13 UTC, Daniel Murphy wrote:"bearophile" wrote in message news:pibnlncyjzetohcnwyps forum.dlang.org...That was my thought too. I don't see the value of having a semantic promise for this. bearophile: can you describe a practical use-case where there is an advantage to noruntime, other than "linker errors aren't pretty to read".Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes).Why would you ever be writing code at this level and yet somehow not be able to just use the linker errors?
Dec 10 2014
On Wednesday, 10 December 2014 at 10:46:58 UTC, bearophile wrote:Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes). This could give a compilation error: void foo(int[] a) noruntime { int[5] b = a[]; }Yes, it would be nice to separate *language* from *library*, but I've proposed such ideas in the past and they've only met resistance. Mike
Dec 10 2014
On Wed, 10 Dec 2014 10:46:56 +0000 bearophile via Digitalmars-d <digitalmars-d puremagic.com> wrote:=20 Do we have any use for a noruntime attribute in D? =20 All noruntime functions are also nogc (so you don't need to put=20 both attributes). =20 =20 This could give a compilation error: =20 void foo(int[] a) noruntime { int[5] b =3D a[]; } =20 Bye, bearophilethis can be useful if compiler will generate error message with exact runtime function signatures. i.e. something like: Error: foo() requires '_runtimeA(void*, size_t)' or even better: add a command-line switch to generate such reports.
Dec 10 2014
On Wednesday, 10 December 2014 at 10:46:58 UTC, bearophile wrote:Do we have any use for a noruntime attribute in D? All noruntime functions are also nogc (so you don't need to put both attributes). This could give a compilation error: void foo(int[] a) noruntime { int[5] b = a[]; }I just remembered I had an idea for this specific feature that would require no special attribute. You simply take all the hard-coded symbols out of the compiler and put them in a .di header file. Then you can version out, deprectate, disable, or not import the .di file if you don't want any or all of the runtime. I tried to implement this in GDC, but failed. I need to put more time into it to try and figure it out. Theoretically, though, I think it should work. Mike
Dec 10 2014
On Wednesday, 10 December 2014 at 12:50:19 UTC, Mike wrote:I just remembered I had an idea for this specific feature that would require no special attribute. You simply take all the hard-coded symbols out of the compiler and put them in a .di header file. Then you can version out, deprectate, disable, or not import the .di file if you don't want any or all of the runtime. I tried to implement this in GDC, but failed. I need to put more time into it to try and figure it out. Theoretically, though, I think it should work. MikeHere's the previous thread where I discussed this: http://forum.dlang.org/post/psssnzurlzeqeneagora forum.dlang.org Mike
Dec 10 2014