Re: static assert(version(x)) ?

2019-11-26 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch wrote: How can I write something like this to check if any of a set of specific versions is used? static assert(!(version(a) | version(b) | version(c)): The problem is that I can use version(a) like a test, and the symbol a is not

Re: static assert(version(x)) ?

2019-11-26 Thread S.G via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch wrote: How can I write something like this to check if any of a set of specific versions is used? static assert(!(version(a) | version(b) | version(c)): The problem is that I can use version(a) like a test, and the symbol a is not

static assert(version(x)) ?

2019-11-26 Thread Robert M. Münch via Digitalmars-d-learn
How can I write something like this to check if any of a set of specific versions is used? static assert(!(version(a) | version(b) | version(c)): The problem is that I can use version(a) like a test, and the symbol a is not accessbile from assert (different, non-accessible namespace). --

Blog Post #91: Where's My Window?

2019-11-26 Thread Ron Tarrant via Digitalmars-d-learn
Today's post was inspired by a reader request, even though it wasn't specifically requested. It's about finding a Window's position and can be found here: https://gtkdcoding.com/2019/11/26/0091-window-stats-i-position.html I'd also like to take this opportunity to announce that my posting

Re: static assert(version(x)) ?

2019-11-26 Thread Dennis via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch wrote: How can I write something like this to check if any of a set of specific versions is used? ``` version(a) {} else version(b) {} else version(c) {} else { static assert(0, "only versions a, b and c are supported"); } ```

Re: How to create DDoc for string mixin generated functions?

2019-11-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 25, 2019 9:25:08 AM MST ParticlePeter via Digitalmars-d- learn wrote: > I am producing a bunch of functions/methods through string > mixins. I also generated DDoc comments for those functions, in > the hope that they would produce proper documentation, but they > don't. So how

Re: static assert(version(x)) ?

2019-11-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 26, 2019 4:29:18 AM MST S.G via Digitalmars-d-learn wrote: > On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch > > wrote: > > How can I write something like this to check if any of a set of > > specific versions is used? > > > > static assert(!(version(a) |

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 06:45:19 UTC, Alex wrote: On Tuesday, 26 November 2019 at 05:17:54 UTC, Taylor R Hillegeist wrote: [...] What exactly is the problem, as this works for me if I understood your goal correctly: ´´´ void main() { import std.algorithm.comparison : equal;

Re: Simple casting?

2019-11-26 Thread Timon Gehr via Digitalmars-d-learn
On 26.11.19 06:05, Taylor R Hillegeist wrote: I'm attempting to do a segment group. details: alias ProbePoint[3]=triple; triple[] irqSortedSet = UniqueTriples.keys     .sort!("a[1].irqid < b[1].irqid",SwapStrategy.stable)     .array; 83:triple[][] irqSortedSets =

Re: How to create DDoc for string mixin generated functions?

2019-11-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 13:02:39 UTC, Jonathan M Davis wrote: On Monday, November 25, 2019 9:25:08 AM MST ParticlePeter via ... - Jonathan M Davis Thanks for that thorough explanation. In may case I use the string mixin to forward outer struct property calls to members of an inner

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; how did you know to do that?

Re: Simple casting?

2019-11-26 Thread Ali Çehreli via Digitalmars-d-learn
On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: >> int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; > > > how did you know to do that? Ranges don't have elements. They either generate elements according to an algorithm,

Re: How to create DDoc for string mixin generated functions?

2019-11-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 19:27:55 UTC, ParticlePeter wrote: In may case I use the string mixin to forward outer struct property calls to members of an inner struct. Did you try opDispatch btw? It might be simpler to implement and to document. btw there might be a hacky solution to

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 02:48:53 UTC, cartland wrote: Trying out exception handling. When an exception occurs, program seems to just exit. dub -a x86_mscoff I compiled it with dmd and ran it directly from the command line and it worked fine: C:\dev\D\scratch>ex finally catch

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread cartland via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 05:43:33 UTC, Mike Parker wrote: On Wednesday, 27 November 2019 at 05:15:10 UTC, cartland wrote: *snip* dmd -m32mscoff -debug -g x.d And see what happens. No difference between "dmd -m32mscoff -debug -g x.d" and "dmd -m32mscoff x.d" C:\tmp\x>dmd

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread Rainer Schuetze via Digitalmars-d-learn
On 27/11/2019 06:55, cartland wrote: > On Wednesday, 27 November 2019 at 05:43:33 UTC, Mike Parker wrote: >> On Wednesday, 27 November 2019 at 05:15:10 UTC, cartland wrote: >> *snip* >> >> dmd -m32mscoff -debug -g x.d >> >> And see what happens. > > No difference between "dmd -m32mscoff -debug

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread cartland via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 04:11:44 UTC, Mike Parker wrote: On Wednesday, 27 November 2019 at 02:48:53 UTC, cartland wrote: Trying out exception handling. When an exception occurs, program seems to just exit. dub -a x86_mscoff I compiled it with dmd and ran it directly from the

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 05:15:10 UTC, cartland wrote: No MS installed. Just using DMD. - dub -a x86_mscoff --force -v : So please try it without dub dmd -m32mscoff x.d If that works, add some debug flags like dub does: dmd -m32mscoff -debug -g x.d And see what happens.

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread cartland via Digitalmars-d-learn
This works (once I installed Microsoft Visual C++ 2010 x64 Redistributable) : dub --force -v Seems the issue is with "x86_mscoff" -- : Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. x ~master: building configuration "application"...

Re: Simple casting?

2019-11-26 Thread Timon Gehr via Digitalmars-d-learn
On 26.11.19 23:08, Taylor R Hillegeist wrote: On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote:     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; how did you know to do that? chunkBy with a binary predicate returns a range of ranges. So if I want an array of arrays I

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 23:29:12 UTC, Ali Çehreli wrote: On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: >> int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; > > > how did you know to do that? std.array.array pulls

Exceptions on Windows being "swallowed"

2019-11-26 Thread cartland via Digitalmars-d-learn
Trying out exception handling. When an exception occurs, program seems to just exit. dub -a x86_mscoff Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86, x86_mscoff. x ~master: target for configuration "application" is up to date. To force a rebuild of up-to-date targets,