Re: Inherit from class based on bool value

2018-11-12 Thread Ali Çehreli via Digitalmars-d-learn
On 11/12/2018 11:10 PM, Jamie wrote: > I would like my class to inherit from one of two classes based on a > boolean value known at compile time. Something like this: > > void main() > { > Top!(OPTION.FALSE) top = new Top!(OPTION.FALSE); > } > > enum OPTION > { > FALSE = 0., > TRUE

Inherit from class based on bool value

2018-11-12 Thread Jamie via Digitalmars-d-learn
I would like my class to inherit from one of two classes based on a boolean value known at compile time. Something like this: void main() { Top!(OPTION.FALSE) top = new Top!(OPTION.FALSE); } enum OPTION { FALSE = 0., TRUE = 1. } class One {} class Two {} class Top(OPTION option)

Re: Reading into the output of a long running shellExecute

2018-11-12 Thread helxi via Digitalmars-d-learn
On Saturday, 10 November 2018 at 15:54:07 UTC, JN wrote: On Saturday, 10 November 2018 at 15:05:38 UTC, helxi wrote: Hi. I have not done any multi-threaded programming before. What I basically want is to read into the output of a long shellExecute function each second. In details, I am

Re: How does calling function pointers work?

2018-11-12 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:29:24 UTC, helxi wrote: On Monday, 12 November 2018 at 16:25:13 UTC, Rene Zwanenburg wrote: Idk where you got that syntax from, but there's no syntactic difference between calling normal functions and function pointers: import std.stdio; import

Re: How does calling function pointers work?

2018-11-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:29:24 UTC, helxi wrote: Looks like worker needs an int and spawn(, i * 10) seems to feed it's second arg to worker(?) spawn is a template that takes a function pointer and a variable number of parameters. Both the pointer and the parameters are passed

Re: How does calling function pointers work?

2018-11-12 Thread Alex via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:29:24 UTC, helxi wrote: On Monday, 12 November 2018 at 16:25:13 UTC, Rene Zwanenburg wrote: Idk where you got that syntax from, but there's no syntactic difference between calling normal functions and function pointers: import std.stdio; import

Re: How does calling function pointers work?

2018-11-12 Thread helxi via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:25:13 UTC, Rene Zwanenburg wrote: Idk where you got that syntax from, but there's no syntactic difference between calling normal functions and function pointers: import std.stdio; import std.concurrency; import core.thread; void worker(int firstNumber) {

Re: How does calling function pointers work?

2018-11-12 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:08:28 UTC, helxi wrote: As far as I understand, calling a function pointer with an argument in D looks like: call(, argTofn0, argTofn1, argTofn3); Idk where you got that syntax from, but there's no syntactic difference between calling normal functions

Re: How does calling function pointers work?

2018-11-12 Thread helxi via Digitalmars-d-learn
On Monday, 12 November 2018 at 16:08:28 UTC, helxi wrote: Line 12 was meant to print 1234. Line 13 was meant to print 1234 too, but for a different reason. Correction, it was meant to print 12304. My bad.

How does calling function pointers work?

2018-11-12 Thread helxi via Digitalmars-d-learn
As far as I understand, calling a function pointer with an argument in D looks like: call(, argTofn0, argTofn1, argTofn3); This immediately struck me a very weak syntax to me so I decided to explore my concerns. I made a function pointer that takes an indefinite number of arguments.

Re: Why is stdio ... stdio?

2018-11-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 November 2018 at 10:10:37 UTC, bauss wrote: I just want to say everyone who doesn't use the web-interface has to look at markdown anyway because people still write code in backticks etc. despite no support; even I do that. Me, too. It's easy and unobtrusive. As for actually

Re: Why is stdio ... stdio?

2018-11-12 Thread bauss via Digitalmars-d-learn
On Friday, 9 November 2018 at 06:42:37 UTC, Jonathan M Davis wrote: On Thursday, November 8, 2018 7:25:45 PM MST Neia Neutuladh via Digitalmars- d-learn wrote: It's not a forum. It's a newsgroup that happens to have a web interface. Newsgroups are text-only. So bbcode is out, html is out, but