Re: Question on syntax

2016-11-08 Thread ketmar via Digitalmars-d-learn
On Wednesday, 9 November 2016 at 06:28:31 UTC, Jim wrote: What does it mean when a variable name starts with a '.' `.a` --> `::a`.

Re: Question on syntax

2016-11-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/11/2016 7:28 PM, Jim wrote: Hi, I'm a very experienced C++ programmer, looking at a program written in D. D is similar enough to C++ and Java that I have no problem understanding it - except for one thing. I think I may have figured it out, but I want to confirm my understanding. What doe

Question on syntax

2016-11-08 Thread Jim via Digitalmars-d-learn
Hi, I'm a very experienced C++ programmer, looking at a program written in D. D is similar enough to C++ and Java that I have no problem understanding it - except for one thing. I think I may have figured it out, but I want to confirm my understanding. What does it mean when a variable name

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 19:00:15 UTC, Steven Schveighoffer wrote: On 11/8/16 11:48 AM, Konstantin Kutsevalov wrote: On Tuesday, 8 November 2016 at 16:34:04 UTC, Konstantin Kutsevalov wrote: ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[]

Re: typeof(SortedRange) and is operator

2016-11-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 08, 2016 22:33:08 Era Scarecrow via Digitalmars-d-learn wrote: > On Tuesday, 8 November 2016 at 21:14:41 UTC, Jonathan M Davis > > wrote: > > No, as the others have point out, it's not a bug. If anything > > it's a language design flaw that no one has figured out how to > > re

Re: typeof(SortedRange) and is operator

2016-11-08 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 21:14:41 UTC, Jonathan M Davis wrote: No, as the others have point out, it's not a bug. If anything it's a language design flaw that no one has figured out how to resolve yet. The idea of a special struct for code that strips whitespace out, or a function that

Re: typeof(SortedRange) and is operator

2016-11-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 08, 2016 13:22:35 RazvanN via Digitalmars-d-learn wrote: > Sorry, I accidentally posted the above message and I don't know > how to erase it. > The following post is the complete one: > > Given the following code: > > int[] arr = [1, 2, 9, 4, 10, 6]; > auto r= sort(arr); >

Re: ModuleInfo linker error when importing std.stdio and using package.d

2016-11-08 Thread Daniel Kozak via Digitalmars-d-learn
Dne 8.11.2016 v 21:16 Bryce Kellogg via Digitalmars-d-learn napsal(a): ... Finally, a one line package.d: public import my_package.my_module; Change it to: module my_package; public import my_package.my_module; Btw, having class name same as module name is not best way, there could be some

ModuleInfo linker error when importing std.stdio and using package.d

2016-11-08 Thread Bryce Kellogg via Digitalmars-d-learn
Hi everyone, I'm new to D, and I'm trying to get a handle on the correct way to use packages, modules, and importing things. I created a simple example, but I'm getting linker errors in weird situations. I'm hoping to get some insight into why the error is happening and best practices in these

Re: Question about dsfml.system.err

2016-11-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/8/16 11:48 AM, Konstantin Kutsevalov wrote: On Tuesday, 8 November 2016 at 16:34:04 UTC, Konstantin Kutsevalov wrote: ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[] args) { err.open("errors.log", "a"); err.write("test\n");

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 16:34:04 UTC, Konstantin Kutsevalov wrote: ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[] args) { err.open("errors.log", "a"); err.write("test\n"); } ... ``` but as can I see, that hasn't a

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[] args) { err.open("errors.log", "a"); err.write("test\n"); } ... ``` but as can I see, that hasn't any effect for tcplistener module...

Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
I need to see errors from dsfml.system.err, but it doesn't write to terminal as I expected. The general problem is that I cannot listen any port by tcplistener. And listen method is: Status accept(TcpSocket socket) { import dsfml.system.string;

Re: typeof(SortedRange) and is operator

