Re: Singleton in Action?

2019-02-04 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 3 February 2019 at 18:53:10 UTC, Jacob Carlborg wrote: You don't need to make it so complicated. Here's a simpler example: Excellent. Thank you. Simple is best. private __gshared auto instance_ = new DSingleton; My understanding is that in D, this line effectively says:

Re: Singleton in Action?

2019-02-04 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 3 February 2019 at 15:33:15 UTC, Russel Winder wrote: There is a lot of good stuff (both positive and negative) on Singleton here, but there is also a bit of prejudice and bigotry. Many of the links are worth looking through.

Re: Singleton in Action?

2019-02-03 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 3 February 2019 at 10:28:51 UTC, Alex wrote: Isn't deriving a singleton even eviler as having one? ;) Perhaps this was meant as rhetoric, but I think you may be right. This morning I was Googling "singleton replacement" and someone on another forum said Factory would do the job.

Re: Singleton in Action?

2019-02-03 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 3 February 2019 at 11:17:38 UTC, Jonathan M Davis wrote: I don't recall std.thread ever existing, and std.c.time hasn't been around for a while. Thread is in core.thread, and all of the C bindings for standard C and OS APIs are supposed to be in druntime. So, the equivalent to C's

Re: Singleton in Action?

2019-02-03 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 2 February 2019 at 20:30:15 UTC, Neia Neutuladh wrote: And consider putting the class in its own source file. Yes, by all means. Speaking of which... Considering the nature of a singleton such the one in the top post, I can't see it being possible to use one as a base class

Re: Singleton in Action?

2019-02-03 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 2 February 2019 at 19:40:25 UTC, Andre Pany wrote: https://rosettacode.org/wiki/Singleton#D Do you know if this is for a current version of D? The compiler is choking on the import statements, complaining that it can't read std/thread.d and std/c/time.d

Re: Singleton in Action?

2019-02-03 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 2 February 2019 at 19:40:25 UTC, Andre Pany wrote: I found here an example: https://rosettacode.org/wiki/Singleton#D Kind regards Andre Thanks, Andre. Exactly what I was hoping for.

Re: Singleton in Action?

2019-02-02 Thread Ron Tarrant via Digitalmars-d-learn
Thanks for the replies, fellow programmers. (generic, unisex, PC, and all-encompassing) If I could trouble someone for a complete working example so I have something to study, that would be excellent.

Singleton in Action?

2019-02-02 Thread Ron Tarrant via Digitalmars-d-learn
Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example for how one would actually use a singleton pattern in D? When I

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-02 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 2 January 2019 at 02:09:11 UTC, Mike Parker wrote: It supports D out of the box. Thanks, Mike. Once I downloaded it and dug around, I found the list of supported languages. Odd they don't list these on the about page or wherever.

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 20:43:13 UTC, Adam D. Ruppe wrote: Realistically, if you use Java or C++ highlighting, it will look plenty good enough for D too. Yeah, I was thinking that. I'd imagine it would be missing a few keywords, though. So take a look down my highlight test page for

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 18:32:24 UTC, Andre Pany wrote: If your reason for not choosing WordPress is related to security concerns you could also consider this approach. Not so much a security concern, I'm just looking for the path of least resistance. If that's WP, that's fine, but if

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 18:10:49 UTC, Mike Parker wrote: We're using Mivhak Syntax Highlighter on the D Blog. OOTB, or...? I couldn't find a list of supported languages.

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 18:07:22 UTC, Neia Neutuladh wrote: I believe I use Enlighter for that: https://wordpress.org/plugins/enlighter/ Did you have to massage it? I don't see D in its list of supported languages.

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 15:36:11 UTC, rjframe wrote: I use SilverStripe instead of Wordpress, but if WordPress uses TinyMCE you can use the codesample plugin[0] with PrismJS[1], which does support D (though I don't know if it actively gets updates). [0]:

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
And while we're on the subject, a couple of related questions: 1) I'm currently using AgilityHoster which gives me a free site and $18/year domain registration. Any better deals out there without sacrificing UX? 2) Anyone have experience with Github Pages? 3) Or if anyone cares to share

