Re: std.math log and family

2018-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 31, 2018 at 01:14:37AM +, kinke via Digitalmars-d-learn wrote: > On Wednesday, 31 October 2018 at 00:48:03 UTC, Joe wrote: > > I'd like to know if the lack of double/float versions of 'log', > > 'log10', etc. are intentional, i.e., there's some rationale behind > > it, or an oversig

Re: std.math log and family

2018-10-30 Thread kinke via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 00:48:03 UTC, Joe wrote: I'd like to know if the lack of double/float versions of 'log', 'log10', etc. are intentional, i.e., there's some rationale behind it, or an oversight. Just laziness or people still thinking that you don't lose any performance by compu

Re: std.math log and family

2018-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 31, 2018 at 12:48:03AM +, Joe via Digitalmars-d-learn wrote: [...] > I'd like to know if the lack of double/float versions of 'log', > 'log10', etc. are intentional, i.e., there's some rationale behind it, > or an oversight. It's an oversight. Thanks for bringing it to our attenti

std.math log and family

2018-10-30 Thread Joe via Digitalmars-d-learn
I've discovered that the 'log' function as well several similar functions are only defined as taking a real argument and returning a real, unlike most other std.math functions, which have triple definitions (also supporting double and float types). This created a problem when I tried compiling

Re: How in the name of D do you deal with more than one optional template parameter?

2018-10-30 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Oct 30, 2018 at 08:46:31PM +, aliak via Digitalmars-d-learn wrote: > Hi, > > Do you guys have any strategies for dealing with templates when they > have more than one optional parameter? > > E.g let's say we have a type C that takes three parameters > > struct B(T) {} > struct C(str

How in the name of D do you deal with more than one optional template parameter?

2018-10-30 Thread aliak via Digitalmars-d-learn
Hi, Do you guys have any strategies for dealing with templates when they have more than one optional parameter? E.g let's say we have a type C that takes three parameters struct B(T) {} struct C(string name, T, string desc) {} And let's say I want T and desc to be optional and T should be o

Re: anyway to set a const object after the fact?

2018-10-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 30, 2018 2:18:15 AM MDT Laurent Tréguier via Digitalmars-d-learn wrote: > On Monday, 29 October 2018 at 21:50:32 UTC, aliak wrote: > > Hi, so if you have this piece of code: > > > > struct C { > > > > void f() { > > > > string[] others; > > const string[] restArgs; >

Re: Where do I learn to use GtkD

2018-10-30 Thread Michelle Long via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the API structure compared to python3 Gtk3 and the demo examples

Re: anyway to set a const object after the fact?

2018-10-30 Thread Laurent Tréguier via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 11:23:48 UTC, aliak wrote: Guess I could do that. But would there be a difference if I just declared the restArgs as non const then? Given the objective is "set this var to point to this thing and not allow it to be set to point to anything else". The difference

Re: anyway to set a const object after the fact?

2018-10-30 Thread aliak via Digitalmars-d-learn
On Monday, 29 October 2018 at 22:05:16 UTC, H. S. Teoh wrote: What exactly are you trying to accomplish? I.e., what semantics do you want from modifying restArgs? Trying to set restArgs to point to some data but only set it once. Would require some sort of control flow analysis on the part

Re: anyway to set a const object after the fact?

2018-10-30 Thread aliak via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 08:18:15 UTC, Laurent Tréguier wrote: On Monday, 29 October 2018 at 21:50:32 UTC, aliak wrote: Hi, so if you have this piece of code: struct C { void f() { string[] others; const string[] restArgs; foreach (i, arg; args) { if (isValidArg(arg))

Re: anyway to set a const object after the fact?

2018-10-30 Thread aliak via Digitalmars-d-learn
On Monday, 29 October 2018 at 22:12:24 UTC, Paul Backus wrote: Use a lambda: const string[] restArgs = () { foreach(i, arg; args) { if (isValidArg(arg)) { return args[i+1 .. $]; } others ~= arg; } }(); That works.

Re: DirectX bindings

2018-10-30 Thread John Burton via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 10:46:35 UTC, Mike Parker wrote: On Tuesday, 30 October 2018 at 10:30:48 UTC, John Burton wrote: I want to do some graphics using direct3d11 on windows. There are some bindings that I used once before https://github.com/evilrat666/directx-d However they are marke

Re: DirectX bindings

2018-10-30 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 10:30:48 UTC, John Burton wrote: I want to do some graphics using direct3d11 on windows. There are some bindings that I used once before https://github.com/evilrat666/directx-d However they are marked as [discontinued] While I'm sure they will continue to work so

DirectX bindings

2018-10-30 Thread John Burton via Digitalmars-d-learn
I want to do some graphics using direct3d11 on windows. There are some bindings that I used once before https://github.com/evilrat666/directx-d However they are marked as [discontinued] While I'm sure they will continue to work so wouldn't worry about using this I wonder if there are any other

Re: Built-in array opSliceAssign

2018-10-30 Thread Eduard Staniloiu via Digitalmars-d-learn
On Thursday, 25 October 2018 at 21:00:46 UTC, Adam D. Ruppe wrote: On Thursday, 25 October 2018 at 19:56:18 UTC, Stanislav Blinov wrote: The current behavior of the compiler is quite the opposite of those "same as" above. Yeah, I guess I am maybe selectively reading the spec in light of the i

Re: anyway to set a const object after the fact?

2018-10-30 Thread Laurent Tréguier via Digitalmars-d-learn
On Monday, 29 October 2018 at 21:50:32 UTC, aliak wrote: Hi, so if you have this piece of code: struct C { void f() { string[] others; const string[] restArgs; foreach (i, arg; args) { if (isValidArg(arg)) { restArgs = args[i + 1 .. $]; break; } o