Re: Meson build system user new to D.

2019-05-09 Thread Mike Brockus via Digitalmars-d-learn
On Wednesday, 8 May 2019 at 10:28:26 UTC, Andre Pany wrote: On Monday, 6 May 2019 at 19:52:23 UTC, Mike Brockus wrote: Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good

Re: Meson build system user new to D.

2019-05-08 Thread Firstname Lastname via Digitalmars-d-learn
On Monday, 6 May 2019 at 19:52:23 UTC, Mike Brockus wrote: Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good practices I can follow and or anything like that also some

Re: Meson build system user new to D.

2019-05-08 Thread Andre Pany via Digitalmars-d-learn
On Monday, 6 May 2019 at 19:52:23 UTC, Mike Brockus wrote: Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good practices I can follow and or anything like that also some

Re: Meson build system user new to D.

2019-05-07 Thread Petar via Digitalmars-d-learn
On Monday, 6 May 2019 at 19:52:23 UTC, Mike Brockus wrote: Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good practices I can follow and or anything like that also some

Meson build system user new to D.

2019-05-06 Thread Mike Brockus via Digitalmars-d-learn
Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good practices I can follow and or anything like that also some resources would be helpful thanks. (:

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-08 Thread Picaud Vincent via Digitalmars-d-learn
Hi Basile, Thank you for your code, it allowed me to grasp a little bit more about how to do things in D. Vincent

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Basile B. via Digitalmars-d-learn
On Monday, 7 November 2016 at 23:03:32 UTC, Picaud Vincent wrote: I need: 1/ a way to detect compile-time constant vs "dynamic" values /** * Indicates if something is a value known at compile time. * * Params: * V = The value to test. * T = Optional, the expected value type.

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Picaud Vincent via Digitalmars-d-learn
On Monday, 7 November 2016 at 23:07:27 UTC, Picaud Vincent wrote: typo... auto capacity = max(0,(size_-1)*stride_+1); To be more correct I have something like: alias IntergralConstant!(int,0) Zero_c; alias IntergralConstant!(int,1) One_c; auto capacity =

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Picaud Vincent via Digitalmars-d-learn
On Monday, 7 November 2016 at 22:18:56 UTC, Jerry wrote: On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent wrote: static if ( isIntegralConstant!(typeof(required_capacity()) ) { } else { } } Premature post send by error sorry Well something like: static if (

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Jerry via Digitalmars-d-learn
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent wrote: static if ( isIntegralConstant!(typeof(required_capacity()) ) { } else { } } Premature post send by error sorry Well something like: static if ( isIntegralConstant!(typeof(required_capacity()) )

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Picaud Vincent via Digitalmars-d-learn
On Monday, 7 November 2016 at 21:23:37 UTC, Picaud Vincent wrote: On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote: On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote: template isIntegralConstant(ANY) { enum bool

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Picaud Vincent via Digitalmars-d-learn
On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote: On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote: template isIntegralConstant(ANY) { enum bool isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant"; } A bit more elegant way of doing that would be: enum

Re: New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Jerry via Digitalmars-d-learn
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote: template isIntegralConstant(ANY) { enum bool isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant"; } A bit more elegant way of doing that would be: enum isIntegralConstant(T) = is(T : IntegralConstant!U, U...);

New to D and mimicking C++ : how to implement std::integral_constant<>?

2016-11-07 Thread Picaud Vincent via Digitalmars-d-learn
Hi all, I have ~15y of C++ and now I want to test D, because it seems really intersting and "cleaner" than C++. As an exercice I m trying to implement something equivalent to the C++ std::integral_constant in D. In D: struct IntegralConstant(T, T VALUE) { ... } But I do not

Re: New to D

2016-10-27 Thread Era Scarecrow via Digitalmars-d-learn
On Thursday, 27 October 2016 at 13:43:26 UTC, Steven Schveighoffer wrote: It depends on the size of the file and the expectation of duplicate words. I'm assuming the number of words is limited, so you are going to allocate far less data by duping on demand. In addition, you may incur penalties

Re: New to D

2016-10-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/27/16 2:40 AM, Era Scarecrow wrote: On Tuesday, 25 October 2016 at 14:40:17 UTC, Steven Schveighoffer wrote: I will note, that in addition to the other comments, this is going to result in corruption. Simply put, the buffer that 'line' uses is reused for each line. So the string data used

Re: New to D

2016-10-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/22/16 1:25 AM, Mark wrote: Hello, Im a 3rd year Comp Sci student in Edmonton Alberta, Canada. Ive learned how to use C, and dabbled in C++ in school. Im also in a Oop course using Java. I picked up the book The D Programming Language by Alexrei Alexandrescu a few years ago. Lately Im

Re: New to D

2016-10-23 Thread Daniel Kozak via Digitalmars-d-learn
Dne 22.10.2016 v 11:04 Mike Parker via Digitalmars-d-learn napsal(a): On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote: uint[string] dictionary; should be uint[size_t] dictionary; because size_t is 32bit on x86 system and 64bit on x86_64 and you are trying to put array length

Re: New to D

2016-10-22 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote: uint[string] dictionary; should be uint[size_t] dictionary; because size_t is 32bit on x86 system and 64bit on x86_64 and you are trying to put array length to dictionary which is size_t I believe you meant: size_t[string];

Re: New to D

2016-10-22 Thread Daniel Kozak via Digitalmars-d-learn
Dne 22.10.2016 v 07:41 Mark via Digitalmars-d-learn napsal(a): Thanks for the fast reply. That did work. But now the error is on the line: dictionary[word] = newId; I changed the value to 10, still errors. ?? everything else is as before. thanks. uint[string] dictionary; should

Re: New to D

2016-10-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 October 2016 at 05:41:34 UTC, Mark wrote: Thanks for the fast reply. That did work. But now the error is on the line: dictionary[word] = newId; I changed the value to 10, still errors. ?? everything else is as before. thanks. For simple single file experiments

Re: New to D

2016-10-21 Thread Mark via Digitalmars-d-learn
Thanks for the fast reply. That did work. But now the error is on the line: dictionary[word] = newId; I changed the value to 10, still errors. ?? everything else is as before. thanks.

Re: New to D

2016-10-21 Thread rikki cattermole via Digitalmars-d-learn
On 22/10/2016 6:25 PM, Mark wrote: Hello, Im a 3rd year Comp Sci student in Edmonton Alberta, Canada. Ive learned how to use C, and dabbled in C++ in school. Im also in a Oop course using Java. I picked up the book The D Programming Language by Alexrei Alexandrescu a few years ago. Lately Im

New to D

2016-10-21 Thread Mark via Digitalmars-d-learn
Hello, Im a 3rd year Comp Sci student in Edmonton Alberta, Canada. Ive learned how to use C, and dabbled in C++ in school. Im also in a Oop course using Java. I picked up the book The D Programming Language by Alexrei Alexandrescu a few years ago. Lately Im really wanting to get into D, as

Re: New to D - playing with Thread and false Sharing

2015-08-22 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2015-08-21 at 01:22 +, Nicholas Wilson via Digitalmars-d -learn wrote: […] Keep in mind java may be using green threads as opposed to kernel threads. The equivalent in D is a Fiber. I believe Java itself hasn't used green threads in an awful long time: Threads are mapped to

Re: New to D - playing with Thread and false Sharing

2015-08-22 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2015-08-20 at 20:01 +, tony288 via Digitalmars-d-learn wrote: […] Now what I would like to know, how would I make this code more efficient? Which is basically the aim I'm trying to achieve. Any pointers would be really help full. Should I use concurrency/parallelism etc..? I

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread Kagamin via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote: So I wrong some code. But it seems the time to process a shared struct shared long is always the same. Regardless of adding paddings. Should it be different?

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread tony288 via Digitalmars-d-learn
On Friday, 21 August 2015 at 12:45:52 UTC, Kagamin wrote: On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote: So I wrong some code. But it seems the time to process a shared struct shared long is always the same. Regardless of adding paddings. Should it be different? Hi all

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 02:44:50 UTC, Rikki Cattermole wrote: On 8/21/2015 3:37 AM, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Note:

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/21/2015 3:37 AM, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Note: shared is __gshared but with mutex's added.

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 20 August 2015 at 20:01:58 UTC, tony288 wrote: On Thursday, 20 August 2015 at 15:37:35 UTC, Dejan Lekic wrote: [...] Thanks, I changed the code and the previous one was already using shared. import std.stdio; import core.time; import core.thread; [...] Keep in mind java may

New to D - playing with Thread and false Sharing

2015-08-20 Thread tony288 via Digitalmars-d-learn
with both to 1 understand more D and see the results of false sharing. So I wrong some code. But it seems the time to process a shared struct shared long is always the same. Regardless of adding paddings. My thoughts is that as I'm new to D. That it can only be my fault and not doing things

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Dejan Lekic via Digitalmars-d-learn
Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not).

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread tony288 via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:37:35 UTC, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Thanks, I changed the code and the previous one was

Re: Conflicts with Import error - New to D, trying to build a new project

2015-01-25 Thread Gan via Digitalmars-d-learn
Game.Game.Game conflicts with import Game.Game.Game at source/Game/Game.d(2) (spacecraft) I figure it's because I did imports wrong or something. I'm still very new to D. Can anyone help? The problem is with having three constructs with the same name: package, module, and class. I would use lowercase

Re: Conflicts with Import error - New to D, trying to build a new project

2015-01-25 Thread Ali Çehreli via Digitalmars-d-learn
imports wrong or something. I'm still very new to D. Can anyone help? The problem is with having three constructs with the same name: package, module, and class. I would use lowercase for package, and module names, and differentiate between the package and the module: .../source/foogame/game.d

Conflicts with Import error - New to D, trying to build a new project

2015-01-25 Thread Gan via Digitalmars-d-learn
still very new to D. Can anyone help?

Re: New to D: parse a binary file

2011-02-06 Thread Jesse Phillips
scottrick Wrote: T[] rawRead(T)(T[] buffer); I understand that T is generic type, but I am not sure of the meaning of the (T) after the method name. That T is defining the symbol to represent the generic type. It can have more than one and D provides other things like aliases... Another

Re: New to D: parse a binary file

2011-02-06 Thread scottrick
Thanks, your post was very helpful. Two more questions (probably related): Where is the function 'format' defined? Also, what is that 'unittest' block? It compiles fine as is, but if I refer to format outside of unittest, it will not compile. Also, if I compile and run your example, it

Re: New to D: parse a binary file

2011-02-06 Thread bearophile
scottrick: Where is the function 'format' defined? You need to add at the top of the module: import std.conv: format; Or: import std.conv; Also, what is that 'unittest' block? It compiles fine as is, but if I refer to format outside of unittest, it will not compile. Also, if I compile

Re: New to D: parse a binary file

2011-02-06 Thread Mafi
Am 06.02.2011 19:38, schrieb Jesse Phillips: scottrick Wrote: T[] rawRead(T)(T[] buffer); I understand that T is generic type, but I am not sure of the meaning of the (T) after the method name. That T is defining the symbol to represent the generic type. It can have more than one and D

New to D: parse a binary file

2011-02-05 Thread scottrick
Hi, I am new to D. I am trying to write a binary file parser for a project of mine and I thought it would be fun to try and learn a new language at the same time. So I chose D! :D I have been struggling however and have not been able to find very many good examples, so I am posting

Re: New to D: parse a binary file

2011-02-05 Thread spir
On 02/05/2011 06:26 PM, scottrick wrote: Hi, I am new to D. I am trying to write a binary file parser for a project of mine and I thought it would be fun to try and learn a new language at the same time. So I chose D! :D I have been struggling however and have not been able to find very

Re: New to D: parse a binary file

2011-02-05 Thread bearophile
spir: Out[] map (In, Out) (In[] source, Out delegate (In) f) { // (0) ... string hex (uint i) { return format(0x%03X, i); } uint[] decs = [1, 3, 9, 27, 81, 243, 729]; auto hexes = map!(uint,string)(decs, hex); ... (0) The func must be declared as delegate (instead of

Re: New to D: Building multiple files

2009-04-01 Thread Jesse Phillips
On Sun, 29 Mar 2009 17:43:51 +0200, torhu wrote: On 29.03.2009 17:04, chris wrote: Alright so I'm not too familiar with building D or having to build multiple files from the command line (Java usually takes care of that). Basically I have a small game I put together as a test project. Here's

Re: New to D: Building multiple files

2009-03-29 Thread Trass3r
chris schrieb: The file clo.d is in module clo; while GameState is in module slo.common; you probably mean it is in package clo. Also thanks for the link, I was going to ask about .conf files. You're welcome.

Re: New to D: Building multiple files

2009-03-29 Thread Mike Parker
chris wrote: Alright so I'm not too familiar with building D or having to build multiple files from the command line (Java usually takes care of that). Basically I have a small game I put together as a test project. Here's the structure: clo/clo.d clo/Main.d clo/common/GameState.d clo is in

Re: New to D: Building multiple files

2009-03-29 Thread chris
Yea I just realized it follows the directory structure and not some arbitrary system I made up. Thanks for the .config info, I was just putting one together of similar structure, this'll absolutely help. Much appreciated