Re: do mir modules run in parallell

2019-10-04 Thread 9il via Digitalmars-d-learn
On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David Hey David, Do you mean unittests run in parallel or mir algorithms themselves run in parallel? Ilya

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 4, 2019 1:22:26 PM MDT Dennis via Digitalmars-d-learn wrote: > On Friday, 4 October 2019 at 19:08:04 UTC, Adam D. Ruppe wrote: > > (personally though I like to explicitly slice it all the time > > though, it is more clear and the habit is nice) > > Turns out I have this habit as

Re: Simple way to dereference common symbol

2019-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 5 October 2019 at 00:39:03 UTC, Brett wrote: is there a way to use a abstract this easily? I'd just use a traditional function for it, a little three liner. struct Foo { int longName; } // note ufcs only works when declared top level so it cant be nested in main

Re: using regex at compile time errors out! Error: static variable `thompsonFactory` cannot be read at compile time

2019-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 3 October 2019 at 23:47:17 UTC, Brett wrote: Error: static variable `thompsonFactory` cannot be read at compile time std.regex isn't ctfe compatible, alas. even the ctRegex doesn't work at ctfe; it *compiles* the regex at compile time, but it is not capable of actually *running*

Ranges to deal with corner cases and "random access"

2019-10-04 Thread Brett via Digitalmars-d-learn
Typically a lot of algorithms have corner cases such as referencing elements that end up out of bounds at the start or end (k-c or k+c). Is there any way to handle such things easily without having to worry about the corners? E.g., have it return a default value such as 0, or repeat the val

Re: using regex at compile time errors out! Error: static variable `thompsonFactory` cannot be read at compile time

2019-10-04 Thread Brett via Digitalmars-d-learn
On Friday, 4 October 2019 at 10:07:40 UTC, kinke wrote: Have you tried ctRegex? Yes, just another error about something else that I don't remember.

Simple way to dereference common symbol

2019-10-04 Thread Brett via Digitalmars-d-learn
I have some algorithmic code that uses the same dereferencing symbol quite often, like .X It's used in ranges, in predicates, in strings, etc and other things but is used a lot. The object it acts on has several fields and I would like to use them. is there a way to use a abstract this e

Re: Blog Post #75: Cairo X - Noodling with the Mouse

2019-10-04 Thread mipri via Digitalmars-d-learn
On Friday, 4 October 2019 at 20:56:31 UTC, Greatsam4sure wrote: On Tuesday, 1 October 2019 at 09:58:42 UTC, Ron Tarrant wrote: Here's the second installment of the Nodes-n-noodles coverage in which we get the mouse involved: https://gtkdcoding.com/2019/10/01/0075-cairo-x-mouse-noodle.html Pls

Re: Blog Post #75: Cairo X - Noodling with the Mouse

2019-10-04 Thread Greatsam4sure via Digitalmars-d-learn
On Tuesday, 1 October 2019 at 09:58:42 UTC, Ron Tarrant wrote: Here's the second installment of the Nodes-n-noodles coverage in which we get the mouse involved: https://gtkdcoding.com/2019/10/01/0075-cairo-x-mouse-noodle.html Pls sir can you make a pdf of the tutorials. that can be easily dow

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 04, 2019 at 07:21:34PM +, Dennis via Digitalmars-d-learn wrote: > On Friday, 4 October 2019 at 18:53:30 UTC, H. S. Teoh wrote: > > Here's an actual working example that illustrates the pitfall of > > this implicit conversion: > > Luckily it's caught by -dip1000 Nice! T -- "A m

do mir modules run in parallell

2019-10-04 Thread David via Digitalmars-d-learn
Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David

Re: What is the extension of ".pdf"

2019-10-04 Thread mipri via Digitalmars-d-learn
On Friday, 4 October 2019 at 19:58:16 UTC, Andre Pany wrote: Hi, I try to solve the puzzle https://www.codingame.com/training/easy/mime-type but have some issue because std.path:extension returns null for file name ".pdf" while the puzzle (test case 3) expects that the extension is ".pdf".

What is the extension of ".pdf"

