Re: IDE with renaming possibility

2011-11-07 Thread Jabba Laci
I use Emacs and replace regexp. Hi, I'm looking for a solution that replaces just in the scope. A regexp replace would change all occurrences :( Also, if you have a function that is implemented in a module and you call it in another file, it should be renamed everywhere. Laszlo

Re: My new least favorite one-liner...

2011-11-07 Thread Regan Heath
On Sun, 06 Nov 2011 04:39:28 -, Jude Young 10equa...@gmail.com wrote: Nice. Exactly what I was looking for. I knew I was missing something tiny. Now I just need to figure out why that works and I can say I've learned something! Thanks guys, Jude On Sat, Nov 5, 2011 at 5:38 AM, bearophile

Re: odd use of preprocessor

2011-11-07 Thread Alex Rønne Petersen
On 06-11-2011 21:36, Ellery Newcomer wrote: On 11/06/2011 01:50 PM, Alex Rønne Petersen wrote: On 06-11-2011 20:43, Ellery Newcomer wrote: poking about in elfutils headers, I've come across the following idiom several times /* Error values. */ enum { DW_TAG_invalid = 0 #define

Re: Is this actually valid code?

2011-11-07 Thread Trass3r
class Foo { @property void test(int) {} @property int test() { return 1; } } class Bar : Foo { alias super.test test; override @property void test(int) {} void bartest() { auto x = test; } } And it actually works! Is this a documented feature?

Re: Is this actually valid code?