D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Ron Tarrant via Digitalmars-d-learn
I've found a ton of syntax highlighter plugins for WordPress, but none that admit to supporting D. Anyone know of one? Or, short of that, perhaps a different site build/management tool (read: not WordPress) with decent D syntax highlighting... Or, one that can be adapted without rolling my

Re: How do you get mouse movement info in GtkD?

2018-12-27 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 30 January 2016 at 06:43:11 UTC, Enjoys Math wrote: There's also one that takes an Event param, but there's no obvious way to get the x/y info from that so I'll just use this lower level one which seems to work. I know this post is old, but a search I did the other day brought

Re: Mysteries of the Underscore

2018-12-24 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 24 December 2018 at 11:30:31 UTC, Johan Engelen wrote: The underscore is just an identifier but nothing special, it could be any valid identifier like "ldkhfksdkdsg". -Johan Thanks, Johan. In a way, I was hoping it was some kind of underscore magic. Now my brain hurts.

Mysteries of the Underscore

2018-12-24 Thread Ron Tarrant via Digitalmars-d-learn
I found a mention that in the definition of a delegate, a function parameter and its type could be replaced by an underscore: myTestRig.addOnDestroy(delegate void(Widget w) { quitApp(); } ); became: myTestRig.addOnDestroy(delegate void(_) { quitApp(); } ); I was trying to find some further

Re: Where do I learn to use GtkD

2018-12-23 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 30 October 2018 at 04:22:21 UTC, helxi wrote: On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the

Re: Some Fundamental Paradigm Questions

2018-12-22 Thread Ron Tarrant via Digitalmars-d-learn
Thanks, Dennis and H.S. for the well-thought-out and comprehensive replies.

Some Fundamental Paradigm Questions

2018-12-21 Thread Ron Tarrant via Digitalmars-d-learn
Reading through an abstract of what makes the D language tick, I found terms like mixins and templates, concepts I haven't run across in the other languages I've learned. I have a basic understanding of WHAT mixins and templates are, but what I don't understand is WHY they're part of the

Re: Doubt about this book: The D Programming Language

2018-12-18 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 18 December 2018 at 01:16:54 UTC, Adam D Ruppe wrote: They're obvious. Stuff like doubled ; at the end of lines in code samples, or curly quotes when they should be straight. (They are the result of me fighting Microsoft Word and the review process with the publisher.) A few

Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 17 December 2018 at 15:32:37 UTC, Adam D. Ruppe wrote: There's a few minor changes in mine (the D Cookbook one), and a few typos in the book I didn't catch until too late that mean some examples won't literally compile anyway, but they are all quite small. Are these typos

Re: imports in a Separate File?

2018-12-11 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 11 December 2018 at 15:39:18 UTC, Steven Schveighoffer wrote: Use public imports in your header file. This will pretend that the symbols imported reside in the module itself. i.e. inside importedStuff.d: public { // 120 import statements } -Steve Thanks, Steve. Works like

imports in a Separate File?

2018-12-11 Thread Ron Tarrant via Digitalmars-d-learn
I ran across a code example (https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/TestWindow/TestWindow.d) in which the first ~120 lines are mostly import statements. And it got me wondering... I tried to off-load a bunch of imports into a pseudo-header file — importedStuff.d — and

Re: Imports and Subfolders and Links (Oh, My!)

2018-12-09 Thread Ron Tarrant via Digitalmars-d-learn
Thanks everyone.

Re: Imports and Subfolders and Links (Oh, My!)

2018-12-07 Thread Ron Tarrant via Digitalmars-d-learn
So, the upshot of it all seems to be that the -i's have it.

Re: Imports and Subfolders and Links (Oh, My!)

2018-12-07 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 7 December 2018 at 16:43:02 UTC, Adam D. Ruppe wrote: That's wrong: the import name and the module name should always match, in full, including all the dot parts. So if you "import app.modulename;", the other file must have "module app.modulename;" Okay. I guess the instructions

Imports and Subfolders and Links (Oh, My!)

2018-12-07 Thread Ron Tarrant via Digitalmars-d-learn
Trying to wrap my brain around imports, etc. In various places around the Internet, I've read that if I have modules in a subfolder/subdirectory, my import statement would look like this: import subfolder.ModuleName; And in the module files, the first statement is: module ModuleName;

<    1   2   3   4