Re: Bypassing const with a union

2012-06-02 Thread Dmitry Olshansky
On 02.06.2012 3:28, Era Scarecrow wrote: On Friday, 1 June 2012 at 23:14:14 UTC, Dmitry Olshansky wrote: There is also cast() that just cancels out all const/shared/immutable. Only the first level, transitive const/immutable don't go away in my experience. Perhaps I'm doing it wrong, or

Re: problem with template arguments deduction

2012-06-02 Thread Zhenya
Дмитрий,не подскажите как я бы мог проверить не баг ли это?

Re: problem with template arguments deduction

2012-06-02 Thread Dmitry Olshansky
On 02.06.2012 11:23, Zhenya wrote: Дмитрий,не подскажите как я бы мог проверить не баг ли это? Как я и говорил отписать что это баг. Дальше это дело экспертов по компилятору ) Вот например последние что ты отипсывал, вполне катит для bug-репорта: (только сократи лишний внешний код) this

Re: problem with template arguments deduction

2012-06-02 Thread Zhenya
Куда отписать-то?)

Re: problem with template arguments deduction

2012-06-02 Thread Dmitry Olshansky
On 02.06.2012 11:30, Zhenya wrote: Куда отписать-то?) http://d.puremagic.com/issues/ -- Dmitry Olshansky

Static function conflicts with Non-Static?!

2012-06-02 Thread Namespace
Is that a joke? :D This Code throw the error, that a call of Load matches both functions. How is that possible? Even in php that works fine. Any workarounds? I can not believe that such a simple error still exists in D. [code] import std.stdio; class Foo { public: static Foo Load()

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Zhenya
On Saturday, 2 June 2012 at 08:06:57 UTC, Namespace wrote: Is that a joke? :D This Code throw the error, that a call of Load matches both functions. How is that possible? Even in php that works fine. Any workarounds? I can not believe that such a simple error still exists in D. [code]

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Zhenya
I'm not sure, but it seems that this is a bug.

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Dmitry Olshansky
On 02.06.2012 12:06, Namespace wrote: Is that a joke? :D This Code throw the error, that a call of Load matches both functions. How is that possible? Even in php that works fine. Any workarounds? I can not believe that such a simple error still exists in D. [code] import std.stdio; class Foo

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jonathan M Davis
On Saturday, June 02, 2012 10:14:51 Zhenya wrote: I'm not sure, but it seems that this is a bug. It's not. If nothing else, it's perfectly legal to call a static function with an instance. e.g. class C { static void func() {} } auto c = new C; c.func(); So, that creates an ambiguity if a

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Zhenya
Understand)

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Namespace
On Saturday, 2 June 2012 at 08:24:16 UTC, Jonathan M Davis wrote: On Saturday, June 02, 2012 10:14:51 Zhenya wrote: I'm not sure, but it seems that this is a bug. It's not. If nothing else, it's perfectly legal to call a static function with an instance. e.g. class C { static void

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread bearophile
Jonathan M Davis: Personally, I wish that it weren't legal to call a static function with an object and that you had to explicitly use the class, I agree. Bye, bearophile

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Kevin Cox
On Jun 2, 2012 6:38 AM, bearophile bearophileh...@lycos.com wrote: Jonathan M Davis: Personally, I wish that it weren't legal to call a static function with an object and that you had to explicitly use the class, I agree. Bye, bearophile Same here, D 3.0?

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Dmitry Olshansky
On 02.06.2012 14:39, Kevin Cox wrote: On Jun 2, 2012 6:38 AM, bearophile bearophileh...@lycos.com mailto:bearophileh...@lycos.com wrote: Jonathan M Davis: Personally, I wish that it weren't legal to call a static function with an object and that you had to explicitly use the class,

delegates with references to local strings

