Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Per Nordlöw via Digitalmars-d-learn
I've implement a small size optimized `string` at https://github.com/nordlow/phobos-next/blob/c35fa4052738af0cd7ad39a9fa715b5ec29c7bba/src/nxt/sso_string.d I'm now wondering whether or not its definition of comparison at https://github.com/nordlow/phobos-next/blob/c35fa4052738af0cd7ad39a9fa715b

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 08:30:55 UTC, Per Nordlöw wrote: is a suitable definition of `opCmp` for `SSOString` in terms of independence of Phobos' `std.algorithm.comparison.cmp`. I just found import core.internal.array.comparison : __cmp; I presume that is a better alternative if P

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 14:02:59 UTC, Ron Tarrant wrote: Today's post was requested by Joel Christensen, how to have one button affect another. You can find it here: https://gtkdcoding.com/2020/01/21/0099-sfx-button-interactions-i-text-labels.html Another useful tutorial would be someth

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 08:44:15 UTC, Per Nordlöw wrote: I just found import core.internal.array.comparison : __cmp; I presume that is a better alternative if Phobos' independence is desired. That looks like it's for internal use. There is a `compare` method in the `TypeInfo`

trying to understand in, inout, and ref...

2020-01-22 Thread mark via Digitalmars-d-learn
I have these code snippets: alias WordList = string[]; alias WordSet = int[string]; // key = word; value = 0 WordList generate(WordSet allWords, int steps) { WordList ladder; // will be changed in update() auto words = allWords.dup; // will be changed in update() auto compatibles = a

Re: trying to understand in, inout, and ref...

