Re: Function parameter type inference: is this example working as intended?

2018-09-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 4, 2018 8:33:47 PM MDT Nathan S. via Digitalmars-d- learn wrote: > The below writes "uint". Is this working as intended? > https://run.dlang.io/is/Dx2e7f > > --- > import std.stdio; > > auto foo(T = uint)(uint x) > { > return T.stringof; > } > > auto foo(T = ulong)(ulong

Re: Function parameter type inference: is this example working as intended?

2018-09-04 Thread Nathan S. via Digitalmars-d-learn
On Wednesday, 5 September 2018 at 02:33:47 UTC, Nathan S. wrote: The below writes "uint". Is this working as intended? https://run.dlang.io/is/Dx2e7f Note that it's called not with a `ulong` literal but with a `long` literal.

Function parameter type inference: is this example working as intended?

2018-09-04 Thread Nathan S. via Digitalmars-d-learn
The below writes "uint". Is this working as intended? https://run.dlang.io/is/Dx2e7f --- import std.stdio; auto foo(T = uint)(uint x) { return T.stringof; } auto foo(T = ulong)(ulong x) { return T.stringof; } void main() { writeln(foo(10L)); } ---

Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn
https://drive.google.com/open?id=1Qo6BYIZjaoxL_Z0TS9-vAN4ZgbTepkcR I've reinstalled in other location and rewrite whole example. I still get optlink error http://www.digitalmars.com/ctg/optlink.html

Re: Mutable ForwardRange save() method not callable using const object

2018-09-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 4, 2018 9:22:26 AM MDT Timoses via Digitalmars-d-learn wrote: > On Tuesday, 4 September 2018 at 14:26:44 UTC, Steven > > Schveighoffer wrote: > > [...] > > As general advice, I wouldn't expect const to work well with > > Ranges anyway -- const ranges are useless (you can't

Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn
https://drive.google.com/open?id=1hC5SZ3VWX0iQoUO7KN0S-743x6FG9ER5 I give up Cant compile this vibe-d Ill get back to phobos

Re: C++ GLM(OpenGL Mathematics) D Equivalent.

2018-09-04 Thread drug via Digitalmars-d-learn
On 04.09.2018 22:23, SrMordred wrote: Most C++ game related projects uses GLM as they default math/vector lib (even if not using opengl). In D we have (that I found): gfm.math  - https://github.com/d-gamedev-team/gfm dlib.math - https://github.com/gecko0307/dlib Gl3n  -

Re: C++ GLM(OpenGL Mathematics) D Equivalent.

2018-09-04 Thread JN via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 19:23:16 UTC, SrMordred wrote: Most C++ game related projects uses GLM as they default math/vector lib (even if not using opengl). In D we have (that I found): gfm.math - https://github.com/d-gamedev-team/gfm dlib.math - https://github.com/gecko0307/dlib Gl3n

C++ GLM(OpenGL Mathematics) D Equivalent.

2018-09-04 Thread SrMordred via Digitalmars-d-learn
Most C++ game related projects uses GLM as they default math/vector lib (even if not using opengl). In D we have (that I found): gfm.math - https://github.com/d-gamedev-team/gfm dlib.math - https://github.com/gecko0307/dlib Gl3n - https://github.com/Dav1dde/gl3n But i'm not sure which

Re: Mutable ForwardRange save() method not callable using const object

2018-09-04 Thread Timoses via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 14:26:44 UTC, Steven Schveighoffer wrote: [...] As general advice, I wouldn't expect const to work well with Ranges anyway -- const ranges are useless (you can't iterate them). So not much code is expecting to handle const, including the wrappers that Phobos

Re: Mutable ForwardRange save() method not callable using const object

2018-09-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/4/18 9:53 AM, Timoses wrote: Hey, I'm fiddling around with ranges a bit and am wondering why save is not callable on a const object: ... I could imagine that save is not marked as const because it is uncertain whether any indirections are part of the content..? But couldn't the

Mutable ForwardRange save() method not callable using const object

2018-09-04 Thread Timoses via Digitalmars-d-learn
Hey, I'm fiddling around with ranges a bit and am wondering why save is not callable on a const object: class Range { ForwardRange!(const uint) offsets; this(const S s) { this.offsets = s.s.map!(e => e.i).inputRangeObject; }

Re: Struct immutable data and dict

