Re: get type name from current class at compile time?

2021-04-24 Thread Jack via Digitalmars-d-learn
On Sunday, 25 April 2021 at 02:45:38 UTC, Paul Backus wrote: On Sunday, 25 April 2021 at 02:26:00 UTC, Jack wrote: doesn't this work when called from member in a derived class? ```d class A { void doSomething(this T)() { writefln("name = [%s]",

Re: get type name from current class at compile time?

2021-04-24 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 25 April 2021 at 02:26:00 UTC, Jack wrote: doesn't this work when called from member in a derived class? ```d class A { void doSomething(this T)() { writefln("name = [%s]", __traits(identifier, T)); } } class K : A { void baa()

Re: get type name from current class at compile time?

2021-04-24 Thread Jack via Digitalmars-d-learn
On Sunday, 25 April 2021 at 02:26:00 UTC, Jack wrote: On Sunday, 25 April 2021 at 02:02:47 UTC, Ali Çehreli wrote: On 4/24/21 6:50 PM, Jack wrote: I'd like to output `K` and get this identifier at compile time. This is solved by the "this template parameter": import std.stdio; class A {

Re: get type name from current class at compile time?

2021-04-24 Thread Jack via Digitalmars-d-learn
On Sunday, 25 April 2021 at 02:02:47 UTC, Ali Çehreli wrote: On 4/24/21 6:50 PM, Jack wrote: I'd like to output `K` and get this identifier at compile time. This is solved by the "this template parameter": import std.stdio; class A { void showMyName(this T)() { writefln("name = [%s]",

Re: get type name from current class at compile time?

2021-04-24 Thread Jack via Digitalmars-d-learn
On Sunday, 25 April 2021 at 02:02:47 UTC, Ali Çehreli wrote: On 4/24/21 6:50 PM, Jack wrote: I'd like to output `K` and get this identifier at compile time. This is solved by the "this template parameter": import std.stdio; class A { void showMyName(this T)() { writefln("name = [%s]",

Re: Can I rely on format returned by fullyQualifiedName?

2021-04-24 Thread Jack via Digitalmars-d-learn
On Saturday, 24 April 2021 at 04:09:15 UTC, Mike Parker wrote: On Saturday, 24 April 2021 at 03:40:20 UTC, Jack wrote: Can I rely on this format from fullyQualifiedName? for example, let's say I do: ```d enum s = fullyQualifiedName!f.split; ``` where f is a function member of a class. Can I

Re: get type name from current class at compile time?

2021-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 4/24/21 6:50 PM, Jack wrote: I'd like to output `K` and get this identifier at compile time. This is solved by the "this template parameter": import std.stdio; class A { void showMyName(this T)() { writefln("name = [%s]", __traits(identifier, T)); } } class K : A { } void main()

get type name from current class at compile time?

2021-04-24 Thread Jack via Digitalmars-d-learn
```d class A { void showMyName() { writefln("name = [%s]", __traits(identifier, typeof(this))); } } class K : A { } ``` then ```d new K().showMyName(); ``` output: name = [A] I'd like to output `K` and get this identifier at compile time. But I'd to

Re: Calling readln() after readf

2021-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 4/24/21 7:46 AM, PinDPlugga wrote: > write("Please enter a number: "); > double number; > readf(" %s", number); Just to make sure, this is a common issue for other languages as well. As the explanation, the character ('\n') that you injected into stdin by pressing Enter is

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 19:25:47 UTC, Ishax wrote: On Saturday, 24 April 2021 at 18:55:33 UTC, ichneumwn wrote: "Use the lib command. If it's static, lib will show you a pile of .obj files inside. Not so if it's am implib." lib /list foo.lib This is the output of `lib /list

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
On Saturday, 24 April 2021 at 18:55:33 UTC, ichneumwn wrote: "Use the lib command. If it's static, lib will show you a pile of .obj files inside. Not so if it's am implib." lib /list foo.lib This is the output of `lib /list SDL2.lib` ``` Microsoft (R) Library Manager Version 14.28.29913.0

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
On Saturday, 24 April 2021 at 18:18:11 UTC, russhy wrote: Try to add this in your dub file: libs "user32" "gdi32" "shell32" No change.

Re: Use bindbc-sdl statically

2021-04-24 Thread ichneumwn via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:44:09 UTC, Ishax wrote: So I have the lib files. It's failing with only an exit code. No window is appearing. It's using the same D code as with the dynamic setup which I was able to produce a window with. ```sdl dependency "bindbc-sdl" version="~>0.1.0"

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
Try to add this in your dub file: libs "user32" "gdi32" "shell32"

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
On Saturday, 24 April 2021 at 17:20:06 UTC, russhy wrote: This should work I just tried your code. I get: ```Program exited with code -1073741701``` I put the libraries straight into the project root this time. ```sdl name "sdl2try2" description "A minimal D application." authors "Isaac"

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:48:49 UTC, Ishax wrote: It's using the same D code as with the dynamic setup which I was able to produce a window with. Yet the .exe functions if I supply it with .dlls. Thats silly. you didn't read my message Remove all the code used to loadSDL, it's not

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
Yet the .exe functions if I supply it with .dlls. Thats silly.

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:13:12 UTC, russhy wrote: on windows, for static compilation you have to use "*.lib" files, not "*.a" also you are missing the ``` subConfigurations "bindbc-sdl" "staticBC" ``` So I have the lib files. It's failing with only an exit code. No window is

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:10:13 UTC, Ishax wrote: On Saturday, 24 April 2021 at 16:02:27 UTC, russhy wrote: .a are object files for linux right? Are they? I'm not very familiar with c++. I'm using windows. For that matter I should mention I'm using dub in vscode. send us your

Re: Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:02:27 UTC, russhy wrote: .a are object files for linux right? Are they? I'm not very familiar with c++. I'm using windows. For that matter I should mention I'm using dub in vscode. send us your dub.json file maybe some things are misconfigured? ```sdl

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 15:58:26 UTC, Ishax wrote: I am trying to get graphics working in D. All seems well with bindbc sdl, but I hit a nitpick: I prefer to be able to create a standalone executable when possible. I cannot get bindbc to be happy with sdl .a files. It's a small problem,

Use bindbc-sdl statically

2021-04-24 Thread Ishax via Digitalmars-d-learn
I am trying to get graphics working in D. All seems well with bindbc sdl, but I hit a nitpick: I prefer to be able to create a standalone executable when possible. I cannot get bindbc to be happy with sdl .a files. It's a small problem, but if there's a simple solution, I'm eager to hear it.

Re: Calling readln() after readf

2021-04-24 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 24 April 2021 at 14:46:06 UTC, PinDPlugga wrote: I didn't want to necropost, but I ran into the same behaviour as in this post: https://forum.dlang.org/post/yfybveovbknvvxmio...@forum.dlang.org and was just curious to understand it better. [...]

Calling readln() after readf

2021-04-24 Thread PinDPlugga via Digitalmars-d-learn
I didn't want to necropost, but I ran into the same behaviour as in this post: https://forum.dlang.org/post/yfybveovbknvvxmio...@forum.dlang.org and was just curious to understand it better. If I call readln() after having previously called readf(), it does not behave as expected: ```d import