2012-06-02 Thread Tobias Pankrath
consider this: import std.stdio; import std.string; alias void delegate() dlgt; int main() { dlgt[] dgs; string[] lines = [line A, line B, line C]; foreach(line; lines) { writeln(line); dgs ~= { writeln(line); };

Re: delegates with references to local strings

2012-06-02 Thread bearophile
Tobias Pankrath: How can I store the string of the current iteration with a delegate? You need to create a closure (D main returns 0 automatically): import std.stdio, std.string; void main() { auto lines = [line A, line B, line C]; void delegate()[] delegates; foreach (line;

Re: delegates with references to local strings

2012-06-02 Thread Artur Skawina
On 06/02/12 14:01, Tobias Pankrath wrote: consider this: import std.stdio; import std.string; alias void delegate() dlgt; int main() { dlgt[] dgs; string[] lines = [line A, line B, line C]; foreach(line; lines) {

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread H. S. Teoh
On Sat, Jun 02, 2012 at 01:23:50AM -0700, Jonathan M Davis wrote: [...] Personally, I wish that it weren't legal to call a static function with an object and that you had to explicitly use the class, but that's not the way that it is in D, C++, and Java (and probably the same for C#, though

Re: Simplified socket creation and handling

2012-06-02 Thread Jarl André
Now the similarity to the original quickserver library in java is so ripped off that I had an email sent over to the author asking for permission to continue on the api clone or alternatively change the api. Comments or suggestions? sucks totally or worth a penny?

std.format.formattedRead and File.readln()

2012-06-02 Thread Eyyub
Hi, This following code won't compile : import std.stdio; import std.format; void main() { auto f = File(myfile.txt, r); uint life; formattedRead(f.readln(), Life %s, life); // Error 1 formattedRead(cast(string)f.readln(), Life %s, life); // Error 1

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jacob Carlborg
On 2012-06-02 10:06, Namespace wrote: Is that a joke? :D This Code throw the error, that a call of Load matches both functions. How is that possible? Even in php that works fine. Any workarounds? I can not believe that such a simple error still exists in D. [code] import std.stdio; class Foo

Re: delegates with references to local strings

2012-06-02 Thread Tobias Pankrath
Thank you. That works.

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jonathan M Davis
On Saturday, June 02, 2012 14:49:39 Dmitry Olshansky wrote: Generic programming benefits from it in certain scenarios This is brought up periodically, and I don't really buy it. _Maybe_ there's a scenario where it would help, but typeof makes it trivial to get the type so that you can call a

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jonathan M Davis
On Saturday, June 02, 2012 18:40:38 Jacob Carlborg wrote: http://d.puremagic.com/issues/show_bug.cgi?id=3345 Ah, there it is! I was _sure_ that a report for it existed, but I couldn't find it (probably because I was searching for overload and didn't think to search for name). - Jonathan M

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jonathan M Davis
On Saturday, June 02, 2012 08:41:17 H. S. Teoh wrote: On Sat, Jun 02, 2012 at 01:23:50AM -0700, Jonathan M Davis wrote: [...] Personally, I wish that it weren't legal to call a static function with an object and that you had to explicitly use the class, but that's not the way that it is

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Andrej Mitrovic
On 6/2/12, Jonathan M Davis jmdavisp...@gmx.com wrote: The trick is getting Walter to agree. The trick is getting all the people that bought TDPL to burn their books, because by the time all these new changes are set in place the book will have as much dead weight to it as dsource.org. It

Re: Static function conflicts with Non-Static?!

2012-06-02 Thread Jacob Carlborg
On 2012-06-02 19:59, Jonathan M Davis wrote: On Saturday, June 02, 2012 18:40:38 Jacob Carlborg wrote: http://d.puremagic.com/issues/show_bug.cgi?id=3345 Ah, there it is! I was _sure_ that a report for it existed, but I couldn't find it (probably because I was searching for overload and

D and windows console kbhit, getch etc

2012-06-02 Thread Jason King
I've seen a few messages asking how to get this to work and the replies that were functional involved snagging the console input handle and trolling for keyboard events yourself. Since that code is inside the standard library (at least for DMD) I figured out the proper mix to make it work.