Re: Recommendations on porting Python to D

2024-07-12 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: I can just call my old C code from D, but the old Python is another story. Thanks for any advice you may have, You could also try some AI solution

Serial communication library

2022-09-22 Thread Imperatorn via Digitalmars-d-learn
Hi guys! What's the best/preferred library to use for serial communication (RS)? Thanks 🍀

Re: Serial communication library

2022-09-24 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 22 September 2022 at 12:05:00 UTC, Imperatorn wrote: Hi guys! What's the best/preferred library to use for serial communication (RS)? Thanks 🍀 I will give onyx-serial a try

Re: Interfacing with Rust

2022-09-29 Thread Imperatorn via Digitalmars-d-learn
On Friday, 30 September 2022 at 00:18:42 UTC, Ruby The Roobster wrote: On Thursday, 29 September 2022 at 16:07:59 UTC, mw wrote: On Thursday, 29 September 2022 at 16:02:43 UTC, Ruby The Roobster wrote: Is there any way one can interface with Rust, such as with a struct, or a function? I know

D installer

2022-10-02 Thread Imperatorn via Digitalmars-d-learn
I only have Visual Studio 2022. Will the installer be updated to support that or am I missing some components? ![Installer](https://i.ibb.co/sCZRFRf/installer.jpg) Thanks!

Re: D installer

2022-10-02 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 2 October 2022 at 12:37:37 UTC, Mike Parker wrote: On Sunday, 2 October 2022 at 11:33:47 UTC, Imperatorn wrote: I only have Visual Studio 2022. Will the installer be updated to support that or am I missing some components? ![Installer](https://i.ibb.co/sCZRFRf/installer.jpg) You

Re: How do I correctly install packages for use with Visual Studio?

2022-10-16 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 16 October 2022 at 11:42:04 UTC, matheus wrote: On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote: I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Vi

Re: How to pass noncopyable variadic arguments with ref?

2022-10-20 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 20 October 2022 at 14:03:10 UTC, tchaloupka wrote: Hi, I've found strange behavior where: ```D import std.stdio; struct Foo { @disable this(this); int x; } void test(Foo[] foos...) { foreach (ref f; foos) { writeln(&f, ": ", f.x); f.x = 0; } } void

Re: is dmd a virus?

2022-10-22 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 22 October 2022 at 07:40:39 UTC, MGW wrote: is dmd a virus? https://www.virustotal.com report: Cybereason --> Malicious.779f29 VBA32 --> BScope.Trojan.DShell Yes, it's a virus... 😇 No, it's a false positive

Re: Hipreme's #2 Tip of the day - Reducing .di files dependency

2022-10-24 Thread Imperatorn via Digitalmars-d-learn
On Monday, 24 October 2022 at 12:10:19 UTC, Nick Treleaven wrote: On Sunday, 23 October 2022 at 20:12:46 UTC, Hipreme wrote: For reducing a D Interface file dependency when generating it with the `-H` flag for DMD, you can't import a module on the top level. Take a look at that example: This

Re: Disabling All Inlining in DMD Debug Builds

2022-10-24 Thread Imperatorn via Digitalmars-d-learn
On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote: I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing oper

Re: Supporting foreach (k, v; T.init) for a user-defined (container) type

2022-10-25 Thread Imperatorn via Digitalmars-d-learn
On Monday, 24 October 2022 at 21:52:18 UTC, Ali Çehreli wrote: On 10/24/22 14:26, Per Nordlöw wrote: [...] Another option is to use range functions where front() returns a Tuple. We have an esoteric feature where a tuple expands automatically in foreach loops: import std.typecons : tuple;

Re: how to benchmark pure functions?

2022-10-27 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: Hi, when trying to compare different implementations of the optimized builds of a pure function using benchmark from std.datetime.stopwatch, I get times equal to zero, I suppose because the functions are not executed as they do not have

Re: how to benchmark pure functions?

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote: On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: [...] Thanks to H.S. Teoh and Dennis for the suggestions, they both work. I like the empty asm block a bit more because it is less invasive, but it only works with ldc. @Imperatorn

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 17:45:59 UTC, Carsten Schlote wrote: Hi, I created a Dub project containing two files: app.d and zstd_binding.c [...] Are you using DMD?

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 18:43:21 UTC, Carsten Schlote wrote: On Friday, 28 October 2022 at 18:31:25 UTC, Steven Schveighoffer wrote: [...] ``` $ cat dub.json { "authors": [ "Carsten Schlote" ], "copyright": "Copyright © 2022, Carsten Schlote",

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 19:04:21 UTC, Carsten Schlote wrote: On Friday, 28 October 2022 at 18:56:03 UTC, Imperatorn wrote: Like schveiguy said, what's your build line? dmd should pick up the file if the import has the same name as the file. What do you mean with 'buildline'? The project

Re: Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 12:46:10 UTC, Carsten Schlote wrote: It turned out, that the required changes to add support for C files in Dub are really small. So I added a PR (https://github.com/dlang/dub/pull/2521). There is also some other PR (https://github.com/dlang/dub/pull/2270) releated

Re: Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 14:42:55 UTC, Carsten Schlote wrote: On Sunday, 30 October 2022 at 13:38:23 UTC, Imperatorn wrote: [...] I will merge the two PRs into a new patchset, and also add appropriate code to search fĂŒr {c|i|h} files at the right places. The patchset should be as minima

Re: overloading main

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 16:09:54 UTC, NonNull wrote: I am linking to a C project with some C already automatically translated into D including the C main function `int main(int argc, char** argv){/* ... */}` which I wanted to call from a D main function in a new module. But then I found t

Re: overloading main

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 17:29:25 UTC, NonNull wrote: On Sunday, 30 October 2022 at 16:31:45 UTC, Imperatorn wrote: You should not have multiple mains. Rename it and call it Doesn't answer my questions. I wasn't asking for practical, moral or esthetic advice. Try to phrase your questio

Re: overloading main

2022-10-31 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 23:43:03 UTC, NonNull wrote: On Sunday, 30 October 2022 at 18:24:22 UTC, Adam D Ruppe wrote: [...] Ah, makes sense to limit the possible low level error messages with separate compilation because of the linker not knowing D signatures. Thanks for the intuition.

Re: A strange DMD error

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the co

Re: A strange DMD error

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 15:49:54 UTC, Keivan Shah wrote: On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just a

Re: druntime thread (from foreach parallel?) cleanup bug

2022-11-01 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 19:49:47 UTC, mw wrote: On Tuesday, 1 November 2022 at 18:18:45 UTC, Steven Schveighoffer wrote: [...] Maybe the hunt library author doesn't know. (My code does not directly use this library, it got pulled in by some other decencies.) [...] Please, if you

Re: Unit testing a function returning void

2022-11-03 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 3 November 2022 at 10:00:27 UTC, Bruno Pagis wrote: Good morning, I have the following class: ``` class A { int[] array; ... void print() { writeln("array = ", this.array); } } ``` I would like to unit test the print function (yes, I know, not very useful on the abov

Re: Unit testing a function returning void

2022-11-03 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 3 November 2022 at 10:26:04 UTC, Imperatorn wrote: On Thursday, 3 November 2022 at 10:00:27 UTC, Bruno Pagis wrote: Good morning, I have the following class: ``` class A { int[] array; ... void print() { writeln("array = ", this.array); } } ``` I would like to unit t

Re: Hipreme's #3 Tip of the day - Changing DMD linker on Windows

2022-11-03 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 16:17:08 UTC, Hipreme wrote: The linker used on Windows when installing DMD is pretty much decided on how your PC was setup. [...] Do you have a blog?

Re: save() feature for iota

2022-11-04 Thread Imperatorn via Digitalmars-d-learn
On Friday, 4 November 2022 at 08:48:36 UTC, Salih Dincer wrote: On Thursday, 3 November 2022 at 11:58:20 UTC, Paul Backus wrote: On Thursday, 3 November 2022 at 06:26:22 UTC, Salih Dincer Looking at the source, it seems that only the numeric overloads of `iota` implement `save`. I think this is

Re: Makefiles and dub

2022-11-05 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 5 November 2022 at 11:38:09 UTC, rikki cattermole wrote: We have a few build formats that dub can generate for you automatically: ``` visuald - VisualD project files sublimetext - SublimeText project file cmake - CMake build scripts build - Builds the package directly ``` Unfortun

Re: Linking not working properly Windows 11

2022-11-05 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 5 November 2022 at 13:30:43 UTC, bauss wrote: Fresh install of DMD and when trying to use ex. std.file from Phobos I get the following linking error: (I can trigger different ones depending on modules imported etc.) [...] Im also on Windows 10 and 11 and don't have any problems

Re: My new programming book ...

2022-11-06 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 6 November 2022 at 22:43:33 UTC, ikelaiah wrote: Hi, I got a new programming book yesterday, authored by Adam D. Rupee. [...] Agreed. It's a great book with a "get it done"-attitude <3

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. 1) Create a directory: [...] That's not the behaviour I get in Windows. When I create the subdirectory, I see it even if it's empty

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 20:06:15 UTC, Ali Çehreli wrote: On 11/9/22 11:05, Ali Çehreli wrote: It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for the user! You can walk the tree but can't put the results into your local context!

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:59:57 UTC, Ali Çehreli wrote: On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct DirI

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for me:

Re: Making sense out of scope and function calls

2022-11-13 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 13 November 2022 at 19:06:40 UTC, 0xEAB wrote: ```d struct Foo { /* 
 */ hstring[] getHeader(LowerCaseToken name) scope return { return _headers[name].values; } [...] There's an old saying "you can't make sense out of scope"

Re: Proper way to exit with specific exit code?

2022-11-13 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 13 November 2022 at 21:37:47 UTC, mw wrote: On Sunday, 13 November 2022 at 21:16:32 UTC, mw wrote: I even tried core.stdc.stdlib.exit(-1), it does not work. Tried ``` import core.runtime; Runtime.terminate(); core.stdc.stdlib.exit(-1); ``` Still does not work. I have no id

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) which bypasses the MAX_PATH limitation for local paths (e.g., C:\Us

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote: On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) whi

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Monday, 14 November 2022 at 14:43:50 UTC, Preetpal wrote: On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote: On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: [...] Have you set longPathAware in the applications manifest? Yeah that's how I dealt with the issue. I

Re: Get the class name without casting the type

2022-11-15 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 15 November 2022 at 12:25:22 UTC, Hipreme wrote: On Tuesday, 15 November 2022 at 11:42:59 UTC, Alexander Zhirov wrote: As shown you can use Object for this. Side-note, you don't override interface members, you implement them. ```d interface A { string

Re: Running GtkD programs on macOS

2022-11-29 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 29 November 2022 at 07:17:09 UTC, Joel wrote: On Saturday, 30 November 2019 at 00:17:51 UTC, Mike Wey wrote: On 29-11-2019 04:40, Joel wrote: Oh, I used 'brew install gtk+3', and the test program worked, but (see below) I don't know about all that installing - is that alright? Th

Re: Terminating the process of a running LDC2 compiler.

2023-03-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 11:38:11 UTC, realhet wrote: Hello, Is it safe to kill an ongoing LDC2 process on Windows? My situation is this: - I launch 8 LDC2 compilation command lines on 8 DLang source files. - One of them has a compilation error and quits. - At this point I wait the compl

Re: C to D: please help translate this weird macro

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D [here](https://

Re: Detect 8-bit alligned type TXY by TX,TY.

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 19 September 2023 at 06:41:49 UTC, Vitaliy Fadeev wrote: On Tuesday, 19 September 2023 at 06:33:25 UTC, Richard (Rikki) Andrew Cattermole wrote: [...] Thank, Richard. ```.offsetof...``` mmm... May be exists some like: ```d // TXYXY = Detect!(TX,TX) // Detect!(uint,uint) == ulong

Re: change object class

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev wrote: Hi! I want to change a method ```Draw``` on a custom object when the ```MouseIn``` event occurs. This is known as "Change State" of the object: ```Init``` -> ```Hovered```. [...] Interesting, but why would you want to do it

Re: change object class

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev wrote: ... ``` Chip id name Sense() Draw() ``` instance ``` chip = new Chip(); ``` compiled to ``` chip __vtbl -> Chip __monito

Re: parallelism with delegate

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev wrote: able ? how to use correctly? ```d import std.parallelism; auto async_task = task!fn( args ); // error // Error: no property `opCall` for type `app.A`, did you mean `new A`? async_

Re: change object class

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 14:03:40 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 12:53:28 UTC, Imperatorn wrote: On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev wrote: [...] What I mean is, why not use other language constructs like mixins or inheritance with

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download. If you want an asynchro

Re: Is it possible to create a kernel for an operating system in D?

2023-09-26 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 26 September 2023 at 03:31:36 UTC, I come from chill. wrote: It seems very obvious, but I have not been able to find any information on the subject to confirm this. So I'm wondering if it's possible. ** Maybe I shouldn't have created the account, literally this will be one of the

Re: Binary size optimization

2023-09-28 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 28 September 2023 at 08:38:42 UTC, Imperatorn wrote: Today I randomly tried compiling a hello world using DMD, LDC and gcc (yes, not gdc) I compared binary sizes and something looked off. The D ones were much larger. Sometimes 10x, with some optimizations still about 2x. But, t

Re: startsWith

2023-09-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 05:33:36 UTC, Joel wrote: ```d void main() { import std.string : split; import std.algorithm.searching : startsWith; string bk="Exo"; assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~ "1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pr

Re: Straight Forward Arrays

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tuple: (pointer to elements, length, capacity). [...] https://dlang.org/spec/simd.html https://dlang.org/phobos/core_simd.ht

Re: Straight Forward Arrays

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 13:24:27 UTC, dhs wrote: On Sunday, 1 October 2023 at 13:05:12 UTC, Steven Schveighoffer wrote: On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tu

Re: Key and value with ranges

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 02:47:37 UTC, Joel wrote: ```d import std; auto data=“I went for a walk, and fell down a hole.”; void main(string[] args) { int[string] dic; struct WordCnt { string word; ulong count; string toString() const { return text(

Re: Key and value with ranges

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 02:47:37 UTC, Joel wrote: ```d import std; auto data=“I went for a walk, and fell down a hole.”; You can improve it further by inlining ```d import std; auto data = "I went for a walk, and fell down a hole."; void main(string[] args) { int[string] dic;

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: Here is my issue: I've found a formula on Wikipedia. It's called **Hashing by division**. ![](https://i.imgur.com/UJPAWIW.png) As you can see it uses **mod** keyword to achieve the modulus operation. In D language we use modulus operato

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: On Monday, 2 October 2023 at 18:39:41 UTC, Imperatorn wrote: On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: [...] https://dlang.org/spec/operatoroverloading.html#binary Overloading seems to only overload behaviour of existing

Re: The difference between T[] opIndex() and T[] opSlice()

2023-10-03 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 17:52:20 UTC, Paul Backus wrote: On Tuesday, 3 October 2023 at 16:45:39 UTC, Steven Schveighoffer wrote: OK, so it's not as bad as I thought, but surely the compiler should recognize that `opIndexAssign(val, idx)` doesn't work, but `opIndex(idx) = val` does? Ma

Re: array setting : Whats going in here?

2023-10-08 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 7 October 2023 at 00:00:48 UTC, claptrap wrote: char[] foo; foo.length = 4; foo[] = 'a'; // ok sets all elements foo[] = "a"; // range error at runtime? foo[] = "ab"; // range error at runtime? So I meant to init with a char literal but accidently used double quotes. Should that e

Re: array setting : Whats going in here?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 02:19:20 UTC, Jonathan M Davis wrote: On Sunday, October 8, 2023 8:08:46 AM MDT Imperatorn via Digitalmars-d-learn wrote: [...] Except that in those examples, they _do_ match. It's perfectly valid to copy elements of a string to a char[]. It's jus

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 16:55:41 UTC, rempas wrote: On Monday, 9 October 2023 at 16:53:55 UTC, mw wrote: but you `import std.stdio;`? Or copy the std/conv.d over to your build, or copy / write a toString(int) function yourself, which is compile-time callable. I do on that example just

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 22:49:11 UTC, Salih Dincer wrote: On Monday, 9 October 2023 at 16:33:32 UTC, rempas wrote: I'm trying to create a series of function. There will be ten of them, and they will be called `function_0`, `function_1`, etc. However, in my example, "stringof" returns the c

Re: is the array literal in a loop stack or heap allocated?

2023-10-10 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 11 October 2023 at 02:54:53 UTC, mw wrote: Hi, I want to confirm: in the following loop, is the array literal `a` vs. `b` stack or heap allocated? and how many times? void main() { int[2] a; int[] b; int i; While(++i <=100) { a = [i, i+1]; // array literal b = [i, i+1];

Re: extern (c)

2023-10-11 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 11 October 2023 at 13:36:16 UTC, Paul wrote: On Wednesday, 11 October 2023 at 12:54:53 UTC, user1234 wrote: `extern(C)` on module level functions affect the mangling and the calling convention. - Mangling is used by the linker to link symbols between objects. - Calling convent

D http benchmarks

2023-10-11 Thread Imperatorn via Digitalmars-d-learn
Just sharing https://github.com/tchaloupka/httpbench

Re: The Power of Grammar Checkers: A Game-Changer for Writers!

2023-10-12 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 06:08:43 UTC, charles reiley wrote: I hope you're all doing well in your writing endeavors! Today, I wanted to share my thoughts and experiences with grammar checkers, and I can't emphasize enough how much of a game-changer they've been for me at [url=https://my

Re: Need csv writer (std.csv only has csvReader)

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 23:18:23 UTC, John Xu wrote: Any friend can help me with a csvWriter? The std.csv only has a csvReader. I want to dump database from sqlite to mysql. If I do it manually, I need handle double quote("), \n, ',' specifically Have you looked at https://code.dlan

Re: Need csv writer (std.csv only has csvReader)

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 23:18:23 UTC, John Xu wrote: Any friend can help me with a csvWriter? The std.csv only has a csvReader. I want to dump database from sqlite to mysql. If I do it manually, I need handle double quote("), \n, ',' specifically Also, if tsv is acceptable, I tried

Re: use dmd for bare metal i386

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Friday, 13 October 2023 at 22:14:36 UTC, Dmitry Ponyatov wrote: Is dmd able to be forced not include some unneeded information into target object files to make bare metal 32-bit code? Need some samples and build scripts to do it. Or maybe move to ldc2 required You need ldc or gdc

Benchmarks

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
https://github.com/jinyus/related_post_gen

Re: Search for the dialog library

2023-10-14 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 14 October 2023 at 23:02:34 UTC, Alexander Zhirov wrote: Colleagues, tell me, please, is there any library on D for drawing [dialog](https://invisible-island.net/dialog/images/dialog.png) boxes using the dialog library, like in Python [pythondialog](https://pypi.org/project/python

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 14 October 2023 at 06:48:40 UTC, rempas wrote: On Friday, 13 October 2023 at 10:11:33 UTC, Nick Treleaven wrote: You can also do it using a string mixin: mixin(create_fn!(mixin("`", i, "`"))); I think that's equivalent to `i.stringof` anyway. Thank you for the info! You a

Re: Benchmarks

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 13 October 2023 at 22:45:19 UTC, Imperatorn wrote: https://github.com/jinyus/related_post_gen Sequential processing time, less is better |Language| Time (5k posts) | 20k posts | 60k posts | Total | |:--:|:---:|:--:|:-:|::

Re: Search for the dialog library

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 15 October 2023 at 23:01:05 UTC, Alexander Zhirov wrote: On Sunday, 15 October 2023 at 21:46:44 UTC, Dmitry Ponyatov wrote: Maybe it's time to port the old warm tubby Turbo Vision into the glorious D lang? https://github.com/magiblot/tvision Since there was a conversation about th

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm undefined reference to _My_struct__

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 20:06:02 UTC, ryuukk_ wrote: On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: [...] Show your code here on in Discord https://discord.gg/wKTvGNpc No, show your code here on the forum, don't nee

Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 06:46:31 UTC, Vitaliy Fadeev wrote: Hi all! I want readable mixin. I want pass variable to string. I want string with named args. Like this: ```D enum JMP_ADDR_R = "RAX"; mixin( format!"asm { jmp [JMP_ADDR_R]; }"( JMP_ADDR_R ));// IT NOT WOR

Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 07:53:28 UTC, Vitaliy Fadeev wrote: On Tuesday, 17 October 2023 at 07:22:41 UTC, Vitaliy Fadeev wrote: [...] `scriptlike` looks perfecto! ```D enum JMP_ADDR_R = ... ... import scriptlike; writeln( mixin(interp

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 13:31:39 UTC, Salih Dincer wrote: On Sunday, 15 October 2023 at 07:22:53 UTC, Imperatorn wrote: You already got a lot of good answers, I thought I'd just share this for anyone searching for nogc string formatting compatible with betterC: https://code.dlang.org

github copilot and dlang

2023-10-18 Thread Imperatorn via Digitalmars-d-learn
https://forum.dlang.org/post/lqwhddcncwrhcdlnw...@forum.dlang.org On Monday, 5 July 2021 at 15:56:38 UTC, Antonio wrote: Has someone tried github copilot (https://copilot.github.com/) with dlang? Access to the preview could be requested and, I think, main dlang team members could bypass the wai

Re: Can't get into debugger in vscode on macOS

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 19 October 2023 at 06:03:06 UTC, Daniel Zuncke wrote: Hello, I need some help getting into the debugger in vscode on macOS. It did work some months ago but that was finicky to set up. Maybe I am forgetting something now? [...] This can also happen if there's not a correct progra

Re: Installing DMD on Windows

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 12:19:32 UTC, Quirin Schroll wrote: I recently removed Visual Studio 2017 and upgraded to 2022. When I installed the latest DMD, it told me it couldn’t find a Visual Studio installation and offered me to download e.g. Visual Studio 2019 or just VS 2019 Build Tools,

Want to try out string interpolation in D?

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
Here's a script to get you started ```bash git clone https://github.com/adamdruppe/dmd.git cd dmd git checkout interp rdmd compiler/src/build.d ``` I don't want to copy files anywhere, so the user has to do that manually: Copy dmd from the generated executable to your D bin installation fold

Re: Want to try out string interpolation in D?

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started ```bash git clone https://github.com/adamdruppe/dmd.git cd dmd git checkout interp rdmd compiler/src/build.d ``` [...] We just need support for it in the tools, then D will be a Dream come true

Re: Want to try out string interpolation in D?

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started Same instructions for DIP1027: ``` git clone https://github.com/WalterBright/dmd.git cd dmd git checkout dip1027 rdmd compiler/src/build.d ``` Then same instructions as above but without the need

Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. After you have built your executable with symbols, open VS and choose "Continue without code". Then just choose open Project/Solution (Ctrl+Shift+O) and go to "

Re: Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. [...] On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: Just a clarification. "open

Re: Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 22 October 2023 at 13:16:11 UTC, Imperatorn wrote: On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. [...] On Sunday, 22 October 2023 at

Re: Want to try out string interpolation in D?

2023-10-23 Thread Imperatorn via Digitalmars-d-learn
On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote: On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started ... Now try string interpolation: ```d import std.stdio; void main() { string name = "Johan"; int age = 37; int iq

Re: DlangUI: how to change AppFrames?

2023-10-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 24 October 2023 at 04:38:58 UTC, Ki Rill wrote: I know how to change the current AppFrame: ```D window.mainWidget = myFrame; ``` But how do I exit this frame? I press the button, change to new frame, do the work, and now I want to return to the previous frame. How would I do this?

Re: Want to try out string interpolation in D?

2023-10-27 Thread Imperatorn via Digitalmars-d-learn
On Monday, 23 October 2023 at 11:43:33 UTC, Imperatorn wrote: On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote: On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: [...] First of all thanks for writing this. Well this seems pretty nice... What DIP number is this? - I'd li

Re: Unable to use template functions to define variables of a class

2023-10-28 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 28 October 2023 at 12:38:42 UTC, Subhaditya Nath wrote: This works fine – I think it's because you're using a class. Try for example: ```d import std.range; import std.stdio; import std.algorithm.iteration; void main() { auto cls = new Class; cls.range1.each!writeln; } c

Re: bigEndian in std.bitmanip

2023-10-31 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 31 October 2023 at 10:09:53 UTC, Salih Dincer wrote: Hello, Why isn't Endian.littleEndian the default setting for read() in std.bitmanip? Okay, we can easily change this if we want (I could use enum LE in the example) and I can also be reversed with data.retro.array(). ```d vo

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : import core.sys.windows.windows; import core.sys.windows.commdlg; import core.sys.windows.winuser; extern(Window

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:01:06 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: [...] Works for me. This is all you need ```d import core.sys.windows.commdlg; import core.sys.windows.winuser; void main() { wchar[256] fileName; O

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding this: ```d pragma(lib, "user32"); pragma(lib, "comdlg32"); ```

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding this

  1   2   3   4   5   >