Re: Using arsd.simpledisplay module

2019-02-25 Thread JN via Digitalmars-d-learn
On Monday, 25 February 2019 at 23:35:24 UTC, Murilo wrote: I need help with the arsd.simpledisplay module. Is there anyone there who knows about it? I have doubts concerning SimpleWindow.eventLoop(). I'm pretty sure Adam D. Ruppe knows about it since he's the author :) What exactly is the q

Re: How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread JN via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 04:20:27 UTC, Michelle Long wrote: On Tuesday, 26 February 2019 at 04:17:04 UTC, Michelle Long wrote: e.g., using sdl for different versions and have it automatically switch. What would be nice is if one could stick all the files for x86 in one dir and x64 in t

Re: How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 9:17:04 PM MST Michelle Long via Digitalmars-d- learn wrote: > e.g., using sdl for different versions and have it automatically > switch. > > What would be nice is if one could stick all the files for x86 in > one dir and x64 in the others and they will be used dependin

Re: DMD2 vs LDC2 inliner

2019-02-25 Thread James Blachly via Digitalmars-d-learn
On 2/25/19 2:09 AM, Nicholas Wilson wrote: Leaving aside the issue of why DMD can't handle this, the entire reason pragma(inline, bool) takes a bool is for it to be (potentially) predicated. In this case you want: version(DigitalMars)   private enum inline_overlaps = false; else // assumin

Re: How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 04:17:04 UTC, Michelle Long wrote: e.g., using sdl for different versions and have it automatically switch. What would be nice is if one could stick all the files for x86 in one dir and x64 in the others and they will be used depending on the build(and copied)

How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Michelle Long via Digitalmars-d-learn
e.g., using sdl for different versions and have it automatically switch. What would be nice is if one could stick all the files for x86 in one dir and x64 in the others and they will be used depending on the build(and copied) Ideally one can do it for debug and release versions too.

Re: DMD2 vs LDC2 inliner

2019-02-25 Thread James Blachly via Digitalmars-d-learn
On 2/25/19 2:09 AM, Nicholas Wilson wrote: Leaving aside the issue of why DMD can't handle this, the entire reason pragma(inline, bool) takes a bool is for it to be (potentially) predicated. In this case you want: version(DigitalMars) private enum inline_overlaps = false; else // assuming

Re: Easiest way to display images

2019-02-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 25 February 2019 at 22:34:54 UTC, Murilo wrote: Hi Adam. I am using your library. There is the ScreenPainter struct and it has a method called .eventLoop(), how do I make it stop after a certain amount of loops? I would like to be able to call it several times in the program. I fea

Re: How to pass variables to string mixins?

2019-02-25 Thread Benjamin Schaaf via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 00:07:54 UTC, Victor Porton wrote: I want to create a string mixin based on a supplementary variable (name2 below): Let we have something like: mixin template X(string name) { immutable string name2 = '_' ~ name; mixin("struct " ~ name2 ~ "{ int i; }"); } B

