Re: Feature for paranoids

2015-11-10 Thread Fyodor Ustinov via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 15:44:26 UTC, ponce wrote: Since assert(false) is special (cf. http://p0nce.github.io/d-idioms/#assert%28false%29-is-special) you can use the following construct to have always-on assert(false) AKA assert(0) - is a part of this language that I think it is

Re: Feature for paranoids

2015-11-10 Thread cym13 via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov wrote: Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor. I don't quite get why you'd like to use -release if you are paranoid enough to be

Re: Feature for paranoids

2015-11-10 Thread Fyodor Ustinov via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 20:46:14 UTC, cym13 wrote: I don't quite get why you'd like to use -release if you are paranoid enough to be afraid of assert(0)'s little difference in behaviour. Could you give a realistic use case? At the very least seeing why it is important to you can only

Feature for paranoids

2015-11-10 Thread Fyodor Ustinov via Digitalmars-d-learn
Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor.

Re: SysTime bug or feature?

2015-10-06 Thread tchaloupka via Digitalmars-d-learn
On Tuesday, 6 October 2015 at 05:54:44 UTC, Jonathan M Davis wrote: It is by design, albeit undesirable. When SysTime was originally written, it was impossible to have a default value for a class reference other than null. So, unless SysTime was going to take the performance hit of constantly

SysTime bug or feature?

2015-10-05 Thread tchaloupka via Digitalmars-d-learn
This code: import std.stdio; import std.datetime; void main() { SysTime t = SysTime.init; writeln(t); } results in segfault with dmd-2.068.2 Is it ok? Backtrace: #0 0x004733f3 in std.datetime.SysTime.adjTime() const () #1 0x004730b9 in

Re: SysTime bug or feature?

2015-10-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, October 05, 2015 18:12:06 tchaloupka via Digitalmars-d-learn wrote: > This code: > > import std.stdio; > import std.datetime; > > void main() > { > SysTime t = SysTime.init; > writeln(t); > } > > results in segfault with dmd-2.068.2 > > Is it ok? It is by design, albeit

Re: Bug or feature?

2015-08-04 Thread Jack Applegame via Digitalmars-d-learn
fix - https://github.com/D-Programming-Language/phobos/pull/3524

Re: Bug or feature?

2015-06-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, 29 June 2015 at 14:28:06 UTC, anonymous wrote: On Monday, 29 June 2015 at 12:04:46 UTC, Jonathan M Davis wrote: You haven't declared an immutable constructor, so you can't construct an immutable Foo. That's not what's happening. Constructing an immutable Foo works just fine.

Re: Bug or feature?

2015-06-30 Thread Jonathan M Davis via Digitalmars-d-learn
constructor were pure, then it could be used to construct immutable objects even if it weren't immutable, but the default constructor is neither pure nor immutable, and purity isn't inferred for normal functions. It might make sense as a feature request to request that a class' default constructor be pure

Re: Bug or feature?

2015-06-30 Thread anonymous via Digitalmars-d-learn
On Monday, 29 June 2015 at 12:04:46 UTC, Jonathan M Davis wrote: You haven't declared an immutable constructor, so you can't construct an immutable Foo. That's not what's happening. Constructing an immutable Foo works just fine.

Re: Bug or feature?

2015-06-30 Thread Jack Applegame via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=14751

Re: Bug or feature?

2015-06-30 Thread Adam D. Ruppe via Digitalmars-d-learn
I'd say bug, I think the array function is trying an optimization it shouldn't be trying for immutable classes.

Re: Bug or feature?

2015-06-30 Thread Daniel Kozák via Digitalmars-d-learn
, and purity isn't inferred for normal functions. It might make sense as a feature request to request that a class' default constructor be pure (assuming that its base class constructor is pure), since theoretically, it should be able to be pure, but that would be a change in the language. What

Bug or feature?

2015-06-28 Thread Jack Applegame via Digitalmars-d-learn
I don't see any reason why it should not compile. import std.array; import std.range; import std.algorithm; class Foo { } void main() { auto result = iota(3).map!(i = new immutable Foo).array(); } /usr/include/dmd/phobos/std/conv.d(4028): Error: cannot implicitly convert expression

Re: Feature or bug: print braces

2015-05-15 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote: Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd Somehow reminds me of this lambda:

Re: Feature or bug: print braces

2015-05-15 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 15 May 2015 at 08:44:41 UTC, Ivan Kazmenko wrote: Somehow reminds me of this lambda: https://github.com/Hackerpilot/Idiotmatic-D/blob/master/idiotmatic.d#L127-L128 Maybe it generally blocks for initialization of variables:

Re: Feature or bug: print braces

2015-05-14 Thread Ali Çehreli via Digitalmars-d-learn
On 05/14/2015 03:39 PM, Dennis Ritchie wrote: On Thursday, 14 May 2015 at 21:55:40 UTC, Alex Parrill wrote: On Thursday, 14 May 2015 at 00:39:25 UTC, Dennis Ritchie wrote: On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote: You told it to output a function literal, so it did. Yes,

Re: Feature or bug: print braces

2015-05-14 Thread Alex Parrill via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:39:25 UTC, Dennis Ritchie wrote: On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote: You told it to output a function literal, so it did. Yes, but it would be logical to deduce something like: - writeln({}); // prints literal[{}] Or the compiler

Re: Feature or bug: print braces

2015-05-14 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 14 May 2015 at 21:55:40 UTC, Alex Parrill wrote: On Thursday, 14 May 2015 at 00:39:25 UTC, Dennis Ritchie wrote: On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote: You told it to output a function literal, so it did. Yes, but it would be logical to deduce something

Re: Feature or bug: print braces

2015-05-14 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 14 May 2015 at 22:55:43 UTC, Ali Çehreli wrote: Yes, it is weird but that value happens to be the address of the function. Here is another test: import std.stdio; void foo() pure nothrow @nogc @safe {} void main() { void printInfo(T)(T t) { writefln(%s %s,

Re: Feature or bug: print braces

2015-05-13 Thread Brian Schott via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote: Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd You told it to output a function literal, so it did. (That or you told it to output a

Re: Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
Turns out that I can put into the function writeln almost any design language: - import std.stdio; void main() { writeln( { int n = 5; } ); } - http://ideone.com/Rp7gZ2

Re: Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:33:33 UTC, Brian Schott wrote: You told it to output a function literal, so it did. Yes, but it would be logical to deduce something like: - writeln({}); // prints literal[{}] Or the compiler will not be able to distinguish the literal from the ordinary

Feature or bug: print braces

2015-05-13 Thread Dennis Ritchie via Digitalmars-d-learn
Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd

Re: Bug or feature?

2015-05-10 Thread Ali Çehreli via Digitalmars-d-learn
On 05/10/2015 10:18 AM, Jack Applegame wrote: code: class A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } } Error: function B.test () is not callable using argument types (int) It is a concept called name

Re: Bug or feature?

2015-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 10, 2015 10:48:33 Ali Çehreli via Digitalmars-d-learn wrote: On 05/10/2015 10:18 AM, Jack Applegame wrote: code: class A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } }

Re: Bug or feature?

2015-05-10 Thread Manfred Nowak via Digitalmars-d-learn
Jack Applegame wrote: test(10); // error One can import the declaration by using an alias: class A { void test(int) {} } class B : A { alias test= super.test; void test() { super.test(1); // compiles test(10); // compiles } } -manfred

Bug or feature?

2015-05-10 Thread Jack Applegame via Digitalmars-d-learn
code: class A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } } Error: function B.test () is not callable using argument types (int)

