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:
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.
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.
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
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
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
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.
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.
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
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.
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
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
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.
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.
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]:
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
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
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
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.
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
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
Thanks, Dennis and H.S. for the well-thought-out and
comprehensive replies.
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
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
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
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
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
Thanks everyone.
So, the upshot of it all seems to be that the -i's have it.
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
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;
301 - 331 of 331 matches
Mail list logo