Any suggestions on dmd error message formatting?

2021-05-14 Thread Chris Piker via Digitalmars-d-learn
Hi D So the compile error messages getting from dmd are starting to remind me of the notorious 130 line error message I once got from a C++ compiler for missing a comma in a template. :-/ (After fixing that bug, I left work early and came back the next day with a python book.) So, like

Re: Filter for opDispatch?

2021-05-14 Thread frame via Digitalmars-d-learn
On Friday, 14 May 2021 at 22:39:29 UTC, frame wrote: When using opDispatch() Thanks! I stumbled around with static asserts and mixins... totally forgot about the constraints but they will to the trick.

Re: Filter for opDispatch?

2021-05-14 Thread Paul Backus via Digitalmars-d-learn
On Friday, 14 May 2021 at 22:39:29 UTC, frame wrote: When using opDispatch() - how can I tell the compiler that I do not want to handle some calls? Some code is testing for range methods (empty, front, popFront) and I don't know where and which side effects it causes. Use a template

Re: Filter for opDispatch?

2021-05-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 14 May 2021 at 22:39:29 UTC, frame wrote: - how can I tell the compiler that I do not want to handle some calls? Put a template constraint on it. `void opDispatch(string s)() if(s == "whatever")` or minimally like `if(s != "popFront")` This kind of thing is why I always put

Filter for opDispatch?

2021-05-14 Thread frame via Digitalmars-d-learn
When using opDispatch() - how can I tell the compiler that I do not want to handle some calls? Some code is testing for range methods (empty, front, popFront) and I don't know where and which side effects it causes. - how can I dismiss calls from __traits(compiles)?

Re: Can rdmd (under Windows 10) use linker other than Optlink?

2021-05-14 Thread rikki cattermole via Digitalmars-d-learn
On 15/05/2021 9:42 AM, DLearner wrote: I am getting 'Error 42: Symbol Undefined' while testing some (fairly) complex imports. There was a reference in January to an Optlink bug that seemed like it could be responsible. If rdmd can use another linker (and one was recommended), I might be

Can rdmd (under Windows 10) use linker other than Optlink?

2021-05-14 Thread DLearner via Digitalmars-d-learn
I am getting 'Error 42: Symbol Undefined' while testing some (fairly) complex imports. There was a reference in January to an Optlink bug that seemed like it could be responsible. If rdmd can use another linker (and one was recommended), I might be able to test things further. Best

Re: SDL2 Android vulkan question

2021-05-14 Thread Danny Arends via Digitalmars-d-learn
On Sunday, 2 May 2021 at 13:43:11 UTC, evilrat wrote: Anyway, I might try to look at this next weekend. Do you have this project available on github/google drive? Open-sourced the code see: https://github.com/DannyArends/CalderaD Danny

Re: Learning D

2021-05-14 Thread Mike Parker via Digitalmars-d-learn
On Friday, 14 May 2021 at 15:30:06 UTC, Imperatorn wrote: https://www.amazon.com/Programming-Language-Former-Python-Developers-ebook/dp/B08MD7ZB2X Anyone read it? From the thread title, I thought you were asking about my book!

Re: how do I implement opSlice for retro range?

2021-05-14 Thread Jack via Digitalmars-d-learn
On Friday, 14 May 2021 at 14:14:03 UTC, Steven Schveighoffer wrote: On 5/13/21 11:49 PM, Jack wrote: [...] Just slice the `a`, appropriately. You have to translate the indexes back into the original array. ```d auto opSlice(size_t start, size_t end) { return typeof(this)(a[$ - end .. $ -

Re: how do I implement opSlice for retro range?

2021-05-14 Thread Jack via Digitalmars-d-learn
On Friday, 14 May 2021 at 10:00:44 UTC, Christian Köstlin wrote: On 2021-05-14 05:49, Jack wrote: [...] arr.retro()[0..2] already works. see https://run.dlang.io/is/U8u3br oh, how i silly of i didn't notice that before

Re: Learning D

2021-05-14 Thread cc via Digitalmars-d-learn
On Friday, 14 May 2021 at 15:30:06 UTC, Imperatorn wrote: https://www.amazon.com/Programming-Language-Former-Python-Developers-ebook/dp/B08MD7ZB2X Anyone read it? Haven't read it, the title has me at the first five words though.

Learning D

2021-05-14 Thread Imperatorn via Digitalmars-d-learn
https://www.amazon.com/Programming-Language-Former-Python-Developers-ebook/dp/B08MD7ZB2X Anyone read it?

Re: ref struct member function

2021-05-14 Thread Paul Backus via Digitalmars-d-learn
On Friday, 14 May 2021 at 10:00:28 UTC, PinDPlugga wrote: Hi thank you both for your answers. I had understood from an earlier chapter how this could introduce a bug, but I was confused because the warning suggests attaching ```return``` to the parameter, which is empty in the declaration.

Re: how do I implement opSlice for retro range?

2021-05-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/21 11:49 PM, Jack wrote: How can I implement ranges in the retro range? I'd like to do this without allocate a new array with .array from std.array, can I do that? use like this: ```d     auto arr = [1, 2, 3, 4, 5];     auto a = new A!int(arr);     auto b = a.retro[0 .. 2]; // 4, 5

Re: Scope of 'alias'

2021-05-14 Thread Paul Backus via Digitalmars-d-learn
On Friday, 14 May 2021 at 14:03:17 UTC, DLearner wrote: So 'alias' only valid from definition to end-of-function, rather than whole function? Best regards Yes. This applies to all definitions inside a function, not just aliases.

Scope of 'alias'

2021-05-14 Thread DLearner via Digitalmars-d-learn
>>> void foo(pint p1) { alias pint=uint; import std.stdio; writeln("p1 = ", p1); } void main() { alias pint=uint; pint var1; var1 = 7; foo(var1); } <<< Does not compile. But the rather similar: alias pint=uint; void

Re: ref struct member function

2021-05-14 Thread ag0aep6g via Digitalmars-d-learn
On 14.05.21 12:00, PinDPlugga wrote: Hi thank you both for your answers. I had understood from an earlier chapter how this could introduce a bug, but I was confused because the warning suggests attaching ```return``` to the parameter, which is empty in the declaration. `this` is considered a

Re: ref struct member function

2021-05-14 Thread PinDPlugga via Digitalmars-d-learn
On Thursday, 13 May 2021 at 19:48:44 UTC, Ali Çehreli wrote: I was writing this example that shows a use case for the problem (marked with BUG below): ```D struct Fraction { auto n = 0L; auto d = 1L; // ... other bits ... ref Fraction reduce() { import std.numeric : gcd;

Re: how do I implement opSlice for retro range?

2021-05-14 Thread Christian Köstlin via Digitalmars-d-learn
On 2021-05-14 05:49, Jack wrote: How can I implement ranges in the retro range? I'd like to do this without allocate a new array with .array from std.array, can I do that? use like this: ```d     auto arr = [1, 2, 3, 4, 5];     auto a = new A!int(arr);     auto b = a.retro[0 .. 2]; // 4, 5

Re: Passing a byLine as an argument to InputRange

2021-05-14 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 13 May 2021 at 18:31:41 UTC, Ali Çehreli wrote: On 5/13/21 11:29 AM, Ali Çehreli wrote: create a dynamic InputRange!string object for dynamic polymorphism that InputRange provides. And that's achieved by function inputRangeObject(): Some examples: