Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn
On Friday, 25 January 2019 at 16:14:56 UTC, Kagamin wrote: also http://blogs.microsoft.co.il/pavely/2009/07/23/changing-console-fonts/ That's so much code than next code! / extern(C) int setlocale(int,char*); static this() { import core.stdc.wchar_;

Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn
On Friday, 25 January 2019 at 15:05:50 UTC, John Chapman wrote: On Friday, 25 January 2019 at 14:23:15 UTC, FrankLike wrote: I need to set the font by the code now, because I need to do the installer, can't let this installer set the properties on each computer? SetCurrentConsoleFontEx perhap

Re: How is this code supposed to work?

2019-01-25 Thread Neia Neutuladh via Digitalmars-d-learn
On Fri, 25 Jan 2019 19:14:51 -0500, Steven Schveighoffer wrote: > Interestingly, It's not possible to do the second form, so it's a bit > curious why we don't just drop the requirements for nested > parentheses... The error messages there are really hideous, too: template Just(alias s) { alias Ju

Re: How is this code supposed to work?

2019-01-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/25/19 11:19 AM, Neia Neutuladh wrote: On Fri, 25 Jan 2019 09:34:47 +, AndreasDavour wrote: auto point3 = getResponse!Point!int("What's the point? "); This could be: getResponse!(Point!int) or: (getResponse!Point)!int D requires this to be disambiguated at the parsing

Re: code-d and serve-d fail to load after vs update

2019-01-25 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 25 January 2019 at 19:47:59 UTC, greatsam4sure wrote: Just update vs code and since then I cannot use code-d and serve-d. below is dmd 2.084 complains. I will appreciate any help Installing into C:\Users\Greatsam\AppData\Roaming\code-d\bin git clone --recursive https://github.com/

Re: Converting a type to a char

2019-01-25 Thread Paul Backus via Digitalmars-d-learn
On Friday, 25 January 2019 at 15:53:10 UTC, Thomas Gregory wrote: I would like to check that a char (unknown at compile time) matches a particular type but I would like to do so without if statements or a hash map as I would like it to be as fast as possible. Ideally I would choose something

Re: Syntax for Pointer to Class

2019-01-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/01/2019 9:52 AM, Q. Schroll wrote:     C* ptr = &[ new C(...) ][0]; C* ptr = [ new C(...) ].ptr; Should work.

Re: Syntax for Pointer to Class

2019-01-25 Thread Q. Schroll via Digitalmars-d-learn
On Friday, 25 January 2019 at 20:31:29 UTC, H. S. Teoh wrote: On Fri, Jan 25, 2019 at 08:12:33PM +, Q. Schroll via Digitalmars-d-learn wrote: Say I have a class C and I want a pointer to a C handle. Note that taking the address of `C` will actually give you a pointer to the reference, not

Re: Syntax for Pointer to Class

2019-01-25 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 25, 2019 at 08:12:33PM +, Q. Schroll via Digitalmars-d-learn wrote: > Say I have a class C and I want a pointer to a C handle. > > I tried the following pieces of syntax: > > C* obj = new C(); // gives me a C > C* obj = new C*(); // gives me a C** > C* obj = C*(); // refuse

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 16:19:38 UTC, Neia Neutuladh wrote: On Fri, 25 Jan 2019 09:34:47 +, AndreasDavour wrote: auto point3 = getResponse!Point!int("What's the point? "); This could be: getResponse!(Point!int) or: (getResponse!Point)!int D requires this to be disambig

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 14:25:33 UTC, AndreasDavour wrote: https://run.dlang.io/is/a4oDFZ is an example of how this looks. I feel like there's more to these templates than meet the eye. To clarify. I really don't understand the thinking behind these templates, and wonder a bit about wh

Syntax for Pointer to Class

2019-01-25 Thread Q. Schroll via Digitalmars-d-learn
Say I have a class C and I want a pointer to a C handle. I tried the following pieces of syntax: C* obj = new C(); // gives me a C C* obj = new C*(); // gives me a C** C* obj = C*(); // refuses to compile Is it even possible? This sounds so newbie... I know it's fairly simple with structs

Re: Alternative to Interfaces

2019-01-25 Thread Paul Backus via Digitalmars-d-learn
On Friday, 25 January 2019 at 19:34:02 UTC, Sebastien Alaiwan wrote: On Saturday, 19 January 2019 at 09:24:21 UTC, Kagamin wrote: On Friday, 18 January 2019 at 18:48:46 UTC, Jonathan M Davis wrote: Yes, but some D features will use the GC They would like to allocate, but they don't know nor c

code-d and serve-d fail to load after vs update

2019-01-25 Thread greatsam4sure via Digitalmars-d-learn
Just update vs code and since then I cannot use code-d and serve-d. below is dmd 2.084 complains. I will appreciate any help Installing into C:\Users\Greatsam\AppData\Roaming\code-d\bin git clone --recursive https://github.com/Pure-D/serve-d.git serve-d Cloning into 'serve-d'... dub upgrad

Re: Alternative to Interfaces

2019-01-25 Thread Sebastien Alaiwan via Digitalmars-d-learn
On Saturday, 19 January 2019 at 09:24:21 UTC, Kagamin wrote: On Friday, 18 January 2019 at 18:48:46 UTC, Jonathan M Davis wrote: Yes, but some D features will use the GC They would like to allocate, but they don't know nor care where it's allocated from, if the developer uses custom memory m

