Re: Ldc on Windows

2018-04-17 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote: Ah, I found the msvcEnv.bat and I told me that I have to VSC installation. Solved! You should also be able to use -link-internally /LLMV's lld if you don't want to install MSVC

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, April 15, 2018 17:59:01 Dgame via Digitalmars-d-learn wrote: > How am I supposed to insert a struct with immutable members into > an assoc. array? > > Reduced example: > > struct A { > immutable string name; > } > > A[string] as; > as["a"] = A("a"); // Does not work > I

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:07:55 UTC, bauss wrote: Even though it works in static this, then it still looks like a bug if you ask me, because the associative array itself isn't immutable. Yeah... I'm not sure, if this behavior is wanted, too... If you argue, that an absent field in in

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread bauss via Digitalmars-d-learn
On Sunday, 15 April 2018 at 18:51:52 UTC, Alex wrote: On Sunday, 15 April 2018 at 17:59:01 UTC, Dgame wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; } A[string] as; as["a"] = A("a"); // Does

Re: Ldc on Windows

2018-04-17 Thread Dgame via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 09:42:01 UTC, Dgame wrote: I'm trying to use Ldc on Windows, but I get these linker errors: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 9:

Re: Delegates and classes for custom code.

2018-04-17 Thread bauss via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 03:55:55 UTC, Chris Katko wrote: What I want: class viewport_t { int x,y,w,h; } class dialog_t { int x,y; this( int x, int y, delegate void (viewport_t) on_draw ) { this.x = x; this.y = y; this.execute = execute; } void

Re: Delegates and classes for custom code.

2018-04-17 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 03:55:55 UTC, Chris Katko wrote: What I want: class viewport_t { int x,y,w,h; } class dialog_t { int x,y; this( int x, int y, delegate void (viewport_t) on_draw ) { this.x = x; this.y = y; this.execute = execute; } void

Ldc on Windows

2018-04-17 Thread Dgame via Digitalmars-d-learn
I'm trying to use Ldc on Windows, but I get these linker errors: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 9: Unknown Option : OUT OPTLINK : Warning 9: Unknown Option :

Re: Ldc on Windows

2018-04-17 Thread Dgame via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson wrote: On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote: Ah, I found the msvcEnv.bat and I told me that I have to VSC installation. Solved! You should also be able to use -link-internally /LLMV's lld if you don't want to

Re: Assoc. Array and struct with immutable member

2018-04-17 Thread Dgame via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:38:17 UTC, Jonathan M Davis wrote: On Sunday, April 15, 2018 17:59:01 Dgame via Digitalmars-d-learn wrote: How am I supposed to insert a struct with immutable members into an assoc. array? Reduced example: struct A { immutable string name; }

Re: Ldc on Windows

2018-04-17 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 12:42:48 UTC, Dgame wrote: On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson wrote: On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote: Ah, I found the msvcEnv.bat and I told me that I have to VSC installation. Solved! You should also be able to use

Getting the overload set of a template

2018-04-17 Thread Arafel via Digitalmars-d-learn
Hi! Is there any way to get the full set of templates that are "overloaded" (in my case, based on constraints)? Basically, I'd like to make something like https://run.dlang.io/is/z2LeAj return both versions of the template (and then retrieve their UDAs)... If it's not possible, I can

Re: Ldc on Windows

2018-04-17 Thread kinke via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson wrote: You should also be able to use -link-internally /LLMV's lld if you don't want to install MSVC Nope, the MSVC libs are still required, and no, the ancient ones shipping with DMD can't be used.

get literal symbol name without base class/struct as string

2018-04-17 Thread Dr.No via Digitalmars-d-learn
give structs like this: struct A { int a = 10; string s = "haha"; } struct B { A aDetails; } I'd like to do this and store that symbol name as string (my goal is store the member name); string memberName = magic(B.aDetails.s); writeln(memberName); // otuput

Re: Delegates and classes for custom code.

2018-04-17 Thread arturg via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 01:12:33 UTC, Chris Katko wrote: That was all pseudo-code typed by hand. I got my code to work today. I don't know if it's the prettiest it can be, but it works: // TESTING ACCESS TO the OWNING function //--- class

Re: Delegates and classes for custom code.

2018-04-17 Thread arturg via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 01:58:40 UTC, arturg wrote: is it this what you want? class A { int a; void delegate() onDraw; this(void delegate() dg) { onDraw = dg; } void drawText(string s) { s.writeln; }

Re: Delegates and classes for custom code.

2018-04-17 Thread Chris Katko via Digitalmars-d-learn
That was all pseudo-code typed by hand. I got my code to work today. I don't know if it's the prettiest it can be, but it works: // TESTING ACCESS TO the OWNING function //--- class test_window { float x; float y;