2011-11-07 Thread Steven Schveighoffer
On Sun, 06 Nov 2011 23:10:57 -0500, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I've had a simple problem where I've only wanted to override a setter from a base class: class Foo { @property void test(int) {} @property int test() { return 1; } } class Bar : Foo { override

Re: My new least favorite one-liner...

2011-11-07 Thread Dejan Lekic
Regan Heath wrote: You've also got std.ascii.digits which is 0123456789 and std.string.digits which is an alias of it, so you can say: import std.ascii; (or std.string) int x = 5; char c = std.ascii.digits[x]; I used similar solution to bearophile's before. I must admit i did not know

Re: Is this actually valid code?

2011-11-07 Thread Andrej Mitrovic
Cool stuff, thanks guys. This thing kicks some serious C++ ass. ^^

Re: Is this actually valid code?

2011-11-07 Thread Trass3r
Cool stuff, thanks guys. This thing kicks some serious C++ ass. ^^ How? You can use using in C++ to do the same.

Re: Is this actually valid code?

2011-11-07 Thread Andrej Mitrovic
On 11/7/11, Trass3r u...@known.com wrote: Cool stuff, thanks guys. This thing kicks some serious C++ ass. ^^ How? You can use using in C++ to do the same. My bad. I was a bit over-excited there. :p

Re: Expected or Bug? struct range unmodified after foreach

2011-11-07 Thread Timon Gehr
On 11/07/2011 12:26 AM, Jesse Phillips wrote: I'm sure if this was changed there would be other interesting behavior, such as arrays being consumed. And suggestions other than for(S s; !s.empty, s.popFront())... Example: void main() { S s; foreach(i; s) {

extends and implements

2011-11-07 Thread %u
Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass implements AnInterface { ... } Will they ever add

Re: extends and implements

2011-11-07 Thread Steven Schveighoffer
On Mon, 07 Nov 2011 13:22:07 -0500, %u n...@devnull.com wrote: Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends

Re: extends and implements

2011-11-07 Thread Andrej Mitrovic
If you need some kind of textual information on whether its a class or an interface, you can name your interfaces with an I. interface IShape { } abstract class Drawable { } class Rectangle : IShape, Drawable {} It's pretty common in other languages, I've seen it used in D as well.

Re: extends and implements

2011-11-07 Thread Alex Rønne Petersen
On 07-11-2011 19:22, %u wrote: Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass implements

Re: extends and implements

2011-11-07 Thread Justin Whear
You can do this and/or use the convention of extends first, implements second: class Rectangle : Drawable, IShape, IOtherInterface {} If you're really concerned about clarity, use comments: class Rectangle : /* extends */ Drawable, /* implements */ IShape { } Andrej Mitrovic

Re: extends and implements

2011-11-07 Thread Trass3r
You can do this and/or use the convention of extends first, implements second: class Rectangle : Drawable, IShape, IOtherInterface {} It's not a convention, the spec demands that. http://d-programming-language.org/class.html If you're really concerned about clarity, use comments: class

Re: Stop TypeTuple as template parameter from expanding

2011-11-07 Thread Timon Gehr
On 11/05/2011 03:23 PM, bearophile wrote: Tobias Pankrath: I do like it, just it would be nice to have an alternative in phobos, iff there is no other way I am not aware of. Type tuples (that are allowed to contain more than just types) aren't Phobos constructs, they are built-in in the

Re: extends and implements

2011-11-07 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Mon, 07 Nov 2011 13:22:07 -0500, %u n...@devnull.com wrote: In order for such a humongously code-breaking change to occur, there would have to be dire reasons why this was necessary. Because you liked Java is not a

Re: extends and implements

2011-11-07 Thread Steven Schveighoffer
On Mon, 07 Nov 2011 14:07:56 -0500, %u n...@.com wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Mon, 07 Nov 2011 13:22:07 -0500, %u n...@devnull.com wrote: In order for such a humongously code-breaking change to occur, there would have to be dire reasons why

Re: extends and implements

2011-11-07 Thread Dejan Lekic
Andrej Mitrovic wrote: class Rectangle : IShape, Drawable {} It's pretty common in other languages, I've seen it used in D as well. I used the same naming convention for interfaces until I saw this presentation: http://www.infoq.com/presentations/It-Is-Possible-to-Do-OOP- in-Java (jump to

Any othe options for inserting into associative array?

2011-11-07 Thread Jesse Phillips
Came across this when trying to get Juno to work. Is there a good workaround for it? http://d.puremagic.com/issues/show_bug.cgi?id=6906 test.d(6): Error: function test.S.opAssign (int i) is not callable using argument types (S) void main() { S[string] ss; S s;

Re: Any othe options for inserting into associative array?

2011-11-07 Thread Richard Webb
On 07/11/2011 20:27, Jesse Phillips wrote: Came across this when trying to get Juno to work. Is there a good workaround for it? http://d.puremagic.com/issues/show_bug.cgi?id=6906 test.d(6): Error: function test.S.opAssign (int i) is not callable using argument types (S) void main() {

Implicit case fallthrough warns only when a statement is in place

2011-11-07 Thread Andrej Mitrovic
import std.stdio; void main() { int y; switch (y) { case 0: { // no warning here on fallthrough } case 1: { goto case 2; } case 2: { writeln(2); break; }

Re: Implicit case fallthrough warns only when a statement is in place

2011-11-07 Thread Jonathan M Davis
On Monday, November 07, 2011 15:38 Andrej Mitrovic wrote: import std.stdio; void main() { int y; switch (y) { case 0: { // no warning here on fallthrough } case 1: { goto case 2; } case 2: { writeln(2); break; } default: } } This won't trigger any warnings when

Re: Implicit case fallthrough warns only when a statement is in place

2011-11-07 Thread bearophile
Andrej Mitrovic: I did have a bug pop up because I was relying on this new fallthrough warning system, but it failed to warn me because I didn't have a statement in one of my cases (I forgot to put a break). -.- This is the consequence of special cases piled on special cases, in the D

Re: Any othe options for inserting into associative array?

2011-11-07 Thread Jesse Phillips
On Mon, 07 Nov 2011 20:59:05 +, Richard Webb wrote: I have a recollection that i replaced an opAssign with a custom assign function when getting Juno to build with D2 a while ago because of something like this (was in the MethodProxy struct in com.client). That did hit a different DMD bug

Re: extends and implements

2011-11-07 Thread Jesse Phillips
On Mon, 07 Nov 2011 18:22:07 +, %u wrote: Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass

Re: Expected or Bug? struct range unmodified after foreach

2011-11-07 Thread Jesse Phillips
On Mon, 07 Nov 2011 18:52:19 +0100, Timon Gehr wrote: Expected, s has value semantics. for(S _s=s; !_s.empty(); _s.popFront()){ auto i = _s.front(); // assert(i == s.popCount()); // expected to fail. } Yes thank you. I was just hoping to have access to _s inside the loop. And

Re: extends and implements

2011-11-07 Thread Jacob Carlborg
On 2011-11-07 20:36, Dejan Lekic wrote: Andrej Mitrovic wrote: class Rectangle : IShape, Drawable {} It's pretty common in other languages, I've seen it used in D as well. I used the same naming convention for interfaces until I saw this presentation:

Re: extends and implements

2011-11-07 Thread Jacob Carlborg
On 2011-11-08 03:07, Jesse Phillips wrote: On Mon, 07 Nov 2011 18:22:07 +, %u wrote: Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You