Re: Bug or feature?

2015-05-10 Thread Jack Applegame via Digitalmars-d-learn
Ok, it's a feature. Thanks.

Re: feature request for dlang.org library preview

2015-04-07 Thread Sönke Ludwig via Digitalmars-d-learn
that function is defined instead. I'm not sure if we need updated output from dmd, or if this is all ddox, so I don't know where to file this feature request. Does one file ddox requests on issues.dlang.org? -Steve This had actually already been implemented, but obviously got broken at some point. I'll

feature request for dlang.org library preview

2015-03-26 Thread Steven Schveighoffer via Digitalmars-d-learn
updated output from dmd, or if this is all ddox, so I don't know where to file this feature request. Does one file ddox requests on issues.dlang.org? -Steve

Re: The package feature is ignored when the file name is package.di

2014-12-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 13, 2014 02:34:21 Jeremy DeHaan via Digitalmars-d-learn wrote: Is this on purpose? Granted, I almost never use interface files, but I had a whim to use them for what I was working on today. Everything worked fine when I renamed the file to package.d, but apparently

The package feature is ignored when the file name is package.di

2014-12-12 Thread Jeremy DeHaan via Digitalmars-d-learn
Is this on purpose? Granted, I almost never use interface files, but I had a whim to use them for what I was working on today. Everything worked fine when I renamed the file to package.d, but apparently package.di is not acceptible.

