Re: Ref and class function calls?

2013-04-16 Thread Tofu Ninja
On Tuesday, 16 April 2013 at 21:14:16 UTC, Ali Çehreli wrote: On 04/16/2013 08:44 AM, Tofu Ninja wrote: When that happens, would you expect a and b also become handles to the new object? It could I guess, but it sounds impractical in a system language. The runtime does not maintain a record of

refuses to open file

2013-04-16 Thread rbtwms
I wrote a program and had it working fine, Then made a change so I could change the file name from the command line. Now the progrram refuses to open the file. File efile; writefln("command line %s", args[]); if(args.length == 3) { type = to!int( args[1] ); //

Re: synchronized confusion...

2013-04-16 Thread estewh
Hi Ali, Thanks for the help, looks like synchronized blocks are what I want. I just found your book online the other day too, nice work! Cheers, Stewart

Re: Using regex to "sort" its matches

2013-04-16 Thread Linden Krouse
On Tuesday, 16 April 2013 at 20:00:37 UTC, Dmitry Olshansky wrote: 16-Apr-2013 22:59, Linden Krouse пишет: Is there a way to use the regex library to put matches of different regexs or classes into different slices? For instance, if I had the regular expressions "(?<=#)\w+\b" and "(?<=%)\w+\b",

Re: Ref and class function calls?

2013-04-16 Thread Ali Çehreli
On 04/16/2013 08:44 AM, Tofu Ninja wrote: > On Tuesday, 16 April 2013 at 15:27:10 UTC, Ali Çehreli wrote: >> On 04/16/2013 07:57 AM, Tofu Ninja wrote: >> It would be bad design if a class variable decided to refer to another >> object without the owner of that variable knowing about it. > > > I d

Re: mysql

2013-04-16 Thread gedaiu
On Monday, 15 April 2013 at 19:25:19 UTC, simendsjo wrote: On Monday, 15 April 2013 at 17:34:07 UTC, gedaiu wrote: Hi, Can anyone help me to connect to mysql from D? Thanks! You can use Steve Teales native library. The most up-to-date version is here: https://github.com/rejectedsoftware/my

Re: Using regex to "sort" its matches

2013-04-16 Thread Dmitry Olshansky
16-Apr-2013 22:59, Linden Krouse пишет: Is there a way to use the regex library to put matches of different regexs or classes into different slices? For instance, if I had the regular expressions "(?<=#)\w+\b" and "(?<=%)\w+\b", could I use them to match a string at the same time and stop if the

Using regex to "sort" its matches

2013-04-16 Thread Linden Krouse
Is there a way to use the regex library to put matches of different regexs or classes into different slices? For instance, if I had the regular expressions "(?<=#)\w+\b" and "(?<=%)\w+\b", could I use them to match a string at the same time and stop if the first one is found and keep their resu

Re: Ref and class function calls?

2013-04-16 Thread Tofu Ninja
On Tuesday, 16 April 2013 at 15:23:56 UTC, Regan Heath wrote: I would question always question "fully intended" on a case by case basis: http://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197 I agree that grouping functions together that should be used together, or on th

Strange Segfault using XCB bindings from dsource

2013-04-16 Thread Mpnordladn
Hey all, I'm poking around D, trying to see if it will be worth my while to learn it. I've used XCB in C++ and Python before, and I was delighted to see that D has an XCB binding as well. The problem, however, is in the example program, there is a segfault. Here's the program: http://pastebin.

Re: Ref and class function calls?

2013-04-16 Thread Tofu Ninja
On Tuesday, 16 April 2013 at 15:27:10 UTC, Ali Çehreli wrote: On 04/16/2013 07:57 AM, Tofu Ninja wrote: It would be bad design if a class variable decided to refer to another object without the owner of that variable knowing about it. I don't know, It seems like the caller of the function sh

Re: synchronized confusion...

2013-04-16 Thread Ali Çehreli
On 04/15/2013 11:06 PM, estewh wrote: > Hi All, > > I have this bit of code like this: > > shared bool varInitialized = false; > bool initVar() { > bool ret; > synchronized { ret = varInitialized;} > return ret; > } > > I know there are atomics and I am using them but I am curious abo

Re: Ref and class function calls?

2013-04-16 Thread Ali Çehreli
On 04/16/2013 07:57 AM, Tofu Ninja wrote: > seems like bad design to > have a function that is fully intended to be a class function but not > actually be able to declare it within the class block. It would be bad design if a class variable decided to refer to another object without the owner o

Re: Ref and class function calls?

2013-04-16 Thread Regan Heath
On Tue, 16 Apr 2013 15:57:09 +0100, Tofu Ninja wrote: On Tuesday, 16 April 2013 at 14:33:21 UTC, John Colvin wrote: A member function cannot modify it's own 'this' pointer. However, a free function can do it happily, which when combined with UFCS gives you the same syntax and behaviour: c

Re: Ref and class function calls?

2013-04-16 Thread John Colvin
On Tuesday, 16 April 2013 at 14:57:11 UTC, Tofu Ninja wrote: On Tuesday, 16 April 2013 at 14:33:21 UTC, John Colvin wrote: A member function cannot modify it's own 'this' pointer. However, a free function can do it happily, which when combined with UFCS gives you the same syntax and behaviour:

Re: Ref and class function calls?

2013-04-16 Thread Tofu Ninja
On Tuesday, 16 April 2013 at 14:33:21 UTC, John Colvin wrote: A member function cannot modify it's own 'this' pointer. However, a free function can do it happily, which when combined with UFCS gives you the same syntax and behaviour: class A { //.. } void replace(ref A a) {

Re: Ref and class function calls?

2013-04-16 Thread John Colvin
On Tuesday, 16 April 2013 at 14:33:21 UTC, John Colvin wrote: A member function cannot modify it's own 'this' pointer. However, a free function can do it happily, which when combined with UFCS gives you the same syntax and behaviour: class A { //.. } void replace(ref A a) {

Re: Ref and class function calls?

2013-04-16 Thread John Colvin
On Tuesday, 16 April 2013 at 05:37:48 UTC, Tofu Ninja wrote: I could not think of what to call this because I don't know if it has a name to call it by. Basicly what I was wondering is if their was a way in D to make a class function pass the object being called on by reference. might be eas

Re: Differences between '==' and 'is' beyond null and overloading

2013-04-16 Thread bearophile
Nicholas Smith: (which would have an identical meaning to == as structs are value types and can't be compared any other way). You can redefine struct equality. But, by default, equality tests if object references are equal, Currently the equality is a method of object. Bye, bearophile

Differences between '==' and 'is' beyond null and overloading

2013-04-16 Thread Nicholas Smith
Hello there, I was wondering what the differences are functionally and semantically between '==' and 'is' beyond the two points here and my interpretation below. Functionally: - You must use 'is' to check for a null reference. - 'is' cannot be overloaded, and it assesses reference types based

Re: difference between C++11 rvalue references && and D's proposed rvalue reference?

2013-04-16 Thread Namespace
On Monday, 15 April 2013 at 23:16:57 UTC, Timothee Cour wrote: What would be the difference between C++11's rvalue reference && (see for example http://thbecker.net/articles/rvalue_references/section_03.html) and D's proposed rvalue references (eg http://wiki.dlang.org/DIP36) ? So far I only