2020-01-22 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 10:49:07 UTC, mark wrote: Regarding generate(): allWords should never be changed (generate is called in a loop with the same allWords every time) -- so should it be `in WordSet allWords`? For parameters that shouldn't be changed, use const. So it should be `co

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 10:19:38 UTC, Jacob Carlborg wrote: That looks like it's for internal use. There is a `compare` method in the `TypeInfo` of each type. Will that incur an extra runtime cost compared to __cmp?

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 14:50:01 UTC, Per Nordlöw wrote: Will that incur an extra runtime cost compared to __cmp? I haven't looked at how `__cmp` is implemented but I would guess there's some extra overhead. Need to get type info and then there will be several virtual method calls i

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Jan Hönig via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote: On Tuesday, 21 January 2020 at 18:57:47 UTC, Jan Hönig wrote: I would also like to request a future blog post about animation. I know you have done that in the past, but i am thinking of some animation triggered by user input (say

Re: trying to understand in, inout, and ref...

2020-01-22 Thread mark via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 14:23:53 UTC, Paul Backus wrote: On Wednesday, 22 January 2020 at 10:49:07 UTC, mark wrote: Regarding generate(): allWords should never be changed (generate is called in a loop with the same allWords every time) -- so should it be `in WordSet allWords`? For pa

Re: trying to understand in, inout, and ref...

2020-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 15:26:06 UTC, mark wrote: I've done this but my impression from the docs is that passing slices and associative arrays is already done by reference so these aren't needed? They are pointers passed by value. If you're familiar with C, think of passing struct A

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, January 22, 2020 7:50:01 AM MST Per Nordlöw via Digitalmars-d- learn wrote: > On Wednesday, 22 January 2020 at 10:19:38 UTC, Jacob Carlborg > > wrote: > > That looks like it's for internal use. There is a `compare` > > method in the `TypeInfo` of each type. > > Will that incur an extr

Re: trying to understand in, inout, and ref...

2020-01-22 Thread mark via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 15:33:44 UTC, Adam D. Ruppe wrote: On Wednesday, 22 January 2020 at 15:26:06 UTC, mark wrote: I've done this but my impression from the docs is that passing slices and associative arrays is already done by reference so these aren't needed? They are pointers pa

Re: trying to understand in, inout, and ref...

2020-01-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/22/20 10:33 AM, Adam D. Ruppe wrote: BUT if you change the length of it or reallocate it in any way those changes are NOT seen outside. So with AAs and slices, if you just want to work with existing elements, no need for ref. But if you are going to do any kind of resizing - adding or

weekly news?

2020-01-22 Thread mark via Digitalmars-d-learn
Is there a "D weekly news" I could do an email subscription to? Or at least a way to get notified by email when a new item appears on https://dlang.org/blog/ ?

Re: weekly news?

2020-01-22 Thread Cym13 via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 18:53:49 UTC, mark wrote: Is there a "D weekly news" I could do an email subscription to? Or at least a way to get notified by email when a new item appears on https://dlang.org/blog/ ? There's http://dpldocs.info/this-week-in-d/Blog.html which is unofficial b

Re: Type Inference and Try Blocks

2020-01-22 Thread Henry Claesson via Digitalmars-d-learn
Thank you for the help and input, Adam and Mitacha. I don't know why I thought I must use `try` with every throwable function call instead "bundling" those calls into one `try` block. Not "bundling" defeats one of the benefits of exceptions. Also, `ifThrown` is quite interesting. Again, thank

Re: Lexicographic comparison of arrays (of chars)

2020-01-22 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 15:11:09 UTC, Jacob Carlborg wrote: int opCmp()(const scope typeof(this) that) const @nogc { auto a = this[]; auto b = that[]; return a < b ? -1 : (a > b); } -- /Jacob Carlborg I see. Good to know. Thanks

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 22:12:10 UTC, Antonio Corbi wrote: On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote: Do you still have the Maurer Rose example? I had to look this up. I'd never heard of it before. That being said... Do you think it could fit this kind of exam

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 09:18:51 UTC, Ferhat Kurtulmuş wrote: Another useful tutorial would be something using bindProperty and/or bindPropertyWithClosures. Once I used bindProperty with vala, but I think there is no any example to do it with gtkd. I found a bindProperty() function

Re: Blog Post #0099: A Special Request

2020-01-22 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 15:29:44 UTC, Jan Hönig wrote: Yes something in that manner. I am not familiar with GTK, i have done a few things in QT. I am mainly interested in the information passing. When i make some change to the input || hit enter || hit the button, the scene will change

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 18:53:49 UTC, mark wrote: Is there a "D weekly news" I could do an email subscription to? Or at least a way to get notified by email when a new item appears on https://dlang.org/blog/ ? This Week in D linked above is great for a weekly summary. To D Blog has a

Re: weekly news?

2020-01-22 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2020-01-22 at 22:48 +, Mike Parker via Digitalmars-d-learn wrote: […] > > To D Blog has an RSS feed: > > http://dlang.org/blog/index.php/feed/ > […] This URL doesn't seem to work for me. It redirects to: https://dlang.org/blog/feed/ which gives "file not found" -- Russel.

Re: weekly news?

2020-01-22 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2020-01-22 at 23:08 +, Russel Winder wrote: > On Wed, 2020-01-22 at 22:48 +, Mike Parker via Digitalmars-d- > learn > wrote: > […] > > To D Blog has an RSS feed: > > > > http://dlang.org/blog/index.php/feed/ > > > […] > > This URL doesn't seem to work for me. > > It redirects to

Re: weekly news?

2020-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 23:13:30 UTC, Russel Winder wrote: On Wed, 2020-01-22 at 23:08 +, Russel Winder wrote: which gives "file not found" And yet it works fine as an RSS feed! Several pages on the official blog give code 404 even though they work. Your RSS reader probably jus

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 23:08:09 UTC, Russel Winder wrote: On Wed, 2020-01-22 at 22:48 +, Mike Parker via Digitalmars-d-learn wrote: […] To D Blog has an RSS feed: http://dlang.org/blog/index.php/feed/ […] This URL doesn't seem to work for me. It redirects to: https://dlang.

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 23:23:41 UTC, Adam D. Ruppe wrote: Several pages on the official blog give code 404 even though they work. Your RSS reader probably just isn't checking the code, but the browser is. These should all be fixed on the server... could be hurting seo too. Got any

Re: weekly news?

2020-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 23 January 2020 at 00:52:10 UTC, Mike Parker wrote: Got any examples? No one has reported this to me before and I haven’t encountered a 404 in a while. Almost all of them! Hit F12 to open browser tools and notice the network tab: https://dlang.org/blog/2020/01/08/recent-d-compile

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 00:58:10 UTC, Adam D. Ruppe wrote: On Thursday, 23 January 2020 at 00:52:10 UTC, Mike Parker wrote: Got any examples? No one has reported this to me before and I haven’t encountered a 404 in a while. Almost all of them! Hit F12 to open browser tools and notice

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 06:23:14 UTC, Mike Parker wrote: I'm not getting any 404s in the network tab in Chrome's dev tools. Even on a reload. Most everything is 200, with a handful of 204s. A couple are 302 or 304, and there's one 101. Am I missing something? Apparently so. Firefox

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 06:27:31 UTC, Mike Parker wrote: Apparently so. Firefox shows me a 404 for the URL with the parameter ?relatedposts=1. Must be something in the Wordpress settings triggering the fetch. Maybe with Jetpack. I wonder why Chrome doesn't show it. I'll look into it.