TypeInfo of interfaces bugg or feature?

2013-12-20 Thread TheFlyingFiddle
When using the typeid expression on a instance of an interface it gives the type of the interface not the type of the underlying object. Is this intended or is it a bug? interface I { } class A : I { } class B : A { } unittest { A a = new A(); B b = new B(); writeln(typeid(a));

Re: TypeInfo of interfaces bugg or feature?

2013-12-20 Thread Adam D. Ruppe
On Friday, 20 December 2013 at 21:21:16 UTC, TheFlyingFiddle wrote: Is this intended or is it a bug? Intended, because an interface is not necessarily an Object. It might also be a COM object or a C++ object, and the typeinfo may not be available for them. (I think, maybe it would be from

dmd: how to pass several linker options with just one -L? (or feature request)

2013-09-06 Thread Timothee Cour
is there a way to achieve this: dmd -L-lfoo -L-lbar main.d with a single call to -L to pass several linker options; something like: dmd -L'-lfoo -lbar' main.d except that won't work due to '' being treated as one argument. Maybe something like: dmd --L=' flag1 flag2' main.d which would treat the

bug or feature? shared objects and tuples

2013-08-26 Thread Jack Applegame
It is impossible to pack a structure with shared object into tuple. ``` import std.concurrency; import std.typecons; class Foo {} struct A { shared Foo foo; } void main() { auto a = tuple(new shared Foo); // ОК auto b = tuple(A());// Error: static assert unable

Re: bug or feature? shared objects and tuples

2013-08-26 Thread Andrej Mitrovic
On 8/27/13, Jack Applegame jappleg...@gmail.com wrote: It is impossible to pack a structure with shared object into tuple. Bug. Please file it to bugzilla: http://d.puremagic.com/issues/enter_bug.cgi?product=D Thanks!

Re: bug or feature? shared objects and tuples

2013-08-26 Thread Jack Applegame
On Monday, 26 August 2013 at 23:04:24 UTC, Andrej Mitrovic wrote: Bug. Please file it to bugzilla: http://d.puremagic.com/issues/enter_bug.cgi?product=D Thanks! http://d.puremagic.com/issues/show_bug.cgi?id=10907

Re: Bug or feature?

2013-05-27 Thread mimi
Well, how you can reduce the long ugly name in this case? In the real function I mentioned it so many times.

Re: Bug or feature?

2013-05-27 Thread Namespace
void foo( S s ) { auto local = this.bigUglyName; auto b = s.bigUglyName; writeln( bigUglyName (AKA local)=, local, b=, b ); } :P

Re: Bug or feature?

2013-05-27 Thread mimi
On Monday, 27 May 2013 at 10:17:01 UTC, Namespace wrote: void foo( S s ) { auto local = this.bigUglyName; auto b = s.bigUglyName; writeln( bigUglyName (AKA local)=, local, b=, b ); } :P By the way, yes. Thanks for that, I'm stupid today.

Re: Bug or feature?

2013-05-27 Thread Maxim Fomin
On Monday, 27 May 2013 at 10:07:49 UTC, mimi wrote: Well, how you can reduce the long ugly name in this case? In the real function I mentioned it so many times. By not making the name ugly big.

Re: Bug or feature?

2013-05-27 Thread mimi
On Monday, 27 May 2013 at 11:32:46 UTC, Maxim Fomin wrote: On Monday, 27 May 2013 at 10:07:49 UTC, mimi wrote: Well, how you can reduce the long ugly name in this case? In the real function I mentioned it so many times. By not making the name ugly big. Other people do. In addition,

Bug or feature?

2013-05-26 Thread mimi
import std.stdio; struct S { int bigUglyName; void foo( S s ) { alias bigUglyName local; alias s.bigUglyName b; writeln( bigUglyName (AKA local)=, local, b=, b ); } } void main() { S s1; S s2; s1.bigUglyName = 1; s2.bigUglyName = 2;

Re: Bug or feature?

2013-05-26 Thread Maxim Fomin
On Sunday, 26 May 2013 at 23:35:43 UTC, mimi wrote: import std.stdio; struct S { int bigUglyName; void foo( S s ) { alias bigUglyName local; alias s.bigUglyName b; writeln( bigUglyName (AKA local)=, local, b=, b ); } } void main() { S s1; S

Re: Appending immutable char implicit cast to int, bug or feature?

2012-12-06 Thread ixid
I don't know where that cast occurs but I wanted to state the obvious: Operator ~ is defined only for arrays. Would having it also work for individual units to make an array be a plausible enhancement request? It would seem like a natural use of the operator.

Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread ixid
This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4)

Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread ixid
This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4)

Re: Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread Ali Çehreli
On 12/05/2012 09:30 AM, ixid wrote: This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4) result ~= [a[i]] ~ [b[j]] ~ [a[k]] ~ [b[m]]; return result; }

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2012-01-06 Thread Stewart Gordon
On 29/12/2011 19:09, Jacob Carlborg wrote: snip excessive quote Could druntime hook up on the atexit function to run destructors and similar when the program exits? I'm not sure. Maybe it could be called upon to run static destructors and destruct heap-allocated objects. But in order to

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2012-01-06 Thread Andrej Mitrovic
That should have been int main.

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-30 Thread Jonathan M Davis
On Thursday, December 29, 2011 23:03:23 Ashish Myles wrote: Since D could conceivably implement a very safe exit() without an explicit use of Exceptions to get around the catch Exception() {} problem you mentioned above, does it make sense to request a safer exit() feature for D? And how

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-30 Thread Ashish Myles
above, does it make sense to request a safer exit() feature for D? And how would it do that? The only way in the language to properly unwind the stack without returning from each and every function is to throw an Exception. If you wanted to do an exit function, it would somehow have to do

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-30 Thread Jonathan M Davis
On Friday, December 30, 2011 10:45:43 Ashish Myles wrote: Ok, now there are two issues here: IMPLEMENTATION: Implementation of a safe_exit() without an explicit Exception seems to be easy to do at the language level for a single-threaded program -- you simply have a hidden/system class like,

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-30 Thread Ashish Myles
Thanks, Jonathan, for your detailed answer. Ashish On Fri, Dec 30, 2011 at 1:41 PM, Jonathan M Davis jmdavisp...@gmx.com wrote: On Friday, December 30, 2011 10:45:43 Ashish Myles wrote: Ok, now there are two issues here: IMPLEMENTATION: Implementation of a safe_exit() without an explicit

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Jacob Carlborg
On 2011-12-29 18:22, Jakob Ovrum wrote: On Thursday, 29 December 2011 at 16:27:33 UTC, Ashish Myles wrote: std.c.stdlib.exit() seems to break RAII. The code below tests this both using a struct destructor and an explicit scope(exit) {}. Is this an intentional feature or a bug? import std.stdio

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Andrej Mitrovic
Probably the easiest thing to do is to throw a custom exception and catch it somewhere in main() to return your status code. Unlike exit(), throwing will take care of RAII stuff.

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Ashish Myles
block), would it be reasonable to do a feature request for a D-language-supported exit()?

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Jakob Ovrum
On Thursday, 29 December 2011 at 16:27:33 UTC, Ashish Myles wrote: std.c.stdlib.exit() seems to break RAII. The code below tests this both using a struct destructor and an explicit scope(exit) {}. Is this an intentional feature or a bug? import std.stdio; import std.c.stdlib; void main

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Jakob Ovrum
On Thursday, 29 December 2011 at 17:22:33 UTC, Jakob Ovrum wrote: Calling 'exit' doesn't properly shut down the D runtime either, it's not just constructors. I mean destructors*.

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread AaronP
exit code, return the exit code in the catch block), would it be reasonable to do a feature request for a D-language-supported exit()? Yeah, really. I'd been using the C exit() as well. Seems like a pretty fundamental feature. :O

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Jonathan M Davis
a custom exception storing exit code, return the exit code in the catch block), would it be reasonable to do a feature request for a D-language-supported exit()? A D exit function would have to do essentially the same thing as throw an exception and catch it in main anyway. The only way

Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread Ashish Myles
implement a very safe exit() without an explicit use of Exceptions to get around the catch Exception() {} problem you mentioned above, does it make sense to request a safer exit() feature for D? Ashish

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-15 Thread Christophe
bearophile , dans le message (digitalmars.D.learn:29532), a écrit : Well, I don't understand the error it gives :-) Are you able to explain it to me? import std.stdio; void main() { int i = 1; switch(i) { case 0: writeln(case 0); goto

Should the 2.054 feature about warning on implicit fallthrough include labels?

2011-09-14 Thread simendsjo
Not sure if this is a bug or as intended. import std.stdio; void main() { int i = 1; switch(i) { case 0: writeln(case 0); goto default; // needed here default: writeln(default); // But always falls through here

Re: Should the 2.054 feature about warning on implicit fallthrough include

2011-09-14 Thread bearophile
simendsjo Wrote: Not sure if this is a bug or as intended. The semantics of switch is a mess (example: see http://d.puremagic.com/issues/show_bug.cgi?id=3820 ). Mixing labels and switch cases seems a good way to create a bigger mess. If I invert some things in your code I get an error...

Re: Should the 2.054 feature about warning on implicit fallthrough include labels?

2011-09-14 Thread Dmitry Olshansky
On 14.09.2011 22:52, simendsjo wrote: Not sure if this is a bug or as intended. import std.stdio; void main() { int i = 1; switch(i) { case 0: writeln(case 0); goto default; // needed here default: writeln(default); // But always falls through here aLabel: writeln(a label); } } Label doesn't

Re: Should the 2.054 feature about warning on implicit fallthrough include labels?

2011-09-14 Thread Timon Gehr
On 09/14/2011 08:52 PM, simendsjo wrote: Not sure if this is a bug or as intended. import std.stdio; void main() { int i = 1; switch(i) { case 0: writeln(case 0); goto default; // needed here default: writeln(default); // But always falls through here aLabel: writeln(a label); } } This is as

Re: Should the 2.054 feature about warning on implicit fallthrough include

2011-09-14 Thread Timon Gehr
On 09/14/2011 09:11 PM, bearophile wrote: simendsjo Wrote: Not sure if this is a bug or as intended. The semantics of switch is a mess (example: see http://d.puremagic.com/issues/show_bug.cgi?id=3820 ). Mixing labels and switch cases seems a good way to create a bigger mess. I think it is

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-14 Thread bearophile
Timon Gehr: I think it is a bit mean to say the whole semantics is a mess, The original C design is a mess with several traps, and successive things added in D to the switch have increased the mess, they were designed from very narrow points of view, with a lack of global vision: 1) The case

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-14 Thread Dmitry Olshansky
On 15.09.2011 0:51, bearophile wrote: Timon Gehr: I think it is a bit mean to say the whole semantics is a mess, The original C design is a mess with several traps, and successive things added in D to the switch have increased the mess, they were designed from very narrow points of view,

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-14 Thread Timon Gehr
On 09/14/2011 10:51 PM, bearophile wrote: Timon Gehr: I think it is a bit mean to say the whole semantics is a mess, The original C design is a mess with several traps, and successive things added in D to the switch have increased the mess, they were designed from very narrow points of

Re: Should the 2.054 feature about warning on implicit fallthrough

2011-09-14 Thread bearophile
Timon Gehr: What would you suggest? At the moment I suggest nothing, because the situation is set. Case syntax was discussed a lot, by me too. I suggested to differentiate the syntax, not using .. because in D they denote an interval open on the right. 'C switch' means 'jump table'. It

opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Damian Ziemba
am dispatching in class! writeln ( test2 ); // NOTHING :( But should return I am Test class! } Is it a feature or a bug? Best regards, Damian Ziemba

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Christophe
Try to create the method: const void toString(void delegate(const(char)[]) sink, string formatString) { sink(toString()); }

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Damian Ziemba
On Thu, 01 Sep 2011 07:56:49 +, Christophe wrote: Try to create the method: const void toString(void delegate(const(char)[]) sink, string formatString) { sink(toString()); } Adding it as it is results in compiler error: ./quick.d(30): Error: function quick.Test2.toString ()

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Timon Gehr
! writeln ( test2.s() ); // I am dispatching in class! writeln ( test2 ); // NOTHING :( But should return I am Test class! } Is it a feature or a bug? Best regards, Damian Ziemba static assert(isInputRange!Test); static assert(isInputRange!Test2

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Damian Ziemba
On Thu, 01 Sep 2011 13:59:29 +0200, Timon Gehr wrote: static assert(isInputRange!Test); static assert(isInputRange!Test2); toString is not shadowed, but the implementation of writeln assumes that your types are an InputRange (they provide, by the means of opDispatch, front(), empty() and

Re: opDispatch shadowing toString - feature or bug?

2011-09-01 Thread Timon Gehr
On 09/02/2011 12:09 AM, Damian Ziemba wrote: On Thu, 01 Sep 2011 13:59:29 +0200, Timon Gehr wrote: static assert(isInputRange!Test); static assert(isInputRange!Test2); toString is not shadowed, but the implementation of writeln assumes that your types are an InputRange (they provide, by the

struct opEquals does not work with parameter of same type - bug or feature?

2011-08-29 Thread Sean Eskapp
I am trying to build a struct with equality testing, using this code: struct Foo { const bool opEquals(Foo f) { return true; } } This gives me the error that the parameter should be of type ref const Foo. Fine. struct Foo { const bool opEquals(ref const Foo f) {

Re: struct opEquals does not work with parameter of same type - bug or feature?

2011-08-29 Thread Jonathan M Davis
On Monday, August 29, 2011 22:41:26 Sean Eskapp wrote: I am trying to build a struct with equality testing, using this code: struct Foo { const bool opEquals(Foo f) { return true; } } This gives me the error that the parameter should be of type ref const Foo.

Re: struct opEquals does not work with parameter of same type - bug or feature?

2011-08-29 Thread Sean Eskapp
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Monday, August 29, 2011 22:41:26 Sean Eskapp wrote: I am trying to build a struct with equality testing, using this code: struct Foo { const bool opEquals(Foo f) { return true; } } This

Re: A possible feature request: Make writef with %s call to!string for char* parameters

2011-07-12 Thread Steven Schveighoffer
you're *testing* D code ported from C it would be so much more convenient if you can pass a char* to writef() and use %s to treat it as a C string without having to go through the trouble of writing to!string everywhere. I feel uneasy with this feature. Basically, this means writef makes

Re: double - double[]... | feature or bug?

2010-12-24 Thread bearophile
Steven Schveighoffer: This feature brings absolutely nothing to the table IMO. Added as issue 5368. Bye, bearophile

Re: double - double[]... | feature or bug?

2010-12-23 Thread spir
, or any combination of values which can be mapped to a constructor of that class. It can be convenient sometimes. While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather

Re: double - double[]... | feature or bug?

2010-12-23 Thread bearophile
spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family. The main problem here is that I have never felt the need

Re: double - double[]... | feature or bug?

2010-12-23 Thread Andrej Mitrovic
On 12/23/10, bearophile bearophileh...@lycos.com wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family

Re: double - double[]... | feature or bug?

2010-12-23 Thread Don
bearophile wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family. The main problem here is that I have

Re: double - double[]... | feature or bug?

2010-12-23 Thread Steven Schveighoffer
On Thu, 23 Dec 2010 12:34:45 -0500, Don nos...@nospam.com wrote: bearophile wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other

double - double[]... | feature or bug?

2010-12-22 Thread Andrej Mitrovic
DMD 2.051 with -unittest: import std.algorithm, std.range, std.stdio : writeln; void main() {} void average(double[]) { writeln(non-variadic); } void average(double[]...) { writeln(variadic); } unittest { average(1.5); // writes variadic }

Re: double - double[]... | feature or bug?

2010-12-22 Thread Jonathan M Davis
On Wednesday, December 22, 2010 12:05:18 Andrej Mitrovic wrote: DMD 2.051 with -unittest: import std.algorithm, std.range, std.stdio : writeln; void main() {} void average(double[]) { writeln(non-variadic); } void average(double[]...) { writeln(variadic); } unittest {

Re: double - double[]... | feature or bug?

2010-12-22 Thread Andrej Mitrovic
I thought the variadic version would only take this type: average([1.5], [2.5]); So a variable number of *array* of doubles, not a variable number of doubles. On 12/22/10, Jonathan M Davis jmdavisp...@gmx.com wrote: On Wednesday, December 22, 2010 12:05:18 Andrej Mitrovic wrote: DMD 2.051

Re: double - double[]... | feature or bug?

2010-12-22 Thread Steven Schveighoffer
On Wed, 22 Dec 2010 15:46:01 -0500, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I thought the variadic version would only take this type: average([1.5], [2.5]); So a variable number of *array* of doubles, not a variable number of doubles. No, that's not it. T[] arg... is a

Re: double - double[]... | feature or bug?

2010-12-22 Thread Andrej Mitrovic
Oooh. That cought me off guard, sorry. Thanks Steve. On 12/22/10, Steven Schveighoffer schvei...@yahoo.com wrote: On Wed, 22 Dec 2010 15:46:01 -0500, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I thought the variadic version would only take this type: average([1.5], [2.5]); So a

Re: double - double[]... | feature or bug?

2010-12-22 Thread Christopher Nicholson-Sauls
On 12/22/10 15:06, Andrej Mitrovic wrote: Oooh. That cought me off guard, sorry. Thanks Steve. I'll concede that the syntax can be odd at first, but it also enables some interesting things. For example, this works: class Foo { this (int i, double f) { /*...*/ } /*...*/ } void

Re: optional feature with contract inheritance? (design question)

2010-02-27 Thread Lutger
of whether you consider that a good or bad idea though, there's no point in adding contracts into it. They don't add anything. If the feature is supported by the class, then no exception gets thrown. If it isn't, then an exception gets thrown. All adding asserts in preconditions does is make

Re: optional feature with contract inheritance? (design question)

2010-02-27 Thread Jonathan M Davis
Lutger wrote: Jonathan M Davis wrote: Lutger wrote: True, it only adds AssertError and that could be replaced with regular asserts. Thanks. ??? Regular asserts? When asserts in D fail, they throw an exception of type AssertError. So, unless you're talking about explicitly

D1 vs D2 Feature comparison list

2009-07-28 Thread Sam Hu
Is there such stuff available in D website? Or the only choice to quick check what features are supported by D2 also supported by D1 is to go through the spec? Thanks in advance. Regards, Sam

<    1   2   3   >