Re: reddit.com: first Chapter of TDPL available for free

2009-08-08 Thread Jarrett Billingsley
On Sat, Aug 8, 2009 at 8:44 PM, Jos van Udenj...@nospam.nl wrote: Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/975ng/diving_into_the_d_programming_language_tdpl/ (Don't tell anyone, but I plan to rewrite it.) Andrei Is this supposed to compile? I keep getting

Re: reddit.com: first Chapter of TDPL available for free

2009-08-08 Thread Jos van Uden
Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 8:44 PM, Jos van Udenj...@nospam.nl wrote: Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/975ng/diving_into_the_d_programming_language_tdpl/ (Don't tell anyone, but I plan to rewrite it.) Andrei Is this supposed to

Re: Exponential operator

2009-08-08 Thread Simen Kjaeraas
On Fri, 07 Aug 2009 18:57:12 +0200, Michel Fortin michel.for...@michelf.com wrote: On 2009-08-07 12:33:09 -0400, Miles ...@___. said: Lars T. Kyllingstad wrote: Neither of the natural candidates, a^b and a**b, are an option, as they are, respectively, already taken and

Re: proposed syntax change

2009-08-08 Thread Pablo Ripolles
Lars T. Kyllingstad Wrote: Don wrote: The operator which is REALLY missing is exponentiation. I've been really missing that one. Which operators could be used for exponentiation? I've only ever seen a**b and a^b used, but I think those are out of the question for D. -Lars Why

Re: proposed syntax change

2009-08-08 Thread Pablo Ripolles
Pablo Ripolles Wrote: Lars T. Kyllingstad Wrote: Don wrote: The operator which is REALLY missing is exponentiation. I've been really missing that one. Which operators could be used for exponentiation? I've only ever seen a**b and a^b used, but I think those are out of the

YAPP - reminder

2009-08-08 Thread aarti_pl
Hello! This is just another reminder about ongoing voting about properties: http://www.igsoft.net/dpolls/index.php Current results: * about 68% of responders want to have special syntax for properties * from people wanting new syntax most people want C# syntax (26 votes) and then almost

Re: delete and references?

2009-08-08 Thread Andrei Alexandrescu
Jeremie Pelletier wrote: Jarrett Billingsley Wrote: On Fri, Aug 7, 2009 at 1:20 PM, Aaron Wattersarw1...@yahoo.com wrote: Hi guys. D looks cool. A couple of things confuse me. The first is: what happens if I do a delete cl; after storing a reference to cl somewhere? Can I use the stored

Re: delete and references?

2009-08-08 Thread Jarrett Billingsley
On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D continues C++'s mistake of conflating lifetime termination with memory reclamation. Why? Instead

Re: delete and references?

2009-08-08 Thread Andrei Alexandrescu
Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D continues C++'s mistake of conflating lifetime termination with memory

Re: delete and references?

2009-08-08 Thread Jarrett Billingsley
On Sat, Aug 8, 2009 at 9:42 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only

Re: delete and references?

2009-08-08 Thread Leandro Lucarella
Andrei Alexandrescu, el 8 de agosto a las 08:42 me escribiste: Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D

Re: delete and references?

2009-08-08 Thread Daniel Keep
Andrei Alexandrescu wrote: ... And what if you used it to try to delete a temporary array? Yes, you could use malloc/free for the temp array, but.. it just seems silly to have to dip into C functions to do that. Why? It's not a frequent need. I use it quite a bit, mostly because scope

Re: delete and references?

2009-08-08 Thread Leandro Lucarella
Leandro Lucarella, el 8 de agosto a las 11:22 me escribiste: Andrei Alexandrescu, el 8 de agosto a las 08:42 me escribiste: Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not

Re: delete and references?

2009-08-08 Thread Jeremie Pelletier
Jarrett Billingsley Wrote: On Sat, Aug 8, 2009 at 9:42 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim

Re: delete and references?

2009-08-08 Thread Michel Fortin
On 2009-08-08 09:17:28 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Great description. FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D continues C++'s mistake of conflating lifetime termination with memory

Re: delete and references?

2009-08-08 Thread Andrei Alexandrescu
Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:42 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: Jarrett Billingsley wrote: On Sat, Aug 8, 2009 at 9:17 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: FWIW, I am trying to convince Walter to not reclaim memory in

Re: delete and references?

2009-08-08 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-08-08 09:17:28 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Great description. FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D continues C++'s mistake of conflating lifetime

Re: delete and references?

2009-08-08 Thread Jeremie Pelletier
Andrei Alexandrescu Wrote: Michel Fortin wrote: On 2009-08-08 09:17:28 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Great description. FWIW, I am trying to convince Walter to not reclaim memory in delete, but instead only call destructors. D continues C++'s

Re: delete and references?

2009-08-08 Thread bearophile
Jeremie Pelletier: It's impossible to know if a pointer is unique without scanning the entire heap and pausing all threads to scan their stacks. Are you saying this after reading Bartoz blog posts? Bye, bearophile

Re: YAPP - reminder

2009-08-08 Thread Chad J
aarti_pl wrote: Currently my choice would be something like proposal in DIP6 (attributes). Using '@' at the beginning of attributes could be also used in another place: in imports it could be used to escape keywords, so that following would be possible: -- import s...@traits; //then we

Re: delete and references?

2009-08-08 Thread Jeremie Pelletier
bearophile Wrote: Jeremie Pelletier: It's impossible to know if a pointer is unique without scanning the entire heap and pausing all threads to scan their stacks. Are you saying this after reading Bartoz blog posts? Bye, bearophile No I haven't, do you have a link?

Re: delete and references?

2009-08-08 Thread bearophile
Jeremie Pelletier: No I haven't, do you have a link? With the power of Google this is the blog of Bartosz Milewski, you may read about the last ten posts or so: http://bartoszmilewski.wordpress.com/ Bye, bearophile

unittext extension proposal

2009-08-08 Thread Jeremie Pelletier
I just had an idea to help keep track of unittests, right now we're turning on printf's at the beginning of a test to know which one fails, and adding printfs everywhere quickly becomes redundant. Also if the test succeeds and execution fails at some other point, the last printf is then

Ambiguous comment syntax

2009-08-08 Thread Oliver Hoog
Since one of D's goals is dropping the bad things from C/C++, I wonder why the ambiguous syntax for multi-line comments is still allowed: --- auto p = new int; *p = 10; auto j = 100/*p;- error --- There is already the unambiguous /+...+/ syntax, so why not drop the

Re: Ambiguous comment syntax

2009-08-08 Thread Adam D. Ruppe
On Sun, Aug 09, 2009 at 02:25:04AM +0200, Oliver Hoog wrote: There is already the unambiguous /+...+/ syntax, so why not drop the /*...*/ syntax? Compatibility? Convenience? Both. I think D should be more pragmatic. Pragmatism includes sticking to established habits in humans. This is one

Re: Ambiguous comment syntax

2009-08-08 Thread Rainer Deyke
Oliver Hoog wrote: There is already the unambiguous /+...+/ syntax, so why not drop the /*...*/ syntax? Compatibility? Convenience? I think D should be more pragmatic. What do you think? I don't think D needs two inline comment forms, but /+...+/ is no less ambiguous than /*...*/. Don't

Properties in C# and prop_Foo

2009-08-08 Thread Bill Baxter
Interesting thing I found out about C# properties. The syntax int Thing { get { return _thing; } set { _thing = value; } } is rewritten by the C# compiler into int prop_Thing() { return _thing; } void prop_Thing(int value) { _thing = value; } Just thought it was interesting given all our

Memory allocation problem

2009-08-08 Thread bearophile
In a small program on Windows XP I have to allocate a large chunk of RAM, about 1847 MB of RAM. This PC has 2 GB RAM. So I use std.c.stdio.malloc(), with DMD v1.042 (or v2.031). But it's not able to allocate it, and produces at runtime: Error: Access Violation An equal program written in C and

Re: Memory allocation problem

2009-08-08 Thread Jeremie Pelletier
bearophile Wrote: In a small program on Windows XP I have to allocate a large chunk of RAM, about 1847 MB of RAM. This PC has 2 GB RAM. So I use std.c.stdio.malloc(), with DMD v1.042 (or v2.031). But it's not able to allocate it, and produces at runtime: Error: Access Violation An

Re: YAPP - reminder

2009-08-08 Thread Jeremie Pelletier
aarti_pl Wrote: Hello! This is just another reminder about ongoing voting about properties: http://www.igsoft.net/dpolls/index.php Current results: * about 68% of responders want to have special syntax for properties * from people wanting new syntax most people want C# syntax (26

Re: Properties in C# and prop_Foo

2009-08-08 Thread Bill Baxter
On Sun, Aug 9, 2009 at 10:43 AM, Bill Baxterwbax...@gmail.com wrote: Interesting thing I found out about C# properties. The syntax int Thing {   get { return _thing; }   set { _thing = value; } } is rewritten by the C# compiler into int prop_Thing() { return _thing; } void

Re: Properties in C# and prop_Foo

2009-08-08 Thread Jarrett Billingsley
On Sun, Aug 9, 2009 at 12:23 AM, Bill Baxterwbax...@gmail.com wrote: On Sun, Aug 9, 2009 at 10:43 AM, Bill Baxterwbax...@gmail.com wrote: Interesting thing I found out about C# properties. The syntax int Thing {   get { return _thing; }   set { _thing = value; } } is rewritten by the C#

Compile time code paths

2009-08-08 Thread Jeremie Pelletier
If a function has both an asm and D implementations inside its body, and the D version can be executed at compile time, but the asm one is much faster at runtime. Is it possible to have the compiler use the D code path at compile time (ie to fill in enums and whatnot), and have the asm version

Re: Compile time code paths

2009-08-08 Thread Daniel Keep
Jeremie Pelletier wrote: If a function has both an asm and D implementations inside its body, and the D version can be executed at compile time, but the asm one is much faster at runtime. Is it possible to have the compiler use the D code path at compile time (ie to fill in enums and

Re: Ambiguous comment syntax

2009-08-08 Thread Daniel Keep
Oliver Hoog wrote: Since one of D's goals is dropping the bad things from C/C++, I wonder why the ambiguous syntax for multi-line comments is still allowed: --- auto p = new int; *p = 10; auto j = 100/*p;- error --- There is already the unambiguous /+...+/ syntax, so why

Re: how does range.put work

2009-08-08 Thread Jos van Uden
Oliver wrote: The source code for the standard library comes with the compiler. If you look in std\array.d, you find this around line 279 (reflowed for readability): void put(T, E)(ref T[] a, E e) { assert(a.length); a[0] = e; a = a[1 .. $]; } Would anybody care to explain what this

Re: how does range.put work

2009-08-08 Thread Daniel Keep
Jos van Uden wrote: Oliver wrote: The source code for the standard library comes with the compiler. If you look in std\array.d, you find this around line 279 (reflowed for readability): void put(T, E)(ref T[] a, E e) { assert(a.length); a[0] = e; a = a[1 .. $]; } Would anybody

Re: how does range.put work

2009-08-08 Thread Jos van Uden
Daniel Keep wrote: No; read the code. Before the put, a and b are pointing to the same span of memory. a.put(5) puts the value 5 into the front (first element) of the array, then advances the array. However, put can't see b, so it doesn't get updated along with a. The end result is that b =

some strange behavior

2009-08-08 Thread //o
Writing a small opengl text printer (vertex based) I have found that the next lines are illegal to dmd (2.031): invariant float[][][] CHARS =[ [//A [0,0], [1/2f,2], [1,0], [3/4f,1], [1/4f,1] ] ]; dmd complains (compiling with dmd -c bug.d):

some strange behavior

2009-08-08 Thread //o
Writing a small opengl text printer (vertex based) I have found that the next lines are illegal to dmd (2.031): invariant float[][][] CHARS =[ [//A [0,0], [1/2f,2], [1,0], [3/4f,1], [1/4f,1] ] ]; dmd complains (compiling with dmd -c bug.d):

[Issue 3235] New: Function literals must be deduced as function or delegate

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3235 Summary: Function literals must be deduced as function or delegate Product: D Version: unspecified Platform: Other OS/Version: Linux Status: NEW

[Issue 3235] Function literals must be deduced as function or delegate

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3235 --- Comment #1 from Andrei Alexandrescu and...@metalanguage.com 2009-08-08 07:17:17 PDT --- (In reply to comment #0) Consider: void foo(alias pred)() { pragma(msg, pred.stringof); } unittest { foo!((i) { return i 0; })();

[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977 --- Comment #22 from Jason House jason.james.ho...@gmail.com 2009-08-08 09:17:31 PDT --- (In reply to comment #21) I'm only worrying about D2 where implicit narrowing conversions is part of the spec. ulong%1000 should implicitly allowed

[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added CC|

[Issue 3235] Function literals must be deduced as function or delegate

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3235 Stewart Gordon s...@iname.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3235] Function literals must be deduced as function or delegate

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3235 --- Comment #3 from Andrei Alexandrescu and...@metalanguage.com 2009-08-08 11:55:19 PDT --- (In reply to comment #2) This is as designed. http://www.digitalmars.com/d/1.0/expression.html#FunctionLiteral If the keywords function or

[Issue 3235] Function literals must be deduced as function or delegate

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3235 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Status|RESOLVED|REOPENED

[Issue 3237] New: Access Violation during reference counting

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3237 Summary: Access Violation during reference counting Product: D Version: 2.032 Platform: x86 OS/Version: Windows Status: NEW Severity: critical Priority: P2

[Issue 3237] Access Violation during reference counting

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3237 --- Comment #1 from Bartosz Milewski bart...@relisoft.com 2009-08-08 12:31:46 PDT --- Created an attachment (id=439) -- (http://d.puremagic.com/issues/attachment.cgi?id=439) test case for access violatin while reference counting --

[Issue 2476] std.stdio fails to compile

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2476 Brad Roberts bra...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 3237] Access Violation during reference counting

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3237 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC|

[Issue 3231] Function declared to return a type with its same name doesn't compile

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3231 --- Comment #10 from Cristi Vlasceanu crist...@zerobugs.org 2009-08-08 13:25:53 PDT --- (In reply to comment #9) (In reply to comment #5) I think that marking the bug as invalid because of a limitation in the implementation is

[Issue 3237] Access Violation during reference counting

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3237 --- Comment #4 from Bartosz Milewski bart...@relisoft.com 2009-08-08 15:20:08 PDT --- I simplified the example. It turns out that the destructor of a class object Counter is called. I have no idea what mechanism may call the destructor

[Issue 3231] Function declared to return a type with its same name doesn't compile

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3231 --- Comment #11 from Stewart Gordon s...@iname.com 2009-08-08 16:07:09 PDT --- (In reply to comment #10) (In reply to comment #9) Better beware of hijacking vulnerabilities. This is possibly valid, do you have an example that drives

[Issue 3231] Function declared to return a type with its same name doesn't compile

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3231 --- Comment #12 from Tim M tim.matthe...@gmail.com 2009-08-08 16:42:01 PDT --- Adding the dot is so trivial and takes no time at all. I do believe that this is indeed a bug anyway explanation of such: This code will not compile: class A {

[Issue 2702] Struct initialisation silently inserts deadly casts

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2702 --- Comment #3 from Don clugd...@yahoo.com.au 2009-08-08 22:19:09 PDT --- I have confirmed that after completely removing that section of code, the DMD test suite still passes all tests. I tried to construct a valid case which required that

[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2469 --- Comment #8 from Don clugd...@yahoo.com.au 2009-08-08 22:21:44 PDT --- There's a patch for the original bug in bug 2702. It's unrelated to the ICE. (It's really annoying when new bugs are reported in the comments for existing bugs, it's