Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-05-01 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 1 May 2022 at 12:39:08 UTC, Elfstone wrote: Great, I'm using the constraint, until it's fixed. Will it be fixed though? The DIP that Tejas linked is from 2020!!! The DIP was postponed. I can contact the author to see if he intends to pick it up again. If not, anyone interested

Re: How do I get the screen resolution?

2022-04-28 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:35:46 UTC, Mike Parker wrote: go through the same system APIs. For example, on Windows you can use two calls to `GetSystemMetrics` (one for the width, one for the height). (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics)

Re: How do I get the screen resolution?

2022-04-28 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov wrote: Are there any methods to get the screen resolution? On C/C++ from under X11, it is not possible to do this on the command line via SSH, since the display is not defined. And is it possible to do this somehow by means of D,

Re: std.typecons Typedef initializers?

2022-04-25 Thread Mike Parker via Digitalmars-d-learn
On Monday, 25 April 2022 at 08:54:52 UTC, Chris Katko wrote: D struct pair { float x,y; } alias sPair = Typedef!pair; // pair of xy in screen space coordinates alias vPair = Typedef!pair; // pair of xy in viewport space coordinates //etc How do you initialize a typedef'd struct? ``d

Re: Variables & kind of memory

2022-04-23 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 23 April 2022 at 05:01:51 UTC, Alain De Vos wrote: On Saturday, 23 April 2022 at 04:52:39 UTC, Alain De Vos wrote: On Saturday, 23 April 2022 at 03:41:17 UTC, Alain De Vos wrote: I wrote a simple test program: ``` import std.stdio:writefln; [...] BBB: is probably the

Re: Variables & kind of memory

2022-04-23 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 23 April 2022 at 03:41:17 UTC, Alain De Vos wrote: int [] GLV=[1,2]; int [2] GLF=[1,2]; static int [] GSLV=[1,2]; static int [2] GSLF=[1,2]; FYI, `static` has no effect at module scope.

Re: DUB issues

2022-04-19 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 April 2022 at 08:58:02 UTC, bauss wrote: On Monday, 18 April 2022 at 13:41:04 UTC, Mike Parker wrote: On Monday, 18 April 2022 at 05:27:32 UTC, Danny Arends wrote: Any ideas how to get into contact/fix this issue ? I've emailed Sönke and pointed him to this thread. Wouldn't

Re: DUB issues

2022-04-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 April 2022 at 05:27:32 UTC, Danny Arends wrote: Any ideas how to get into contact/fix this issue ? I've emailed Sönke and pointed him to this thread.

Re: Nested function requires forward declaration?

2022-04-14 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 14 April 2022 at 08:55:25 UTC, Chris Katko wrote: I imagine this is a really odd edge case but it's piqued my interest. Consider this: ```d void main() { void foo() { initRuntimeState(i); } foo(); if(!modifyRutimeState()) return; int i = getRandomValue(); i =

Re: Conversion from ANSI 1252 to unicode

2022-04-07 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 7 April 2022 at 07:24:03 UTC, Johann wrote: Hi all, anybody knows if there are functions (preferably) in Phobos, that translate from unicode to other encodings and vice versa? Johann https://dlang.org/phobos/std_encoding.html

Re: How to use an existing D package in Visual D?

2022-04-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 April 2022 at 09:26:54 UTC, realhet wrote: Hello, I have all my D packages in the c:\D\libs\ directory. I added this path to the PropertyPages/Compiler/Additional Import Paths field. In the project source file I imported a module from my package using "import het.utils;" Also

Re: I like dlang but i don't like dub

2022-03-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 March 2022 at 14:44:59 UTC, Marcone wrote: Why is dmd unable to import modules installed by dub using the import command like it does with the Phobos library? He can't send these modules to Linker? Needing to be passed to dmd via command line. I think it could be all automatic.

Re: static init c struct with array filed

2022-03-16 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 16 March 2022 at 07:27:06 UTC, test wrote: ```c struct Test { int32_t a; } struct Test2 { int32_t a; Test arr[]; } ``` I need static const init Test2, then pass it to c library late(third library, can not change the type def). Any time you see a '[]' in C, the

Re: How do I create a package?

2022-03-02 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 2 March 2022 at 16:38:58 UTC, M wrote: There doesn't seem to be any docs on how to actually create packages. Is there a description anywhere? In case you're talking about a language-level package and not a dub package, just create a directory in your source tree with the name

Re: Colors in Raylib

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 13:15:09 UTC, meta wrote: enum Color { GRAY } void setColor(Color color); setColor(GRAY); Then that defeats the purpose of having named enums.

Re: Cannot Call Super-Class Overloaded Function If Class has Function Override?

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 09:10:46 UTC, Vijay Nayar wrote: I'm a bit surprised at this behavior though. Do you happen to know why it is considered bad to take into account the overloads of a super-class when resolving a call in a derived-class? https://dlang.org/articles/hijack.html

Re: opCast in class prevents destroy

2022-03-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 07:16:11 UTC, bauss wrote: Right now if you want to add an additional cast then you have to implement ALL the default behaviors and then add your custom cast. It's two template functions like the OP used: one for T to catch everything, and one specialization.

Re: opCast in class prevents destroy

2022-02-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 04:59:49 UTC, Mike Parker wrote: You could also specialize on `void*`, as that's the type that was failing to compile I meant "instead", not also.

Re: opCast in class prevents destroy

2022-02-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 04:29:56 UTC, cc wrote: ```d struct A {} class B { A opCast(T : A)() { return A(); } } void main() { auto b = new B(); destroy(b); } ``` fails with ``` dmd2\windows\bin\..\..\src\druntime\import\object.d(4209): Error:

Re: Colors in Raylib

2022-02-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 March 2022 at 02:42:52 UTC, Steven Schveighoffer wrote: On 2/28/22 6:48 AM, Salih Dincer wrote: In general, the raylib enumerations are overly verbose for D, e.g. `KeyboardKey.KEY_X`, instead of just `KeyboardKey.X`. I'd love to provide "better enums". In Derelict, I

Re: https://run.dlang.io/ vs All dmd compilers (2.060 - latest)

2022-02-28 Thread Mike Parker via Digitalmars-d-learn
On Monday, 28 February 2022 at 17:44:57 UTC, Matheus wrote: On Monday, 28 February 2022 at 02:31:57 UTC, Mike Parker wrote: ... Hey Parker, I think my IP still under surveillance, everytime I post I get: "Your message has been saved, and will be posted after being approved by a

Re: Colors in Raylib

2022-02-28 Thread Mike Parker via Digitalmars-d-learn
On Monday, 28 February 2022 at 11:48:59 UTC, Salih Dincer wrote: Hi All, Is there a namespace I should implement in Raylib? For example, I cannot compile without writing Colors at the beginning of the colors: ```Colors.GRAY``` SDB@79 Assuming you mean the raylib-d binding, it implements

Re: https://run.dlang.io/ vs All dmd compilers (2.060 - latest)

2022-02-27 Thread Mike Parker via Digitalmars-d-learn
On Monday, 28 February 2022 at 01:51:52 UTC, meta wrote: Is the source of 'run.dlang.io' available somewhere? The link to the github repository is at the top of the run.dlang.io page: https://github.com/dlang-tour/core Issues should be reported there.

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote: Yeah there must be another one then. Something actionnable is the documentation. This has nothing to do with which exceptions types a function throws. The compiler doesn't dig into that. You have to catch `Exception`. ```D

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:11:28 UTC, partypooper wrote: So with such behavior there is no reason at all to make make function nothrow, if it uses throw functions in its body? I'm not sure what you mean. If a function throws an exception, it can't be nothrow. And as much as I

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? D does not have checked exceptions like Java, so the compiler doesn't have anyway to verify that any

Re: Offline D documentation/tutorial

2022-02-12 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 February 2022 at 00:16:02 UTC, LorenDB wrote: Is there a way to download tour.dlang.org, the D spec, and/or the Phobos spec as an offline HTML site? I like the ability of cppreference.com to be saved as an offline HTML archive and I'd like to have that for D as well. If you’ve

Re: ImportC: Should this compile?

2021-12-18 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 December 2021 at 03:27:50 UTC, Tejas wrote: Oh wow, the executable gets named `stuff` if that's the first file passed... always thought it would name it the same name as that file which contained `main` If the name of the file with `main` were used, you'd have to have a

Re: ImportC: Should this compile?

2021-12-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 December 2021 at 22:31:38 UTC, bachmeier wrote: I've been trying to get the stb header library to compile. There's a single remaining failure: ``` typedef struct { unsigned char c[4]; } stb_easy_font_color; stb_easy_font_color c = { 255,255,255,255 }; // use structure

Re: Passing a derived class where base class is defined as ref parameter

2021-12-13 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 December 2021 at 22:06:45 UTC, chopchop wrote: If I remove the ref, it works as expected, that is to say I can give a derived class as parameter. I have an idea why it does not work, but I think a c++ reference would work, ie incr(A& console) would accept a B as parameter. What

Re: A pass() identity range?

2021-12-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 2 December 2021 at 15:03:47 UTC, D Lark wrote: Because it does not seem like that from the tone of responses I have gotten: I did my due diligence, I believe, before posting my original reply to the old question. I had looked at the docs and also searched the forum. There is no

Re: How to deploy single exe application (?)

2021-11-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 28 November 2021 at 22:45:29 UTC, Willem wrote: // load sdl string uuid = randomUUID().toString(); string filename = format("SDL2-%s.dll", uuid); string depacked = buildPath(tempDir(), filename); std.file.write(depacked, sdlBytes); DerelictSDL2.load(depacked);

Re: Are templated functions always re-constructed?

2021-11-16 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 21:14:50 UTC, rempas wrote: Let's say that I have the following function: ``` void add(T)(T val, T val2) { return val + val2; } // Classic example, lol ``` Now let's say that I call the function passing an `int` parameter. The function will get built with an

Re: D modules

2021-11-13 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 13 November 2021 at 22:52:55 UTC, pascal111 wrote: When I'm searching for "toUpper" and "toLower" functions that string type uses, I confused when I reached the module "std.string". In the first section of its page "https://dlang.org/phobos/std_string.html; I didn't found

Re: Average function using Variadic Functions method

2021-11-02 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 2 November 2021 at 16:35:40 UTC, pascal111 wrote: "input..." seems nice, where can I get more information about it? "Typesafe variadic functions" https://dlang.org/spec/function.html#typesafe_variadic_functions

Re: Why do we have Dmain?

2021-10-22 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote: I am not a compiler expert, but I genuinely would like to know why we have Dmain. I've been looking at the generated assembly code recently and noticed the _Dmain function. I didn't notice it before. Then there is main, where Dmain is

Re: problem with alias this and Tuple

2021-10-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 October 2021 at 15:55:40 UTC, Johann Lermer wrote: Thanks, understood. But isn't this a deficiency in the library that should be fixed? The problem extends to more than just `toHash`. Take a look at this DConf 2019 presentation by Eduard Staniloiu on ProtoObject (as proposed

Re: Managing malloced memory

2021-10-11 Thread Mike Parker via Digitalmars-d-learn
On Monday, 11 October 2021 at 10:53:15 UTC, anon wrote: S makeS(int x) { return S(x); // no destructor called here. } void main() { foo(S(1)); // no destructor called for this rvalue auto s = makeS(1); // destructor for s called here. foo(makeS(1)); // only one destructor called

Re: Traits in a template enum

2021-10-10 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 10 October 2021 at 12:56:30 UTC, Some Guy wrote: But I did not understand what you meant by "enums hold values, not types". Aren't types values at compile time? Types can be template arguments, if that's what you mean, but they aren't values.

Re: Dynamically binding to D code using extern(D)

2021-09-30 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 30 September 2021 at 22:30:30 UTC, jfondren wrote: 3. dynamic linking (option 2), performed arbitrarily at runtime, by your program. If linking fails, you can do whatever you want about that. That's actually "dynamic loading". https://en.wikipedia.org/wiki/Dynamic_loading

Re: Using D "rocket" logo in outside presentation

2021-09-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 September 2021 at 04:24:13 UTC, Chris Piker wrote: Hi D I'm to give a presentation to a combined NASA/ESA group in a few hours and would like to include a copy of the D "rocket" logo when mentioning new server side tools that I've written in D. Is such use of this

Re: Loading assimp

2021-09-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one

Re: Modules ... "import" vs. "compilation" ... what is the real process here?

2021-09-27 Thread Mike Parker via Digitalmars-d-learn
On Monday, 27 September 2021 at 17:38:29 UTC, james.p.leblanc wrote: Dear D-ers, I have trouble understanding "module imports" vs. "module compilations". A module is implemented in a source file. Though we often use the term "module" to refer to both, it may help to think in terms of

Re: MobI? Really?

2021-09-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 16:14:52 UTC, Chris_D wrote: Thanks for the replies. jfondren: Sorry, but I am talking about documentation. For me, online web pages don't qualify; they are in the cloud, unreal, with no substance. Does anyone really read 300 pages online, in a web browser?

Re: How to simply parse and print the XML with dxml?

2021-09-10 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 September 2021 at 07:50:29 UTC, tastyminerals wrote: As for the dxml, I believe adding a small quick start example would be very beneficial for the newcomers. Especially, ppl like me who are not aware of the XML parser types and just need to extract text from an XML file.

Re: GDC - program runs in one thread, DMD - in 4 threads, why?

2021-09-10 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 September 2021 at 11:20:10 UTC, eugene wrote: same picture with gdc 8.4.0 - one thread, no pthread_create() behind the scenes. GDC is stuck on a much older version of D. Iain has backported some bugfixes and optimizations, but featurewise it's mostly D 2.076. This is because

Re: Forum posting question ... how post a thread question with color syntax highlighting ??

2021-09-06 Thread Mike Parker via Digitalmars-d-learn
On Monday, 6 September 2021 at 13:23:21 UTC, Steven Schveighoffer wrote: I will note though, that some people use the mechanism for links that puts the link at the bottom of the post, and this can be annoying when you reply, if you don't include the link definition, it doesn't render

Re: Forum posting question ... how post a thread question with color syntax highlighting ??

2021-09-05 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 5 September 2021 at 23:24:16 UTC, someone wrote: Slightly off-topic but ... while-we-are-the-subject: I usually post with markdown enabled and enclose code within ```d Sometimes, I notice that replies to my posts came without markdown, and until now, I assumed not everyone likes

Re: Dustmite and linking error

2021-09-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 September 2021 at 08:19:53 UTC, JG wrote: As a small comment regarding dub. I can't help wondering if it really the best idea for each configuration to include everything by default and then have to exclude things? This means that when you add another configuration and source

Re: Question on Immutability

2021-08-31 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 31 August 2021 at 06:15:07 UTC, jfondren wrote: On Tuesday, 31 August 2021 at 05:42:22 UTC, ag0aep6g wrote: On 31.08.21 02:50, Mike Parker wrote: Member functions marked as immutable can be called on both mutable and immutable instances. That's not true. Demonstrated: Well

Re: Question on Immutability

2021-08-30 Thread Mike Parker via Digitalmars-d-learn
On Monday, 30 August 2021 at 23:27:07 UTC, Merlin Diavova wrote: ``` After playing around the above works, Great! However I have some questions First, why do the interfaces have to be defined as `immutable interface`? The interfaces cannot be changed at runtime or instantiated. It isn't

Re: Labelled @nogc Working With Inner Scopes

2021-08-30 Thread Mike Parker via Digitalmars-d-learn
On Monday, 30 August 2021 at 20:26:46 UTC, Benoît Dubreuil wrote: My question is: In the source file `dummy.dummy.d`, why the first labelled attributes `@safe` and `@nogc` have no effect inside the struct's scope? In other words, why do I need to repeat labelled attributes statements in

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 August 2021 at 11:09:28 UTC, Steven Schveighoffer wrote: This is exactly the opposite! Sorry about that. I can't believe I mixed those up.

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 August 2021 at 08:55:44 UTC, realhet wrote: Is it safe, or do I have to take a snapsot of the keys range like this? -> You shouldn't remove anything when iterating over `.keys` or `.values`. Use `.byKey` and `.byValue` instead to get ranges that are independent of the aa.

Re: DUB: How to link an external library on Windows 10?

2021-08-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 August 2021 at 14:46:56 UTC, Ki Rill wrote: On Friday, 27 August 2021 at 13:54:18 UTC, Steven Schveighoffer wrote: [...] How do I tell DUB where to look for `raylibdll.lib` and `raylib.dll`? Via `lflags` section? What if I put them in a different folder instead of the

Re: DUB: How to link an external library on Windows 10?

2021-08-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 August 2021 at 13:41:56 UTC, Ki Rill wrote: I have downloaded the pre-compiled binaries from the official [Raylib ](https://github.com/raysan5/raylib/releases/tag/3.7.0) repo. I'm not using Visual Studio. Only dub and a text editor. But assuming you are on a 64-bit system,

Re: DUB: How to link an external library on Windows 10?

2021-08-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 August 2021 at 13:21:04 UTC, Ki Rill wrote: I have a Raylib project on Windows using DUB. I've added raylib-d via `dub add`. But what I can't figure out is how to tell DUB to link against raylib library. I have the following project structure: ``` -> source ---> app.d ->

Re: dlang opengl / gl / glu /glut library.

2021-08-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 August 2021 at 12:22:41 UTC, Виталий Фадеев wrote: https://forum.dlang.org/post/s5pvtq$2q83$1...@digitalmars.com On Wednesday, 21 April 2021 at 19:54:35 UTC, rikki cattermole wrote: On 22/04/2021 7:51 AM, Alain De Vos wrote: import bindc.opengl; bindbc bindbc-opengl

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 09:59:53 UTC, Rekel wrote: time in the future. Even bugs don't seem to get fixed in any timely manner (Not meant as an insult, just being realistic :/). We do have a paid Issue/Pull-Request manager now (Razvan Nitu), and he's prioritizing issues for strike teams

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 09:59:53 UTC, Rekel wrote: When using implicit function templates, identical specialization yield different results. Example: ```d template TFoo(T){ void foo(){writeln("1");} } // #1 template TFoo(T : T[]) { void foo(){writeln("2");} } // #2 void

Re: how to import .lib library

2021-08-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 August 2021 at 10:40:36 UTC, jfondren wrote: Yeah, that's not possible. You either need the source or a set of D interface files that declares all the symbols you need. Meaning, it is possible. On Windows where I assume these .lib files are: I mentioned C libraries in an

Re: how to import .lib library

2021-08-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 August 2021 at 10:12:17 UTC, Timofeyka wrote: Thank you for your reply! I wanted to link to my project another project without source code. Yeah, that's not possible. You either need the source or a set of D interface files that declares all the symbols you need. The compiler

Re: how to import .lib library

2021-08-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 August 2021 at 09:49:39 UTC, Timofeyka wrote: Hello! I may have a very stupid question, but still. How do I include a .lib library? How to use it in your code? You don't import a .lib file. They are for the linker, not the compiler. How you make use of it depends on what sort of

Re: What exactly are the String literrals in D and how they work?

2021-08-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 August 2021 at 08:11:39 UTC, rempas wrote: I mean that in C, we can assign a string literal into a `char*` and also a `const char*` type without getting a compilation error while in D, we can only assign it to a `const char*` type. I suppose that's because of C doing explicit

Re: Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote: ```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main() { writeln(macro_1(15, 20)); alias macro_1 = def;// is

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 August 2021 at 21:36:35 UTC, Ruby The Roobster wrote: Thank you very much. The program runs successfully now. You've got another potential issue you should be aware of. You've name a member of your `Skeleton` as `init`. This may cause issues at some point, as every type in

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 August 2021 at 21:10:38 UTC, Steven Schveighoffer wrote: Well, subtracting the length doesn't do much, you aren't actually accessing the array block, you are just changing the reference (which lives in thread-local storage). I kind of feel like the whole entity table thing is

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster wrote: Context for this: I am creating a module of my own, and this is a class contained in the module. You will notice that after calling this class' constructor anywhere in a Win32 API program, that the program doesn't close

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-12 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster wrote: When I run the program and close the window, the program still runs in background mode. I don't know why this happens nor how to fix it. Does anybody know what's going on? frame beat me to it, but it may well be that

Re: DUB "Error: only one `main` allowed."

2021-08-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 09:38:13 UTC, tastyminerals wrote: Hahaha, I fixed it by renaming the `my_script.d` to `app.d`. Oh boy. What you want is the `mainSourceFile` entry. From the dub documentation, [under "Build Settings"][1]: Determines the file that contains the main()

Re: -L/SUBSYSTEM:windows Error when using -m64

2021-08-10 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 19:03:06 UTC, Marcone wrote: On Tuesday, 10 August 2021 at 19:01:42 UTC, Adam D Ruppe wrote: On Tuesday, 10 August 2021 at 18:59:33 UTC, Marcone wrote: Using -Lgdi32.lib -Luser32.lib? Same error. The part after that: If you want the Windows subsystem too, use

Re: Conditional compilation: Which version identifier for release code ? version(assert) ?

2021-08-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 August 2021 at 10:43:01 UTC, wjoe wrote: Could you elaborate on ```version(assert)``` a bit more, please ? Like I compiled with ```-release, -g``` and without the 2 options but the ```assert``` branch was always taken. Could it be that ```-unittest``` has something to do

Re: Conditional compilation: Which version identifier for release code ? version(assert) ?

2021-08-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 August 2021 at 09:18:08 UTC, wjoe wrote: If it's to be determined whether or not the code is being compiled in debug or release mode, i.e. e.g. the dmd ```-release``` or ```-g``` options, which version identifier is supposed to be used ? There's no ```release``` identifier and

Re: alias using Complex!Double in module ... linker error??

2021-08-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 21:40:09 UTC, james.p.leblanc wrote: I am getting linker errors with this stripped-down example: --- **my_main.d:** import std.stdio; import std.complex; import my_module; void main(){ my_TYPE xxx;

Re: Name Mangling & its representation of D types

2021-08-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote: how does it work for recursive types like a struct containing a pointer to a struct of the same type A struct `S` with a member of type `S*` is still just a struct `S`. The pointer doesn't change anything about the type.

Re: Name Mangling & its representation of D types

2021-08-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote: I'd like to understand how any D type is represented as a string by the name mangling done by the compilers. Does this always have the desirable property that different types have different mangled names, so that a type is faithfully

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread Mike Parker via Digitalmars-d-learn
On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote: but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html That's what he meant by "hidden" switch. I don't know why it isn't documented,

Re: Raylib linking error

2021-07-29 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 29 July 2021 at 10:07:15 UTC, Ki wrote: On Thursday, 29 July 2021 at 07:59:38 UTC, Ki wrote: I tried to compile a new project with Raylib yesterday: dub init => ... => dub add raylib-d. My dub.json file does contain the "libs": ["raylib"] section, so the compiler links against

Re: byKeyValue is not available at compilation-time right ?

2021-07-26 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 July 2021 at 17:38:23 UTC, someone wrote: i.e. your AA initialization is copy-pasted into each use of it, which means your program is rebuilding this AA at runtime every time it comes up. You probably got to this point as a bare `immutable structureLocations` errored out to the

Re: Destructors can't be @nogc?

2021-07-24 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 July 2021 at 00:15:30 UTC, Jim wrote: But I think `destroy()` not being @nogc even though the destructor is tagged @nogc is a bug, and it should be fixed. Because it is problematic behaviour even if we limit the usage of @nogc. It's not a bug. The destructor being tagged has

Re: Destructors can't be @nogc?

2021-07-24 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 24 July 2021 at 09:45:01 UTC, Jim wrote: In that case, what should we use to check functions called from `main` are not using the garbage collector? When compiling, you can pass -vgc to dmd and it will tell you where GC allocations are possible. Because it seems like we

Re: Destructors can't be @nogc?

2021-07-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 23 July 2021 at 20:24:02 UTC, Jim wrote: What is the problem here? Should I not call `destroy`? If so, what should I call instead? The problem is that you've marked main as `@nogc`, and `destroy` is not `@nogc`. Remove the annotation from main and it will compile.

Re: betterC shared static ctor

2021-07-21 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 08:11:06 UTC, vit wrote: Is it possible to call all shared static ctors in betterC? ```d //-betterC static immutable int i; shared static this(){ i = 42; } extern(C) void main(){ assert(i != 42); } ``` These rely on DRuntime, which is not linked in

Re: Not allowed to globally overload operators?

2021-07-20 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 20 July 2021 at 06:20:34 UTC, Tejas wrote: Why isn't it working by default? Initially, I was trying to create the spaceship operator of C++, but we aren't allowed to create new operators, it seems. Then I just wanted to verify whether we can even overload an operator globally,

Re: Module import failing after $ dub add mypackage

2021-07-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 July 2021 at 17:14:12 UTC, Mike Parker wrote: I haven't had occasion to make use of any serialization libraries myself, but you can start here: https://wiki.dlang.org/Serialization_Libraries Also: https://code.dlang.org/search?q=serialization

Re: Module import failing after $ dub add mypackage

2021-07-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 July 2021 at 16:54:18 UTC, Scotpip wrote: Yup - I have it running now but the code does seem to be a bit neglected and I'm seeing a depreciation warning too. I chose it because it's much the most downloaded serialisation package and is used in a couple of other popular packages.

Re: Module import failing after $ dub add mypackage

2021-07-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 July 2021 at 16:44:31 UTC, Scotpip wrote: Again, if this helps anyone my current setup is to have a single main() in app.d. I changed the main() in my sandboxes to runSandbox(), and I import and run from app.d rather than directly. Or with a couple of keystrokes I can switch to

Re: Module import failing after $ dub add mypackage

2021-07-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 July 2021 at 15:31:49 UTC, Scotpip wrote: I'm completely stuck till I can get this fixed, so any help would be very much appreciated! I used the example from the readme at: https://code.dlang.org/packages/msgpack-d which I pasted into the generated `app.d`. And all the

Re: opIndexUnary post in-/decrement how to ?

2021-07-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 14 July 2021 at 12:35:07 UTC, wjoe wrote: On Wednesday, 14 July 2021 at 11:31:36 UTC, Tejas wrote: ``` {auto a = i[1] , ++i[1] , a} //note the , not the ;``` Sorry I can't provide something even more concrete. Yes I saw that, and I suppose it would work just fine if it were

Re: No rdmd.exe in /bin64 on Windows - is this an issue?

2021-07-13 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 11:23:38 UTC, Scotpip wrote: Mike - thanks for responding! You say that there wasn't a Windows 64 bit release "for good reason". That sounds a bit ominous - I'd appreciate your insights into what was behind this. Nothing ominous. It was just because of the

Re: mixin template's alias parameter ... ignored ?

2021-07-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 02:22:46 UTC, Mike Parker wrote: On Tuesday, 13 July 2021 at 01:03:11 UTC, someone wrote: Being *local* to ... ain't imply visibility too regardless scope not being a visibility attribute ? I mean, scope is restricting the variable to be leaked outside the

Re: mixin template's alias parameter ... ignored ?

2021-07-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 July 2021 at 01:03:11 UTC, someone wrote: Being *local* to ... ain't imply visibility too regardless scope not being a visibility attribute ? I mean, scope is restricting the variable to be leaked outside the function/whatever and to me it seems like restricted to be seen

Re: mixin template's alias parameter ... ignored ?

2021-07-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 July 2021 at 23:45:57 UTC, someone wrote: Regarding -preview=dip1000 (and the explicit error description that could have helped me a lot back then) : DMD man page says the preview switch lists upcoming language features, so DIP1000 is something like a D proposal as I glanced

Re: No rdmd.exe in /bin64 on Windows - is this an issue?

2021-07-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 July 2021 at 23:57:37 UTC, Scotpip wrote: Given that this will be the first encounter with the language for many users, you might want to consider addressing this to create a good first impression? For a long time, the installer did not include 64-bit binaries on Windows for

Re: Why I'm getting this "Range Violation" error?

2021-07-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 July 2021 at 07:21:06 UTC, rempas wrote: When I execute it, I'm getting a range violation error. If I try to set "len" to be the length of the "prompt" minus 1, then it will work and it will print the "prompt" until the questionmark. So I cannot find where the error is...

Re: How to disable assigning a value to a property?

2021-07-06 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 13:27:43 UTC, Jack Applegame wrote: And that's sad. It should happen for properties only. Totally disagree. This is one of my favorite D features.

Re: Find a char among string (string.findAmong.char)

2021-07-06 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 11:35:14 UTC, BoQsc wrote: I tried out .canFind method, and to test it I removed the letter 'o' from the Alphabet. Weirdly enough .canFind method still found 'o' letter among the Alphabet. https://run.dlang.io/is/2Fvenf Looks like it has something to do with the

Re: Remove array element within function

2021-07-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 July 2021 at 14:30:11 UTC, Mike Parker wrote: You never copy the contents of a dynamic array/slice. That only comes into play with static arrays: I should rephrase that. You aren't going to copy the contents of an array/slice just by passing it to a function.

Re: Remove array element within function

2021-07-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 July 2021 at 13:34:50 UTC, Rekel wrote: Ah, ref, thanks, I didn't know if that would work as I was confused since arrays themselves are kind of already pointers. Except they're not :-) Think of them as struct instances with length and pointer fields. That's actually what they

Re: Remove array element within function

2021-07-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 July 2021 at 13:41:59 UTC, Rekel wrote: I'm not sure if this is the place to talk about it, but on the same topic it's a little strange to me neither the Dlang Tour nor the arrays spec page mention removing elements. Even though basically everyone is going to use it sooner or

<    1   2   3   4   5   6   7   8   9   10   >