Re: Compile and run programs off USB drive
On Thursday, 21 May 2020 at 06:23:10 UTC, Joel wrote: With Windows OS. How would I use my USB drive to compile and run (with 64-bit too)? So far I made a bat file that adds D to %PATH%. There's no zip file of DMD to download, and I didn't get the 7z to work (even with the 7z program?!) - last time I tried. With 64-bit, I don't see what to do there .. edp.bat set PATH=\jpro\dmd2\windows\bin;\jpro\dpro2\Windows\dlls;%PATH% cd jpro\dpro2 Nevermind, I got it working just edited the bat file putting bin64 instead of bin. :)
Re: link error on Windows
On Wednesday, 20 May 2020 at 09:31:38 UTC, Nathan S. wrote: On Tuesday, 19 May 2020 at 04:54:38 UTC, Joel wrote: I tried with DMD32 D Compiler v2.088.1-dirty, and it compiled and created an exe file, but not run (msvcr100.dll not found - and tried to find it on the net without success). DMD 2.089 changed the default linking options. I bet an up-to-date DMD will also work if you invoke it as "dmd -m32mscoff". It should also work if you build it in 64-bit mode. Thanks Nathan. Got it to work using 64-bit. :)
Compile and run programs off USB drive
With Windows OS. How would I use my USB drive to compile and run (with 64-bit too)? So far I made a bat file that adds D to %PATH%. There's no zip file of DMD to download, and I didn't get the 7z to work (even with the 7z program?!) - last time I tried. With 64-bit, I don't see what to do there .. edp.bat set PATH=\jpro\dmd2\windows\bin;\jpro\dpro2\Windows\dlls;%PATH% cd jpro\dpro2
Template type deduction question
I'd like to pass kernel functions using: ``` auto calculateKernelMatrix(K, T)(K!(T) Kernel, Matrix!(T) data) { ... } ``` and call it using `calculateKernelMatrix(myKernel, myData);` but I get a type deduction error and have to call it using `calculateKernelMatrix!(typeof(myKernel), float)(myKernel, myData);` How do I resolve this?
redirect std out to a string?
is there a way to redirect std out to a string or a buffer without using a temp file?
Re: How to allocate/free memory under @nogc
On Thursday, 21 May 2020 at 02:50:22 UTC, data pulverizer wrote: Can you also confirm that `@nogc` in a class do the same thing in that class as it does for a function? I don't think it does anything in either case, but if it does anything it will just apply @nogc to each member function in them. Is `data` in `MyType` tracked by the garbage collector? Yes, it is tracked. What @nogc does is prohibit calling that function from ever calling the GC's collect method. It doesn't affect what is and isn't collected when that is eventually called somewhere else. If it is how do I allocate it in such a way that it is not? though you can malloc memory to hide it from the GC, you generally shouldn't. Note that in your example if T is ubyte or some other trivial value type it isn't scanned anyway since the static type info tells it it will never contain pointers/references.
Re: How to allocate/free memory under @nogc
On Thursday, 21 May 2020 at 02:50:22 UTC, data pulverizer wrote: I'm a bit puzzled about the whole `@nogc` thing. At first I thought it just switched off the garbage collector and that you had to allocate and free memory manually using `import core.memory: GC;` I tried this and it failed because @nogc means that the function can not allocate/free memory (https://dlang.org/spec/function.html#nogc-functions). If this is the case, how do you allocate/free memory without using the garbage collector? Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage collector? Also what is the syntax for removing dangling pointers? Marking a function @nogc means you can't use the garbage collector in that function, or call other functions that use it. It's still there, and functions that are not marked @nogc can still use it. To allocate memory without the GC, you have a couple of options. The simplest is to use C's malloc function, which can be found in the core.stdc.stdlib module. A more complicated but more powerful option is to use a non-GC-based memory allocator from the std.experimental.allocator package. Either way, you will have to take care of freeing the memory yourself, either manually or using a technique like RAII.
How to allocate/free memory under @nogc
I'm a bit puzzled about the whole `@nogc` thing. At first I thought it just switched off the garbage collector and that you had to allocate and free memory manually using `import core.memory: GC;` I tried this and it failed because @nogc means that the function can not allocate/free memory (https://dlang.org/spec/function.html#nogc-functions). If this is the case, how do you allocate/free memory without using the garbage collector? Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage collector? Also what is the syntax for removing dangling pointers? Can you also confirm that `@nogc` in a class do the same thing in that class as it does for a function? Also structs are not supposed to be tracked by the garbage collector but if I do something like this: ``` struct MyType(T) { T[] data; this(size_t n) { data = new T[n]; } } ``` Is `data` in `MyType` tracked by the garbage collector? If it is how do I allocate it in such a way that it is not? Thanks
Re: String interpolation
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote: Can we do string interpolation in D now? There's an implementation in the dub package "scriptlike": https://code.dlang.org/packages/scriptlike#string-interpolation
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 23:28:09 UTC, kinke wrote: The ABI for MinGW targets in general. - Judging by https://forum.dlang.org/post/anfwqjjsteeyelbdh...@forum.dlang.org, you apparently use a very different definition of 'ABI'. See http://uclibc.org/docs/psABI-x86_64.pdf or https://docs.microsoft.com/en-us/cpp/build/x64-software-conventions?view=vs-2019 for what an ABI is. I guess what you meant is the druntime API implicitly used by the compiler (mostly, the _d_* hooks like _d_assert, _d_newclass etc.). That's well-defined already, e.g., see https://github.com/ldc-developers/ldc/blob/master/gen/runtime.cpp. That's what I was thinking about, the ABI of x86-64 which originates from the ones that designed the ISA. The word ABI is used or misused in other areas as well, for example libc++abi which is a compatibility layer for libc++, that's why the word ABI turns up in a discussion about the druntime abstract interface.
Re: Alias function declaration.
On Wednesday, 20 May 2020 at 04:50:42 UTC, user1234 wrote: On Tuesday, 19 May 2020 at 22:04:49 UTC, MaoKo wrote: Hello. I just want to find what is exactly the difference between: alias _ = void function(int); alias void _(int); Because it's seem that the latter can't be used in the declaration of an array (eg: _[] ...). I think the first is a pointer to function and the second is a function type itself but I'm not sure. yes this is correct. To declare a function type using the first form is also possible: alias TF1 = void(int); alias void TF2(int); static assert (is(TF1 == TF2)); Ok thanks you :D
Re: String interpolation
On Tuesday, 10 November 2015 at 13:36:44 UTC, Andrea Fontana wrote: On Tuesday, 10 November 2015 at 12:40:07 UTC, Márcio Martins wrote: writeln(interp!"The number #{a} is less than #{b}"); Quite pleasant syntax this way :) Not sure if it's feasible to do this on the language side. Yes. Here a (stupid!) proof of concept: http://dpaste.dzfl.pl/74b1a4e3c8c6 $ cat i.d - import std.stdio; template interp(X) { alias interp = mixin(interpGenCode!X); } void main() { int a = 10; int b = 20; writeln(mixin(interp!"The number #{a} is less than #{b}")); writeln(interp!"The number #{a} is less than #{b}"); } - $ dmd.exe i.d i.d(10): Error: template instance interp!"The number #{a} is less than #{b}" does not match template declaration interp(X) i.d(11): Error: template instance interp!"The number #{a} is less than #{b}" does not match template declaration interp(X) I'm wondering if this code has once worked? and seems dpaste.dzfl.pl no longer there. Can we do string interpolation in D now? Speaking of language evolution in the other thread, C# has string interpolation now, here: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated string name = "Mark"; var date = DateTime.Now; Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now."); Python have it here: https://www.python.org/dev/peps/pep-0498/ import datetime name = 'Fred' age = 50 anniversary = datetime.date(1991, 10, 12) f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.' 'My name is Fred, my age next year is 51, my anniversary is Saturday, October 12, 1991.' f'He said his name is {name!r}.' "He said his name is 'Fred'." How can we do it in D? or when will we have it :-)?
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 23:08:53 UTC, IGotD- wrote: When you mention the ABI, is there something particular you have in mind or just in general? The ABI for MinGW targets in general. - Judging by https://forum.dlang.org/post/anfwqjjsteeyelbdh...@forum.dlang.org, you apparently use a very different definition of 'ABI'. See http://uclibc.org/docs/psABI-x86_64.pdf or https://docs.microsoft.com/en-us/cpp/build/x64-software-conventions?view=vs-2019 for what an ABI is. I guess what you meant is the druntime API implicitly used by the compiler (mostly, the _d_* hooks like _d_assert, _d_newclass etc.). That's well-defined already, e.g., see https://github.com/ldc-developers/ldc/blob/master/gen/runtime.cpp.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 23:10:12 UTC, IGotD- wrote: On Wednesday, 20 May 2020 at 23:08:53 UTC, IGotD- wrote: On Wednesday, 20 May 2020 at 21:37:23 UTC, kinke wrote: You're welcome. If you do come across an ABI issue, make sure to file an LDC issue. While I have no interest in MinGW, I want at least a working ABI. When you mention the ABI, is there something particular you have in mind or just in general? That's a question to TS, NonNull. General.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 23:08:53 UTC, IGotD- wrote: On Wednesday, 20 May 2020 at 21:37:23 UTC, kinke wrote: You're welcome. If you do come across an ABI issue, make sure to file an LDC issue. While I have no interest in MinGW, I want at least a working ABI. When you mention the ABI, is there something particular you have in mind or just in general? That's a question to TS, NonNull.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 21:37:23 UTC, kinke wrote: You're welcome. If you do come across an ABI issue, make sure to file an LDC issue. While I have no interest in MinGW, I want at least a working ABI. When you mention the ABI, is there something particular you have in mind or just in general?
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 21:06:35 UTC, welkam wrote: On Wednesday, 20 May 2020 at 20:49:52 This is not a forum but a frontend to a mailing list. Both the forums and the mailing lists are interfaces to newsgroups at news.digitalmars.com.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 20:45:26 UTC, NonNull wrote: [...] so I will likely go with ldc2 with the option you suggested and see how it goes. Thanks again! You're welcome. If you do come across an ABI issue, make sure to file an LDC issue. While I have no interest in MinGW, I want at least a working ABI.
Re: Assignment of tuples
On Wednesday, 20 May 2020 at 13:51:05 UTC, Steven Schveighoffer wrote: Please file an issue. https://issues.dlang.org/show_bug.cgi?id=20850 -- Simen
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? No can do :(. Well, moderators can delete posts so you could try to ask them nicely in some cases but the primary way tends to be the same as with email: send a correction message. And if I recall correctly, this forum is based on some email system, so even if a moderator deletes something, it'll probably only be hidden from those that talk via forum.dlang.org - not from those that use their email. 2. How to edit a reply ? Same as above. 3. How to add some code(mostly D code) in posts & replies. Matter of taste. I personally tend to do it like this: ``` void main() { import std.stdio; writeln("hello world!"); } ``` Another good way is to use https://run.dlang.io/ and export your code as gist from there. 4. How to add an image in posts & replies. Add it somewhere else and post a link to it. 5. Is there a feature to mark my post as "[SOLVED]" ? Alas, no.
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? You can't. If you need to make a correction, the best you can do is to make a follow-up post. 3. How to add some code(mostly D code) in posts & replies. Copy & paste it. 4. How to add an image in posts & replies. You can't embed images directly. I'd recommend uploading your image to a hosting site like imgur and pasting the link into your post. 5. Is there a feature to mark my post as "[SOLVED]" ? No. If you're wondering why these limitations exist, it's because this forum is actually a web interface for the D mailing lists [1]. You can't edit email after it's been sent, so you can't edit your posts here either. [1] https://forum.dlang.org/help#about
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 21:06:35 UTC, welkam wrote: On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? 3. How to add some code(mostly D code) in posts & replies. 4. How to add an image in posts & replies. 5. Is there a feature to mark my post as "[SOLVED]" ? This is not a forum but a frontend to a mailing list. Since you cant edit sent emails you cant do 1, 2 and 5. if you want to add code then post it in a message if its short. If not try using github gist. Thanks again. But what about the images ?
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? 3. How to add some code(mostly D code) in posts & replies. 4. How to add an image in posts & replies. 5. Is there a feature to mark my post as "[SOLVED]" ? In few words: This Forum is an interface for mailing lists, you can't do most of these things, I mean not as easy like you do in most Forums (With database to edit content). Personally I prefer this way, because I really hate when people edit their posts, even for good reasons. Matheus.
Re: How to use this forum ?
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? 3. How to add some code(mostly D code) in posts & replies. 4. How to add an image in posts & replies. 5. Is there a feature to mark my post as "[SOLVED]" ? This is not a forum but a frontend to a mailing list. Since you cant edit sent emails you cant do 1, 2 and 5. if you want to add code then post it in a message if its short. If not try using github gist.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 19:25:27 UTC, kinke wrote: On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote: Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? The natural choice for coupling mingw[64]-gcc would be GDC. Especially wrt. ABI, gdc apparently doesn't have to do much by itself, in sharp contrast to LDC. No idea where gdc's MinGW[-w64] support is at though and whether you need more recent D features not available in gdc. [...] Thanks for the detailed information! I see your point about gdc's ABI, but it seems gdc is not distributed for Windows at this juncture and I am looking for a simple way forward, so I will likely go with ldc2 with the option you suggested and see how it goes. Thanks again!
How to use this forum ?
Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? 3. How to add some code(mostly D code) in posts & replies. 4. How to add an image in posts & replies. 5. Is there a feature to mark my post as "[SOLVED]" ?
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote: Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? The natural choice for coupling mingw[64]-gcc would be GDC. Especially wrt. ABI, gdc apparently doesn't have to do much by itself, in sharp contrast to LDC. No idea where gdc's MinGW[-w64] support is at though and whether you need more recent D features not available in gdc. Wrt. LDC, I think the C ABI for the `-mtriple=x86_64-windows-gnu` target should be okay. IIRC, MinGW mostly adheres to Microsoft's official Win64 ABI and mostly just diverges wrt. `real` (80-bit x87 C `long double` vs. 64-bit double precision for MSVC), and that's covered by LDC IIRC. The C++ ABI (Itanium mangling, not the MSVC one) should be okay-ish; there might be differences wrt. what's considered a POD between MinGW and MSVC. Exception handling almost certainly doesn't work; TLS may likely not work either. In general, druntime and Phobos don't fully support MinGW[-w64], but if you restrict yourself to -betterC code, that might not be a problem. How can I use D in this situation, where I need it to work directly with C data? building DLLs is not going to work here for that reason. With -betterC, generating mixed DLLs shouldn't be any trouble at all.
Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler
On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote: Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? I am not expert here but doesnt all C compilers have the same ABI? If yes then compile your code in 32 bits for 32 bit C obj files. If you are on 64 bit OS then D compilers will produce 64 bit executables by default. To change that use https://dlang.org/dmd-linux.html#switch-m32
Re: Is it possible to write some class members in another module ?
On Wednesday, 20 May 2020 at 17:29:47 UTC, Vinod K Chandran wrote: I am very sad that i delayed to start learning D only because of semicolons and curly braces. Walter(creator of this language) said that redundant grammar is a good thing because it allows compiler to emit better error messages.
large Windows mingw64 project in C99 --- need ABI compatible D compiler
Hello, I have a large project written in C99 handed to me that 32-bit builds in Windows with the mingw32 compiler that comes with msys2. I'm working on 64-bit Windows 10. Need to solve some nasty problems and move the build to 64 bits using the mingw64 compiler that comes with msys2. Want to use D to improve some parts of this monster. But am confused about ABI issues. Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? The most important is the D compiler that is ABI compatible with the 64-bit mingw compiler because that is where this project is going. How can I use D in this situation, where I need it to work directly with C data? building DLLs is not going to work here for that reason.
Re: Is it possible to write some class members in another module ?
On Wednesday, 20 May 2020 at 15:01:36 UTC, welkam wrote: On Wednesday, 20 May 2020 at 09:45:48 UTC, Vinod K Chandran wrote: // Now, we need to use like this auto form= new Window(); form.event.click = bla_bla; // I really want to use like this auto form= new Window(); form.click = bla_bla; ``` Then you want alias this. class Window : Control{ Events event; alias event this . } and now when you write form.click = bla_bla; Compiler first checks if form.click compiles and if it doesnt it then it tries form.event.click Wow !!! What a perfect solution ! That is what i wanted. Thanks a lot friend. :) The more i practice D, the more i am loving it. I am very sad that i delayed to start learning D only because of semicolons and curly braces. But now i recognizes that how beautiful this language is.
Vibed unix socket
I noticed vibe has gained support for unix sockets. What is unclear (at least from API docs) how to create a raw unix stream socket. should `listenTCP` and `connectTCP` be used? Seems weird because those require a 'port'..
Re: Is it possible to write some class members in another module ?
On Wednesday, 20 May 2020 at 09:45:48 UTC, Vinod K Chandran wrote: // Now, we need to use like this auto form= new Window(); form.event.click = bla_bla; // I really want to use like this auto form= new Window(); form.click = bla_bla; ``` Then you want alias this. class Window : Control{ Events event; alias event this . } and now when you write form.click = bla_bla; Compiler first checks if form.click compiles and if it doesnt it then it tries form.event.click
Re: Assignment of tuples
On 5/20/20 8:17 AM, Russel Winder wrote: So I have an enum: enum RC5Command: Tuple!(ubyte, ubyte) { Standby = tuple(to!ubyte(0x10), to!ubyte(0x0c)), … I can do: RC5Command rc5command = RC5Command.CD; However, if I do: rc5command = RC5Command.BD; I get: source/functionality.d(80,16): Error: template std.typecons.Tuple!(ubyte, ubyte).Tuple.opAssign cannot deduce function from argument types !()(RC5Command), candidates are: /usr/lib/ldc/x86_64-linux-gnu/include/d/std/typecons.d(900,19): opAssign(R)(auto ref R rhs) with R = RC5Command must satisfy the following constraint: areCompatibleTuples!(typeof(this), R, "=") which is totally unreasonable. And yet D insists. I guess there is an explanation, but mostly this seems like a bug. The issue is that it's not EXACTLY a Tuple, because it's a derived type. So it fails isTuple (In fact, I think the compiler just isn't smart enough to detect that it can be implicitly converted to a Tuple). But that defeats a lot of wrapping mechanisms, which I think is unnecessary. I think there should probably be an overload: opAssign(Tuple t) {expand = t.expand;} that trumps the template one. That should I think take care of it. Please file an issue. -Steve
Assignment of tuples
So I have an enum: enum RC5Command: Tuple!(ubyte, ubyte) { Standby = tuple(to!ubyte(0x10), to!ubyte(0x0c)), … I can do: RC5Command rc5command = RC5Command.CD; However, if I do: rc5command = RC5Command.BD; I get: source/functionality.d(80,16): Error: template std.typecons.Tuple!(ubyte, ubyte).Tuple.opAssign cannot deduce function from argument types !()(RC5Command), candidates are: /usr/lib/ldc/x86_64-linux-gnu/include/d/std/typecons.d(900,19): opAssign(R)(auto ref R rhs) with R = RC5Command must satisfy the following constraint: areCompatibleTuples!(typeof(this), R, "=") which is totally unreasonable. And yet D insists. I guess there is an explanation, but mostly this seems like a bug. -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: final struct ?
On Wednesday, 20 May 2020 at 04:40:33 UTC, user1234 wrote: On Tuesday, 19 May 2020 at 10:29:51 UTC, wjoe wrote: On Tuesday, 19 May 2020 at 10:08:37 UTC, user1234 wrote: [...] Thank you. A little sample to show you more cases of attributes that have no effect: --- struct Foo { nothrow @nogc int field; // why not ? void func() { void nested() const { field++; // mutation is allowed because const is a noop extern int j; // extern decl in a nested func... } nothrow i = 8;// just like auto pure f = 9; // just like auto @safe s = 10; // just like auto @system t = s;// just like auto } } void main() { } --- much appreciated :)
Dub installer (Windows)
Is there no longer an installer for Dub on Windows? The download page just links to the release page on Github but all of the archives just contain dub.exe Do I have to manually add it to PATH etc. now? That is painful having to do.
Re: Dub installer (Windows)
On Wednesday, 20 May 2020 at 10:50:10 UTC, Atwork wrote: Is there no longer an installer for Dub on Windows? The download page just links to the release page on Github but all of the archives just contain dub.exe Do I have to manually add it to PATH etc. now? That is painful having to do. Nvm. Figured it out. It came with DMD.
Re: Is it possible to write some class members in another module ?
On Tuesday, 19 May 2020 at 23:51:45 UTC, Boris Carvajal wrote: On Tuesday, 19 May 2020 at 22:01:03 UTC, Vinod K Chandran wrote: Hi all, Is it possible to write some class members in another module ? I have class with a lot of member variables.(probably 50+) I would like to write them (Not all, but some of them) in a special module for the sake of maintenance. You can use Template Mixins to add variable declarations in others scope. https://dlang.org/spec/template-mixin.html Thank you for the reply. Let me check. :)
Re: Is it possible to write some class members in another module ?
On Tuesday, 19 May 2020 at 22:10:25 UTC, Adam D. Ruppe wrote: On Tuesday, 19 May 2020 at 22:01:03 UTC, Vinod K Chandran wrote: Is it possible to write some class members in another module ? You can make some of members be other structs that you aggregate together. That's a good idea but there is a problem. As per your idea-- ``` struct Events{ uint click; uint shown; uint move; } class Window : Control{ Events event; . } // Now, we need to use like this auto form= new Window(); form.event.click = bla_bla; // I really want to use like this auto form= new Window(); form.click = bla_bla; ```
Re: link error on Windows
On Tuesday, 19 May 2020 at 04:54:38 UTC, Joel wrote: I tried with DMD32 D Compiler v2.088.1-dirty, and it compiled and created an exe file, but not run (msvcr100.dll not found - and tried to find it on the net without success). DMD 2.089 changed the default linking options. I bet an up-to-date DMD will also work if you invoke it as "dmd -m32mscoff". It should also work if you build it in 64-bit mode.
Re: gzip and vibe.d
On Wednesday, 20 May 2020 at 07:49:28 UTC, Daniel Kozak wrote: On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: Is it possible to have vibe.d gzip responses? I cannot find anything in the documentation about it. I am not talking about gzipping ex. files/streams but ALL responses as a whole. Is there a configuration or something I need to set for it to be supported? https://vibed.org/api/vibe.http.server/HTTPServerSettings.useCompressionIfPossible Thank you!
Re: Why emsi containers have @disabled this(this) ?
On Tuesday, 19 May 2020 at 20:51:01 UTC, Luis wrote: I saw that they have postblit operator... But i don't understand exactly why. In special, when they implement InputRange over the containers, but having disabled postblit, make nearly useless (at least as I see on this old post https://forum.dlang.org/thread/n1sutu$1ugm$1...@digitalmars.com?page=1 ) You have to understand the memory management difference between EMSI-containers and regular D slices. A normal slice won't worry about freeing the memory used. It just assumes that either the garbage collector will take care of it (the usual case), or that the code will tell manually when the memory really needs to be freed (possibly by some other reference to the same memory). EMSI-containers, however, are designed to free their memory after use themselves. They do it by the Resource Acquisition Is Initialization principle: when the container gets deleted, the underlying data gets freed right away. This leads to that there must be only one container using the same memory. It would not do to make a copy of it, unless it's a deep copy (Deep copy means that also the underlying memory is copied. It tends to take long.). This is the reason that postblits are disabled in EMSI-containers. It wants to protect you from accidents. If you want to store the same container in many places, store references to it instead. And when iterating over it, you get the underlying range first, like Mike said. The underlying range can likely be copied freely.
Re: Getting FieldNameTuple including all base-classes.
On 5/20/20 12:03 PM, realhet wrote: On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: I think what you want is `std.meta.staticMap`. Something like this: alias FieldNameTuple2(T) = staticMap!(FieldNameTuple, BaseClassesTuple!T); class A { int a, a1; } class B : A { int b; } class C : B { int c, c1; } alias AllClasses(T) = Reverse!(AliasSeq!(T, BaseClassesTuple!T[0..$-1])); alias AllFieldNames(T) = staticMap!(FieldNameTuple, AllClasses!T); void main(){ static foreach(T; "ABC") mixin("AllFieldNames!"~T~".stringof.writeln;"); } That statticMap unlike the normal map, it also joins the AliasSeq at the end. Just what I needed. Thank You! Just in case - you can avoid mixin using: ```D static foreach(T; AliasSeq!(A, B, C)) AllFieldNames!T.stringof.writeln; ``` https://run.dlang.io/is/Q6omgL
Re: Getting FieldNameTuple including all base-classes.
On Wednesday, 20 May 2020 at 09:03:51 UTC, realhet wrote: On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: With this mod it also works with structs: template AllClasses(T){ static if(is(T == class)) alias AllClasses = Reverse!(AliasSeq!(T, BaseClassesTuple!T[0..$-1])); else alias AllClasses = T; }
Re: Getting FieldNameTuple including all base-classes.
On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote: On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote: I think what you want is `std.meta.staticMap`. Something like this: alias FieldNameTuple2(T) = staticMap!(FieldNameTuple, BaseClassesTuple!T); class A { int a, a1; } class B : A { int b; } class C : B { int c, c1; } alias AllClasses(T) = Reverse!(AliasSeq!(T, BaseClassesTuple!T[0..$-1])); alias AllFieldNames(T) = staticMap!(FieldNameTuple, AllClasses!T); void main(){ static foreach(T; "ABC") mixin("AllFieldNames!"~T~".stringof.writeln;"); } That statticMap unlike the normal map, it also joins the AliasSeq at the end. Just what I needed. Thank You!
Re: gzip and vibe.d
On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping ex. files/streams but ALL > responses as a whole. > > Is there a configuration or something I need to set for it to be > supported? https://vibed.org/api/vibe.http.server/HTTPServerSettings.useCompressionIfPossible
Re: gzip and vibe.d
https://vibed.org/api/vibe.http.server/HTTPServerSettings.useCompressionIfPossible On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping ex. files/streams but ALL > responses as a whole. > > Is there a configuration or something I need to set for it to be > supported?
gzip and vibe.d
Is it possible to have vibe.d gzip responses? I cannot find anything in the documentation about it. I am not talking about gzipping ex. files/streams but ALL responses as a whole. Is there a configuration or something I need to set for it to be supported?