Re: implicit cast and overload priority

2025-02-17 Thread ShadoLight via Digitalmars-d-learn
On Monday, 17 February 2025 at 09:33:32 UTC, mig09 wrote: On Monday, 17 February 2025 at 09:17:24 UTC, ShadoLight wrote: On Sunday, 16 February 2025 at 17:04:39 UTC, Jonathan M Davis wrote: [..] Ok, gotcha. I suspected that is what you meant and agree with that (in my example an implicit m

Re: implicit cast and overload priority

2025-02-17 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 16 February 2025 at 17:04:39 UTC, Jonathan M Davis wrote: [..] Ok, gotcha. I suspected that is what you meant and agree with that (in my example an implicit match would more sense on 'long', not 'bool'). Thanks for the detailed answer.

Re: implicit cast and overload priority

2025-02-16 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 16 February 2025 at 05:39:07 UTC, Jonathan M Davis wrote: _especially_ when VRP comes into play, because then you get nonsense like foo(1) calling the bool overload. I have often seen this mentioned, but I only see this happen if there *isn't* an integer overload i.e. this... ``

Re: DlangUI Layout Justification

2023-04-10 Thread ShadoLight via Digitalmars-d-learn
On Friday, 7 April 2023 at 17:13:58 UTC, Adam D Ruppe wrote: On Friday, 7 April 2023 at 15:52:02 UTC, Ali Çehreli wrote: I don't know how relevant it is but there is also Hipreme Engine that supports Android: [...] One library can help with both games and guis but it is unlikely to be a comp

Re: My vibe-d test app is crashing on Windows

2023-02-13 Thread ShadoLight via Digitalmars-d-learn
On Monday, 13 February 2023 at 13:12:23 UTC, Steve wrote: The app is just a test echo server. JSON sent in the body of a POST request is echoed back to the client. On Pop!_OS it works fine but on Windows it responds, there's a delay of about 10 seconds and then it crashes with the error: ```

Re: pointer escaping return scope bug?

2022-11-25 Thread ShadoLight via Digitalmars-d-learn
On Friday, 25 November 2022 at 14:07:28 UTC, ShadoLight wrote: On Saturday, 19 November 2022 at 14:07:59 UTC, Nick Treleaven ```d @safe: struct LockedFile { private int* fps; auto fp() return scope => fps; } void main() { int* p; { auto lf = LockedFile(new int);

Re: pointer escaping return scope bug?

2022-11-25 Thread ShadoLight via Digitalmars-d-learn
On Saturday, 19 November 2022 at 15:00:16 UTC, Paul Backus wrote: On Saturday, 19 November 2022 at 14:07:59 UTC, Nick Treleaven wrote: Hi, The following seems like a bug to me (reduced code, FILE* changed to int*): ```d @safe: struct LockedFile { private int* fps; auto fp() return sc

Re: How to link a msvcr120.dll in an inverse recursive way after a Windows .exe binary deployment

2022-09-05 Thread ShadoLight via Digitalmars-d-learn
On Tuesday, 6 September 2022 at 04:59:49 UTC, Mike Parker wrote: On Tuesday, 6 September 2022 at 04:36:55 UTC, ShadoLight wrote: True. In that case just distribute the DLL (taken from the DMD bin folder) alongside the HelloWorld EXE so that both reside in the same folder on the target comput

Re: How to link a msvcr120.dll in an inverse recursive way after a Windows .exe binary deployment

2022-09-05 Thread ShadoLight via Digitalmars-d-learn
On Monday, 5 September 2022 at 07:02:53 UTC, BoQsc wrote: The problem is, D Language Compiler is not included along the Windows Operating System. No compiler is included natively with the Windows OS. Not even Microsoft's. Neither msvcr120.dll is included along the Windows Operating System

Re: How to link a msvcr120.dll in an inverse recursive way after a Windows .exe binary deployment

2022-09-04 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 4 September 2022 at 15:16:47 UTC, BoQsc wrote: **Folder structure** .\msvcr120.dll .\folder1\HelloWorld.exe .\folder2\HelloWorld.exe You don't need to do this. msvcr120.dll is already shipped with the DMD compiler at [DMD-install-folder]\windows\bin64\msvcr120.dll. (It is also i

Re: What are virtual functions?

2021-04-18 Thread ShadoLight via Digitalmars-d-learn
On Wednesday, 14 April 2021 at 14:06:18 UTC, FeepingCreature wrote: On Wednesday, 14 April 2021 at 13:43:20 UTC, Berni44 wrote: [..] Covariance is related ... [..] The opposite (contravariance) happens ... [..] Nice answer but, just to be clear - D only supports covariance on return ty

Re: F*cked by memory corruption after assiging value to associative array

2021-01-29 Thread ShadoLight via Digitalmars-d-learn
On Monday, 25 January 2021 at 17:11:37 UTC, frame wrote: On Monday, 25 January 2021 at 16:54:42 UTC, vitamin wrote: On Monday, 25 January 2021 at 16:44:40 UTC, frame wrote: On Monday, 25 January 2021 at 16:14:05 UTC, vitamin wrote: Yes, I directly calling on every function that returns an

Re: Range of dub package versions

2020-12-29 Thread ShadoLight via Digitalmars-d-learn
On Monday, 28 December 2020 at 23:49:02 UTC, rikki cattermole wrote: $ dub upgrade [..] Unless you change the version invalidating it, it most likely won't upgrade by itself. Thanks Rikki - that explains it and, indeed, worked perfectly. Thanks!

Range of dub package versions

2020-12-28 Thread ShadoLight via Digitalmars-d-learn
I can build my app using dub, which has a dependency on the particular version of dlangui that was available when I originally created the project: "dependencies": { "dlangui": "~>0.9.182", ...etc.. }, I've recently noticed that the dlangui packa

Re: Why private methods cant be virtual?

2020-09-23 Thread ShadoLight via Digitalmars-d-learn
On Tuesday, 22 September 2020 at 11:39:31 UTC, Daniel Kozak wrote: On Tue, Sep 22, 2020 at 1:30 PM ShadoLight via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: This is not really "overriding", it is more akin to "overloading" No it is not o

Re: Why private methods cant be virtual?

2020-09-22 Thread ShadoLight via Digitalmars-d-learn
On Tuesday, 22 September 2020 at 10:23:08 UTC, Daniel Kozak wrote: On Tue, Sep 22, 2020 at 11:06 AM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: "Functions marked as final may not be overridden in a derived class, unless they are also private" So final priva

Re: Alternative to friend functions?

2020-02-20 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 20 February 2020 at 08:02:48 UTC, Bienlein wrote: On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote: What is the alternative to C++'s friend functions in D? module stable_matching; alias FemaleID = int; alias MaleID = int; class Person { string name; int id; } cl

Re: Template Usage with Eponymous Trick

2020-02-02 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 2 February 2020 at 23:48:45 UTC, Paul Backus wrote: On Sunday, 2 February 2020 at 23:39:10 UTC, ShadoLight wrote: But, my question was if this was avoidable if braces were not optional. Paul's answer was that non-optional braces will not make... alias a = S!(int); ... non-ambigu

Re: Template Usage with Eponymous Trick

2020-02-02 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 2 February 2020 at 18:30:17 UTC, Steven Schveighoffer wrote: Thanks for taking the time to explain. However, when I tested my results does not seem to match your explanation. First, note that: struct S(T) {} is *exactly* equivalent to (in fact, you can write it this way, and i

Re: Template Usage with Eponymous Trick

2020-02-02 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 2 February 2020 at 16:23:42 UTC, Paul Backus wrote: [..] No, it would still be ambiguous: struct S(T) {} alias a = S!(int); // Should this assertion pass or fail? static assert(is(a)); Sorry, I don't get it. AFAICS 'is(a)' should return true (since a is an alias for a full type

Re: Template Usage with Eponymous Trick

2020-02-02 Thread ShadoLight via Digitalmars-d-learn
On Friday, 31 January 2020 at 15:37:06 UTC, Steven Schveighoffer wrote: On 1/30/20 9:10 AM, ShadoLight wrote: but to give you some historical perspective... [..] It was actually much more restrictive before -- e.g. in order to do an eponymous template, you could have no other members i

Re: Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 30 January 2020 at 20:42:02 UTC, Paul Backus wrote: On Thursday, 30 January 2020 at 15:14:43 UTC, ShadoLight wrote: [..] would make the language grammatically ambiguous... OK, understood. Thank you.

Re: Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 30 January 2020 at 20:00:05 UTC, MoonlightSentinel wrote: On Thursday, 30 January 2020 at 17:00:08 UTC, ShadoLight wrote: [..] ...your proposed change it would be ambigous ... Ok, that makes sense - I did not consider the impact of the optional empty braces. Thank you.

Re: Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 30 January 2020 at 16:16:48 UTC, MoonlightSentinel wrote: On Thursday, 30 January 2020 at 15:14:43 UTC, ShadoLight wrote: [...] From my POV is void foo(T)() { ... } just a shorthand notation for... Agreed. My question though is should the 'shorthand' notation _replace_ the

Re: Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 30 January 2020 at 14:22:11 UTC, Paul Backus wrote: On Thursday, 30 January 2020 at 14:10:38 UTC, ShadoLight wrote: ...but in the 'classical' default template style, so I would have thought the template_name!(compile_time_args).function_name(run_time_args) style would still work,

Re: Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 30 January 2020 at 14:10:38 UTC, ShadoLight wrote: Taking this example from documentation page on 'Template Sequence Parameters' [1]: [...] Tested on https://run.dlang.io

Template Usage with Eponymous Trick

2020-01-30 Thread ShadoLight via Digitalmars-d-learn
Taking this example from documentation page on 'Template Sequence Parameters' [1]: import std.stdio; template print(args...) { void print() { writeln("args are ", args); // args is a ValueSeq } } template write(Args...) { void write(Args args) // Args is a TypeSeq

Re: How load icon from resource using LoadImage?

2020-01-06 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 5 January 2020 at 13:52:27 UTC, JN wrote: On Sunday, 5 January 2020 at 13:33:35 UTC, Marcone wrote: [snip] By the way, have you managed to add the res file into the binary? My understanding is that the res file should be added into the exe file by the rc command before it can be

Re: How to use ResizerWidget in Dlangui app..?

2020-01-03 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 2 January 2020 at 05:24:33 UTC, Rémy Mouëza wrote: On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: Hi, I suspect I'm missing something obvious, but ResizerWidget is not working for me on Windows - it shows the 'dragging'-cursor when hovering the mouse on the Resize

Re: How to use ResizerWidget in Dlangui app..?

2020-01-01 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 2 January 2020 at 05:24:33 UTC, Rémy Mouëza wrote: On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: Hi, I suspect I'm missing something obvious, but ResizerWidget is not working for me on Windows - it shows the 'dragging'-cursor when hovering the mouse on the Resize

Re: How to use ResizerWidget in Dlangui app..?

2020-01-01 Thread ShadoLight via Digitalmars-d-learn
On Wednesday, 1 January 2020 at 10:52:02 UTC, Ron Tarrant wrote: On Monday, 30 December 2019 at 23:32:37 UTC, ShadoLight wrote: dragging with the left mouse button does nothing. Window window = Platform.instance.createWindow("DlangUI example", null); I'm not familiar with this toolkit,

How to use ResizerWidget in Dlangui app..?

2019-12-30 Thread ShadoLight via Digitalmars-d-learn
Hi, I suspect I'm missing something obvious, but ResizerWidget is not working for me on Windows - it shows the 'dragging'-cursor when hovering the mouse on the ResizerWidget, but dragging with the left mouse button does nothing. Reduced very simple example: ///app.d import dlangui; import g

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-10 Thread ShadoLight via Digitalmars-d-learn
On Tuesday, 10 December 2019 at 14:33:41 UTC, Marcone wrote: On Tuesday, 10 December 2019 at 09:48:11 UTC, ShadoLight wrote: On Tuesday, 10 December 2019 at 07:23:00 UTC, rumbu wrote: [...] To add to Rumbo's comment: to compile a *.rc to *.res file you will need a resource compiler. [...]

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-10 Thread ShadoLight via Digitalmars-d-learn
On Tuesday, 10 December 2019 at 07:23:00 UTC, rumbu wrote: On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote: I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the ex

Re: How polymorphism work in D?

2019-11-06 Thread ShadoLight via Digitalmars-d-learn
On Wednesday, 6 November 2019 at 06:27:32 UTC, OiseuKodeur wrote: On Wednesday, 6 November 2019 at 06:05:25 UTC, rikki cattermole wrote: On 06/11/2019 6:43 PM, OiseuKodeur wrote: I have this [snip] Rikki's answer is the direct answer to your question since you already had the if(..) stateme

Re: Is this a bug? +goto

2018-11-09 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 8 November 2018 at 09:34:34 UTC, Michelle Long wrote: What I am talking about is about an obvious error... OK, so here are your code slightly modified: void main(){ int i; W: if(i==0) goto Q; int x; Q: i++; if(i==1) goto W; writeln("a"); }

Re: Data structures and algorithms in D?

2018-10-08 Thread ShadoLight via Digitalmars-d-learn
On Sunday, 7 October 2018 at 20:27:47 UTC, eastanon wrote: Are there reading resources on Data structures and Algorithms in D? There are several such books in the C/C++ and Java world and many senior/experienced D users might have come across them in C. But for people who join D after reading A

Link to https://run.dlang.io/ ??

2018-02-20 Thread ShadoLight via Digitalmars-d-learn
It would be nice if there was a link to https://run.dlang.io/ on the dlang website - preferably under Resources drop-down menu or similar. Or is there somewhere and I am just missing it? I have bookmarked it for myself, but it would be better for newbies if it was also easily accessible from

Re: Error in template instantiation from D-Cookbook example

2018-02-09 Thread ShadoLight via Digitalmars-d-learn
On Friday, 9 February 2018 at 21:39:22 UTC, Adam D. Ruppe wrote: On Friday, 9 February 2018 at 21:31:29 UTC, ShadoLight wrote: [1] https://run.dlang.io/is/dyElXg There's missing quotes in there: Line 14: code ~= "push(call!"~piece~"(pop(), pop()));\n"; Should be: code ~= "push(call!\""~piec

Error in template instantiation from D-Cookbook example

2018-02-09 Thread ShadoLight via Digitalmars-d-learn
Hi, Trying to improve my CT-fu, I looked at a DSL example (chapter 9) in Adam's D-Cookbook. Although I am sure Adam's original examples would have worked, there were some errors in the example code in the book. The example also contains some code to allow you to test the functions at RT, wh