2018-09-04 Thread Timoses via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 12:27:47 UTC, nkm1 wrote: I also had this problem recently. I think aa.require() should allow to add immutables (feature request). Anyway, my workaround was along the lines of: final class AA(Key, Value) { Value[] _storage; size_t[Key] _aa; void

Re: How to use listener.d example?

2018-09-04 Thread rikki cattermole via Digitalmars-d-learn
On 05/09/2018 12:10 AM, Marcin wrote: "" Am i doing it right? I've unpacked vibe.d-master to my "C:\D\dtwo\src" commands in cmd: cd C:\D\dtwo\windows\bin\ echo "vibe.d-master is a folder" dmd -lib C:\D\dtwo\src\vibe.d-master\core\vibe\appmain.d

Re: Struct immutable data and dict

2018-09-04 Thread nkm1 via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 11:25:15 UTC, Alex wrote: On Tuesday, 4 September 2018 at 10:30:24 UTC, Timoses wrote: However, of course this also fails because randomly assigning the array elements will overwrite it. So the associative array seems like the better idea. However, not being

Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn
"" Am i doing it right? I've unpacked vibe.d-master to my "C:\D\dtwo\src" commands in cmd: cd C:\D\dtwo\windows\bin\ echo "vibe.d-master is a folder" dmd -lib C:\D\dtwo\src\vibe.d-master\core\vibe\appmain.d C:\D\dtwo\src\vibe.d-master\http\vibe\http\server.d no wai, Ill just paste the

Re: Struct immutable data and dict

2018-09-04 Thread Alex via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 10:30:24 UTC, Timoses wrote: However, of course this also fails because randomly assigning the array elements will overwrite it. So the associative array seems like the better idea. However, not being able to INITIALIZE an assoc array element disallows its

Re: How to use listener.d example?

2018-09-04 Thread rikki cattermole via Digitalmars-d-learn
On 04/09/2018 10:57 PM, Marcin wrote: On Friday, 31 August 2018 at 07:38:54 UTC, Marcin wrote: https://github.com/dlang/dmd/blob/master/samples/listener.d Im using Notepad++ as my IDE cuz i dont have administrator privileges on PC Coedit is a good option since it is a simple unzip and

Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn
On Friday, 31 August 2018 at 07:38:54 UTC, Marcin wrote: https://github.com/dlang/dmd/blob/master/samples/listener.d Im using Notepad++ as my IDE cuz i dont have administrator privileges on PC To import modules i use -I option cmd /k cd C:\D\dtwo\windows\bin\ &

Re: Struct immutable data and dict

2018-09-04 Thread Timoses via Digitalmars-d-learn
On Thursday, 6 October 2016 at 02:09:44 UTC, Adam D. Ruppe wrote: On Thursday, 6 October 2016 at 01:23:35 UTC, Patric Dexheimer wrote: Why? Because you'd be overwriting that immutable member. Structs just put structure around their contents, but it doesn't change their nature. That struct

Re: Is there any reason to use non-ref foreach?

2018-09-04 Thread Dukc via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 08:17:14 UTC, Andrea Fontana wrote: Waiting for this to be merged: https://github.com/dlang/dmd/pull/8437 Well, it seems Andrei has already approved the concept. well, THAT is a good reason to avoid this paradigm. Thanks for the info.

Re: Is there any reason to use non-ref foreach?

2018-09-04 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 07:06:43 UTC, Dukc wrote: On Monday, 3 September 2018 at 13:34:36 UTC, Andrea Fontana wrote: On Friday, 31 August 2018 at 09:59:20 UTC, Dukc wrote: For me, it seems that for generality you should always add ref into foreach loop variable. The reason is this:

Re: Is there any reason to use non-ref foreach?

2018-09-04 Thread Dukc via Digitalmars-d-learn
On Monday, 3 September 2018 at 13:34:36 UTC, Andrea Fontana wrote: On Friday, 31 August 2018 at 09:59:20 UTC, Dukc wrote: For me, it seems that for generality you should always add ref into foreach loop variable. The reason is this: One good reason:

Re: assumeNoGC works but can't get an assumePure to work

2018-09-04 Thread aliak via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 01:33:52 UTC, Paul Backus wrote: On Monday, 3 September 2018 at 22:07:10 UTC, aliak wrote: Why does it work with nogc but not with pure? Cheers, - Ali You can't define an impure function inside a pure unittest. If you move `modify` outside the unittest block,