Re: How to pass variables to string mixins?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 5:07:54 PM MST Victor Porton via Digitalmars-d- learn wrote: > I want to create a string mixin based on a supplementary variable > (name2 below): > > Let we have something like: > > mixin template X(string name) { >immutable string name2 = '_' ~ name; >mixin("st

Re: How to pass variables to string mixins?

2019-02-25 Thread Rubn via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 00:07:54 UTC, Victor Porton wrote: I want to create a string mixin based on a supplementary variable (name2 below): Let we have something like: mixin template X(string name) { immutable string name2 = '_' ~ name; mixin("struct " ~ name2 ~ "{ int i; }"); } B

How to pass variables to string mixins?

2019-02-25 Thread Victor Porton via Digitalmars-d-learn
I want to create a string mixin based on a supplementary variable (name2 below): Let we have something like: mixin template X(string name) { immutable string name2 = '_' ~ name; mixin("struct " ~ name2 ~ "{ int i; }"); } But it would create variable name2 inside X, which should not be cre

Using arsd.simpledisplay module

2019-02-25 Thread Murilo via Digitalmars-d-learn
I need help with the arsd.simpledisplay module. Is there anyone there who knows about it? I have doubts concerning SimpleWindow.eventLoop().

Re: Easiest way to display images

2019-02-25 Thread Murilo via Digitalmars-d-learn
On Tuesday, 12 February 2019 at 01:31:48 UTC, Adam D. Ruppe wrote: On Tuesday, 12 February 2019 at 01:16:21 UTC, Murilo wrote: Hi Adam. I have been using your arsd library and I have noticed that compiling with -m64 causes this error: huh, only on 64 bit windows. well, pushed a fix up, try th

Re: Simplifying a string mixin

2019-02-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "// ..." ~ " }\n" ~ " struct WithDefaults {\n"

Re: Disable dub from checking internet before building

2019-02-25 Thread Seb via Digitalmars-d-learn
On Monday, 25 February 2019 at 18:54:03 UTC, Jacob Carlborg wrote: On 2019-02-24 23:51, 0x wrote: How to disable dub from checking internet before building, it's slowing down build whenever it does this. I thought that was fixed [1]. Or is it doing something else? [1] https://dlang.or

Simplifying a string mixin

2019-02-25 Thread Victor Porton via Digitalmars-d-learn
Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "// ..." ~ " }\n" ~ " struct WithDefaults {\n" ~ "// ..." ~ " }\n" ~ '}'); I w

Re: Variadic template parameter (for mixin) does not work

2019-02-25 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Feb 25, 2019 at 08:23:10PM +, Victor Porton via Digitalmars-d-learn wrote: > I want to create a mixin with an arbitrary number of parameters. > > I tried this: > > mixin template ProviderParams(Types...)(Types t) { > } > > But it does not compile. What's my error? All you need is:

Variadic template parameter (for mixin) does not work

2019-02-25 Thread Victor Porton via Digitalmars-d-learn
I want to create a mixin with an arbitrary number of parameters. I tried this: mixin template ProviderParams(Types...)(Types t) { } But it does not compile. What's my error?

Re: Compile Time Fun Time

2019-02-25 Thread Paul Backus via Digitalmars-d-learn
On Monday, 25 February 2019 at 06:51:20 UTC, Yevano wrote: I am writing a domain specific language of sorts in D for the lambda calculus. One of my requirements is that I should be able to generate expressions like this: new Abstraction(v1, M) like this: L!(x => M) A word of caution: this

Is std.experimental.logger FileLogger thread safe?

2019-02-25 Thread Andre Pany via Digitalmars-d-learn
Hi, I am using the Arsd cgi class (https://github.com/adamdruppe/arsd) to spawn an http server. Each http request is handled in its own thread. Is it safe to set in void main a FileLogger to which each thread will write to? void main() { ... sharedLog = new FileLogger("New_Default_Log_File.l

Re: Disable dub from checking internet before building

2019-02-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-02-24 23:51, 0x wrote: How to disable dub from checking internet before building, it's slowing down build whenever it does this. I thought that was fixed [1]. Or is it doing something else? [1] https://dlang.org/changelog/2.082.0.html#upgrade_check -- /Jacob Carlborg

Re: sort!("...") with template function?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm > > wrote: > > Hello. > > > > I wish to sort an array by calling a template function on a > > struct. In essence I want to do > > > > foos.s

Re: Disable dub from checking internet before building

2019-02-25 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Monday, 25 February 2019 at 06:29:14 UTC, drug wrote: On 25.02.2019 1:51, 0x wrote: How to disable dub from checking internet before building, it's slowing down build whenever it does this. `--skip-registry=all` let you avoid checking of all dependencies (https://dub.pm/commandline)

Re: Why is SwitchError an error and how is it unsafe to continue after catching it?

2019-02-25 Thread aliak via Digitalmars-d-learn
On Sunday, 24 February 2019 at 11:05:31 UTC, Alex wrote: On Sunday, 24 February 2019 at 10:53:09 UTC, aliak wrote: [...] There is a semantic difference between a switch and a final switch statement, defined here: https://dlang.org/spec/statement.html#final-switch-statement By this differenc

Re: sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:47:47 UTC, Simen Kjærås wrote: On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get t

Re: sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:47:50 UTC, Andrea Fontana wrote: On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get

Re: sort!("...") with template function?

2019-02-25 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message /dlang/dmd/linux/bin64/../../src/phobos/std

Re: sort!("...") with template function?

2019-02-25 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message /dlang/dmd/linux/bin64/../../src/phobos/std

sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message /dlang/dmd/linux/bin64/../../src/phobos/std/functional.d-mixin-215(215): Error: undefined identifier Dummy Is the

Re: Compile Time Fun Time

2019-02-25 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 25 February 2019 at 08:24:06 UTC, Yevano wrote: One thing. The variables were reversed. Fixed by changing these lines. auto result = new Abstraction(vars[$ - 1], f(vars)); foreach_reverse(e; vars[0..$ - 1]) { result = new Abstraction(e, result); } Yup. I assumed that didn't ma

Re: Compile Time Fun Time

2019-02-25 Thread Yevano via Digitalmars-d-learn
One thing. The variables were reversed. Fixed by changing these lines. auto result = new Abstraction(vars[$ - 1], f(vars)); foreach_reverse(e; vars[0..$ - 1]) { result = new Abstraction(e, result); }

Re: Compile Time Fun Time

2019-02-25 Thread Yevano via Digitalmars-d-learn
On Monday, 25 February 2019 at 07:40:51 UTC, Simen Kjærås wrote: The simple scalable version - just change maxArgs to a number that suits you: It works! Thanks. Didn't know about static foreach.