2019-10-04 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to solve the puzzle https://www.codingame.com/training/easy/mime-type but have some issue because std.path:extension returns null for file name ".pdf" while the puzzle (test case 3) expects that the extension is ".pdf". Is the puzzle wrong or the phobos extension implementation? K

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Dennis via Digitalmars-d-learn
On Friday, 4 October 2019 at 18:53:30 UTC, H. S. Teoh wrote: Here's an actual working example that illustrates the pitfall of this implicit conversion: Luckily it's caught by -dip1000

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Dennis via Digitalmars-d-learn
On Friday, 4 October 2019 at 19:08:04 UTC, Adam D. Ruppe wrote: (personally though I like to explicitly slice it all the time though, it is more clear and the habit is nice) Turns out I have this habit as well. I'm looking through some of my code and see redundant slicing everywhere.

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 04, 2019 at 07:08:04PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Friday, 4 October 2019 at 19:03:14 UTC, Dennis wrote: > > You're right, I'm confused. I recall there was a situation where you > > had to explicitly slice a static array, but I can't think of it now. > > W

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 4 October 2019 at 19:03:14 UTC, Dennis wrote: You're right, I'm confused. I recall there was a situation where you had to explicitly slice a static array, but I can't think of it now. When passing to a range template it is necessary, otherwise the template will see it as non-resiza

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Dennis via Digitalmars-d-learn
On Friday, 4 October 2019 at 18:43:34 UTC, H. S. Teoh wrote: Actually, it *does* automatically convert the static array to a slice. You're right, I'm confused. I recall there was a situation where you had to explicitly slice a static array, but I can't think of it now.

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 04, 2019 at 11:43:34AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Fri, Oct 04, 2019 at 06:34:40PM +, Dennis via Digitalmars-d-learn > wrote: > > On Friday, 4 October 2019 at 18:30:17 UTC, IGotD- wrote: > > > What if you pass a static array to a function that expects a >

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 04, 2019 at 06:34:40PM +, Dennis via Digitalmars-d-learn wrote: > On Friday, 4 October 2019 at 18:30:17 UTC, IGotD- wrote: > > What if you pass a static array to a function that expects a dynamic > > array. Will D automatically create a dynamic array from the static > > array? > >

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Dennis via Digitalmars-d-learn
On Friday, 4 October 2019 at 18:30:17 UTC, IGotD- wrote: What if you pass a static array to a function that expects a dynamic array. Will D automatically create a dynamic array from the static array? No, you have to append [] to create a slice from the static array.

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread IGotD- via Digitalmars-d-learn
On Friday, 4 October 2019 at 15:03:04 UTC, Johan Engelen wrote: On Thursday, 3 October 2019 at 14:21:37 UTC, Andrea Fontana wrote: In D arrays are fat pointer instead: int[10] my_array; my_array is actually a pair ptr+length. ``` int[10] my_static_array; int[] my_dynamic_array; ``` my_stat

Re: How does D distnguish managed pointers from raw pointers?

2019-10-04 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 3 October 2019 at 14:21:37 UTC, Andrea Fontana wrote: In D arrays are fat pointer instead: int[10] my_array; my_array is actually a pair ptr+length. ``` int[10] my_static_array; int[] my_dynamic_array; ``` my_static_array will not be a fat pointer. Length is known at compile t

Re: Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 4, 2019 4:00:08 AM MDT Per Nordlöw via Digitalmars-d- learn wrote: > I have a wrapper container FixedArray at > > https://github.com/nordlow/phobos-next/blob/25f4a4ee7347427cebd5cd375c9990 > b44108d2ef/src/fixed_array.d > > on top of a static array store that provides the member

Re: Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Tobias Pankrath via Digitalmars-d-learn
On Friday, 4 October 2019 at 10:00:08 UTC, Per Nordlöw wrote: Is the usage of `enforce` to check for out of bounds (fullness) idiomatic D or should an `assert()` be used instead? I'd say it should follow -boundscheck: https://dlang.org/dmd-linux.html#switch-boundscheck Does that set an versi

Re: Blog Post #76: Nodes and Noodles, Part II

2019-10-04 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 4 October 2019 at 11:36:52 UTC, Ron Tarrant wrote: Here's the second instalment of the Nodes-n-noodles series wherein noodle drawing on a DrawingArea is now complete. You can find it here: http://localhost:4000/2019/10/04/0076-cairo-xi-noodles-and-mouse-clicks.html Beg pardon. That

Blog Post #76: Nodes and Noodles, Part II

2019-10-04 Thread Ron Tarrant via Digitalmars-d-learn
Here's the second instalment of the Nodes-n-noodles series wherein noodle drawing on a DrawingArea is now complete. You can find it here: http://localhost:4000/2019/10/04/0076-cairo-xi-noodles-and-mouse-clicks.html

Re: using regex at compile time errors out! Error: static variable `thompsonFactory` cannot be read at compile time

2019-10-04 Thread kinke via Digitalmars-d-learn
Have you tried ctRegex?

Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Per Nordlöw via Digitalmars-d-learn
I have a wrapper container FixedArray at https://github.com/nordlow/phobos-next/blob/25f4a4ee7347427cebd5cd375c9990b44108d2ef/src/fixed_array.d on top of a static array store that provides the member void insertBack(Es...)(Es es) @trusted if (Es.length <= capacity) // TODO use `isAssign