2016-11-08 Thread Ali Çehreli via Digitalmars-d-learn
On 11/08/2016 07:06 AM, RazvanN wrote: >> `SortedRange!(int[], "a> because the arguments to the templates differ i.e. "a> >> Is this a bug? no. is it weird, confusing and unintuitive? yes. > > I think that lambda comparison should be done logically (by that I mean: > what the function actually co

Re: Thread (spawn) for object's method

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 06:40:32 UTC, Basile B. wrote: On Monday, 7 November 2016 at 16:15:44 UTC, Konstantin Kutsevalov wrote: Is there a way to make new thread for class method? E.g. I have some class and I need to run one of them method in new thread. I found wxamples only with fun

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 14:55:53 UTC, Steven Schveighoffer wrote: Indeed, you should not. I'm saying this type of error can explain the observed behavior. The original post I responded to said "I don't know if the double free problem is related to this." -Steve Okay. I thought may

Re: typeof(SortedRange) and is operator

2016-11-08 Thread RazvanN via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 13:59:19 UTC, Nicholas Wilson wrote: On Tuesday, 8 November 2016 at 13:22:35 UTC, RazvanN wrote: Sorry, I accidentally posted the above message and I don't know how to erase it. You can't, this is a mailing list not a forum. The following post is the complete o

Re: how to debug memory errors

2016-11-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/8/16 6:26 AM, bachmeier wrote: On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote: Imagine a resource wrapper like so: class Foo { int *mem; this() { mem = cast(int *)malloc(int.sizeof); } ~this() { .free(mem); } } Now, you have a problem if you do something

Re: typeof(SortedRange) and is operator

2016-11-08 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 13:59:19 UTC, Nicholas Wilson wrote: You can't, this is a mailing list not a forum. > forum.dlang.org

Re: typeof(SortedRange) and is operator

2016-11-08 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 13:22:35 UTC, RazvanN wrote: Sorry, I accidentally posted the above message and I don't know how to erase it. You can't, this is a mailing list not a forum. The following post is the complete one: Given the following code: int[] arr = [1, 2, 9, 4, 10, 6]; auto

Re: typeof(SortedRange) and is operator

2016-11-08 Thread RazvanN via Digitalmars-d-learn
Sorry, I accidentally posted the above message and I don't know how to erase it. The following post is the complete one: Given the following code: int[] arr = [1, 2, 9, 4, 10, 6]; auto r= sort(arr); if(is(typeof(r) == SortedRange!(int[], "aThe program outputs only "second if". I assumed th

typeof(SortedRange) and is operator

2016-11-08 Thread RazvanN via Digitalmars-d-learn
Given the following code: int[] arr = [1, 2, 9, 4, 10, 6]; auto r= sort(arr); if(is(typeof(r) == SortedRange!(int[], "a

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 11:53:37 UTC, Era Scarecrow wrote: On Tuesday, 8 November 2016 at 11:26:55 UTC, bachmeier wrote: Is there a valid use case for something like this? Why would you want to do anything inside ~this with GC memory? If we assume it's a C++ attachment/library/object

Re: how to debug memory errors

2016-11-08 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 11:26:55 UTC, bachmeier wrote: Is there a valid use case for something like this? Why would you want to do anything inside ~this with GC memory? If we assume it's a C++ attachment/library/object using different memory allocation?

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote: Imagine a resource wrapper like so: class Foo { int *mem; this() { mem = cast(int *)malloc(int.sizeof); } ~this() { .free(mem); } } Now, you have a problem if you do something like this: class Bar { Foo foo;

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: how to debug memory errors

2016-11-08 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 07:39:12 UTC, Era Scarecrow wrote: On Tuesday, 8 November 2016 at 06:04:59 UTC, thedeemon wrote: On Tuesday, 8 November 2016 at 05:36:22 UTC, Era Scarecrow wrote: Hmmm.. I had the impression that if something was referenced by another object, then it couldn't b