Re: How is this code supposed to work?

2019-01-25 Thread Neia Neutuladh via Digitalmars-d-learn
On Fri, 25 Jan 2019 09:34:47 +, AndreasDavour wrote: >auto point3 = getResponse!Point!int("What's the point? "); This could be: getResponse!(Point!int) or: (getResponse!Point)!int D requires this to be disambiguated at the parsing stage, before the compiler works out what getR

Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread Kagamin via Digitalmars-d-learn
also http://blogs.microsoft.co.il/pavely/2009/07/23/changing-console-fonts/

Converting a type to a char

2019-01-25 Thread Thomas Gregory via Digitalmars-d-learn
I would like to check that a char (unknown at compile time) matches a particular type but I would like to do so without if statements or a hash map as I would like it to be as fast as possible. Ideally I would choose something like this: enum typeIndex{ byte = 0, ubyte, short, ushort, int, ui

Re: GC options

2019-01-25 Thread Alex via Digitalmars-d-learn
On Friday, 25 January 2019 at 13:39:53 UTC, Radu wrote: On Friday, 25 January 2019 at 13:33:25 UTC, Alex wrote: I'm experimenting with GC, and reading https://dlang.org/spec/garbage.html#gc_config There is an option setting possible via ´´´ extern(C) __gshared string[] rt_options = [ "gcopt=gc:

Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread John Chapman via Digitalmars-d-learn
On Friday, 25 January 2019 at 14:23:15 UTC, FrankLike wrote: I need to set the font by the code now, because I need to do the installer, can't let this installer set the properties on each computer? SetCurrentConsoleFontEx perhaps? https://docs.microsoft.com/en-us/windows/console/setcurrentco

Re: Is there something special required to use Appender.clear

2019-01-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/25/19 3:20 AM, FeepingCreature wrote: On Thursday, 24 January 2019 at 17:49:34 UTC, Ali Çehreli wrote: On 01/24/2019 04:35 AM, FeepingCreature wrote: > On Tuesday, 27 March 2018 at 12:31:05 UTC, Simen Kjærås wrote: >> On Tuesday, 27 March 2018 at 12:17:58 UTC, Ellie Harper wrote: >>> Sorry

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 12:11:51 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 12:09:34 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: [...] auto point3 = getResponse!(Point!int)("Wha

Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread FrankLike via Digitalmars-d-learn
On Friday, 25 January 2019 at 08:41:23 UTC, Kagamin wrote: Create a shortcut to cmd.exe and edit its properties. The console window itself has a system menu for this too. I known that. I need to set the font by the code now, because I need to do the installer, can't let this installer set the

Re: GC options

2019-01-25 Thread Radu via Digitalmars-d-learn
On Friday, 25 January 2019 at 13:33:25 UTC, Alex wrote: I'm experimenting with GC, and reading https://dlang.org/spec/garbage.html#gc_config There is an option setting possible via ´´´ extern(C) __gshared string[] rt_options = [ "gcopt=gc:precise" ]; //gc:conservative|precise|manual ´´´ conser

GC options

2019-01-25 Thread Alex via Digitalmars-d-learn
I'm experimenting with GC, and reading https://dlang.org/spec/garbage.html#gc_config There is an option setting possible via ´´´ extern(C) __gshared string[] rt_options = [ "gcopt=gc:precise" ]; //gc:conservative|precise|manual ´´´ conservative and manual seem to work, while setting gc to precis

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 12:09:34 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: [...] auto point3 = getResponse!(Point!int)("What's the point? "); [...] I thought about that option, if it wa

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: How am I supposed to use that??   auto point3 = getResponse!Point!int("What's the point? "); auto point3 = getResponse!(Point!int)("What's the point? ");   auto point4 = getRes

Re: How is this code supposed to work?

2019-01-25 Thread rikki cattermole via Digitalmars-d-learn
On 25/01/2019 10:34 PM, AndreasDavour wrote: How am I supposed to use that??   auto point3 = getResponse!Point!int("What's the point? "); auto point3 = getResponse!(Point!int)("What's the point? ");   auto point4 = getResponse!Point!int("What's the point? ");   writeln("Distance: ", point

How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
I'm reading the "Programming D" here: http://ddili.org/ders/d.en/templates.html and am a bit confused by the section on templates. with a struct template like this: struct Point(T) { T x; T y; T distanceTo(Point that) const { immutable real xDistance = x - that.x; immutable real yD

Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-25 Thread Kagamin via Digitalmars-d-learn
Create a shortcut to cmd.exe and edit its properties. The console window itself has a system menu for this too.

Re: Is there something special required to use Appender.clear

2019-01-25 Thread FeepingCreature via Digitalmars-d-learn
On Thursday, 24 January 2019 at 17:49:34 UTC, Ali Çehreli wrote: On 01/24/2019 04:35 AM, FeepingCreature wrote: > On Tuesday, 27 March 2018 at 12:31:05 UTC, Simen Kjærås wrote: >> On Tuesday, 27 March 2018 at 12:17:58 UTC, Ellie Harper wrote: >>> Sorry if this is a stupid question, but is there s

Re: Am I missing with ref in this code?

2019-01-25 Thread Suliman via Digitalmars-d-learn
Do I need in my code `ref`s ? https://run.dlang.io/is/8dtkC7 Or if vibed doing copy under the hood `ref`s useless?