Template type deduction question

2020-05-20 Thread data pulverizer via Digitalmars-d-learn
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),

redirect std out to a string?

2020-05-20 Thread Kaitlyn Emmons via Digitalmars-d-learn
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

2020-05-20 Thread Adam D. Ruppe via Digitalmars-d-learn
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

Re: How to allocate/free memory under @nogc

2020-05-20 Thread Paul Backus via Digitalmars-d-learn
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

How to allocate/free memory under @nogc

2020-05-20 Thread data pulverizer via Digitalmars-d-learn
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

Re: String interpolation

2020-05-20 Thread Paul Backus via Digitalmars-d-learn
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

2020-05-20 Thread IGotD- via Digitalmars-d-learn
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

Re: Alias function declaration.

2020-05-20 Thread MaoKo via Digitalmars-d-learn
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

Re: String interpolation

2020-05-20 Thread mw via Digitalmars-d-learn
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

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread kinke via Digitalmars-d-learn
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

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread NonNull via Digitalmars-d-learn
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

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread IGotD- via Digitalmars-d-learn
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,

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread IGotD- via Digitalmars-d-learn
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

Re: How to use this forum ?

2020-05-20 Thread Mike Parker via Digitalmars-d-learn
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

2020-05-20 Thread kinke via Digitalmars-d-learn
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

Re: Assignment of tuples

2020-05-20 Thread Simen Kjærås via Digitalmars-d-learn
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 ?

2020-05-20 Thread Dukc via Digitalmars-d-learn
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:

Re: How to use this forum ?

2020-05-20 Thread Paul Backus via Digitalmars-d-learn
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

Re: How to use this forum ?

2020-05-20 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to use this forum ?

2020-05-20 Thread matheus via Digitalmars-d-learn
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

Re: How to use this forum ?

2020-05-20 Thread welkam via Digitalmars-d-learn
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

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread NonNull via Digitalmars-d-learn
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.

How to use this forum ?

2020-05-20 Thread Vinod K Chandran via Digitalmars-d-learn
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

2020-05-20 Thread kinke via Digitalmars-d-learn
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

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread welkam via Digitalmars-d-learn
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

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread welkam via Digitalmars-d-learn
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

large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread NonNull via Digitalmars-d-learn
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

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread Vinod K Chandran via Digitalmars-d-learn
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; ```

Vibed unix socket

2020-05-20 Thread Arjan via Digitalmars-d-learn
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 ?

2020-05-20 Thread welkam via Digitalmars-d-learn
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{

Re: Assignment of tuples

2020-05-20 Thread Steven Schveighoffer via Digitalmars-d-learn
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:

Assignment of tuples

2020-05-20 Thread Russel Winder via Digitalmars-d-learn
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

Re: final struct ?

2020-05-20 Thread wjoe via Digitalmars-d-learn
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 {

Dub installer (Windows)

2020-05-20 Thread Atwork via Digitalmars-d-learn
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)

2020-05-20 Thread Atwork via Digitalmars-d-learn
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.

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: link error on Windows

2020-05-20 Thread Nathan S. via Digitalmars-d-learn
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

Re: gzip and vibe.d

2020-05-20 Thread Atwork via Digitalmars-d-learn
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

Re: Why emsi containers have @disabled this(this) ?

2020-05-20 Thread Dukc via Digitalmars-d-learn
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

Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread drug via Digitalmars-d-learn
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,

Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread realhet via Digitalmars-d-learn
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

Re: Getting FieldNameTuple including all base-classes.

2020-05-20 Thread realhet via Digitalmars-d-learn
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

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
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

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
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

gzip and vibe.d

2020-05-20 Thread Atwork via Digitalmars-d-learn
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?