Re: [D1, unittest] Cannot turn on unittest version

2010-10-21 Thread Don
%u wrote: See subject^^ And why does the spec say that -unittest turns on asserts? http://www.digitalmars.com/d/1.0/dmd-windows.html#switches -unittest compile in unittest code, turns on asserts, and sets the unittest version identifier http://www.digitalmars.com/d/1.0/unittest.html The ver

Re: initializer for array of function literals

2010-10-30 Thread Don
Adrian Matoga wrote: Hello, I would appreciate if somebody explained to me why this code: static void function(int a)[] foo = [ function (int a) { } ]; causes the following compile error: test.d(2): Error: non-constant expression __funcliteral1 (DMD 2.050, Windows7) TIA -- Adrian I think

Re: exception types & objects

2010-10-30 Thread Don
Stewart Gordon wrote: On 19/10/2010 23:23, Jonathan M Davis wrote: Perhaps, but there is no real benefit in throwing anything other than an Exception (or Error upon occasion) and if we allow you to throw anything than catch(Exception e) won't catch them all. It also would pretty much violate no

Re: exceptions thrown by new / object constructor ?

2010-11-02 Thread Don
Jesse Phillips wrote: I thought there was a Bug report on this, but I guess not. I say report it. Ether it should compile or the compiler should error that a constructor can not be nothrow. This has already been fixed in svn, and will be in the next release. See bug 3020. nothrow is painful

Re: template mixins vs. string mixins

2010-11-06 Thread Don
Trass3r wrote: In the past template mixins were a neat special usecase of templates. Now with the "mixin template()" syntax they've become a separate thing because you can add special code for handling them, e.g. allowing them to add constructors to classes. The question is: what is their rig

Re: array of elements of various subclasses

2010-11-07 Thread Don
spir wrote: Hello, Say I have some subclasses of Pattern. When I try to write Pattern[] patterns = [x,y,z]; I get an error because, apparently, D types the array according to the class of z (Choice is here the type of z): DeeMatch.d(473): Error: cannot implicitly convert expression (x

Re: [import,module] got biting again :(

2010-11-07 Thread Don
%u wrote: Yay, free access to a! I searched for this bug in the bug-reports.. Why are there so many basic import bugs? There's only really one. But it's huge.

Re: [import,module] got biting again :(

2010-11-08 Thread Don
bearophile wrote: Don: There's only really one. But it's huge. Really? :-) I didn't know this. (You are very often right, but I have a hard time believing this). Bye, bearophile Bug 314 is the root cause of every module bug that I know of. Basically the compiler isn

Re: [import,module] got biting again :(

2010-11-08 Thread Don
bearophile wrote: Don: Bug 314 is the root cause of every module bug that I know of. Basically the compiler isn't keeping track of how symbols got imported. So it gets everything wrong. Bug 314 is among my voted bugs since a lot of time. Actually it was the most voted bug in D,

Re: Pure and C functions

2010-11-09 Thread Don
Jonathan M Davis wrote: Is there any way to make a function which calls C functions pure? - Jonathan M Davis Just mark the C function as pure, if it's truly pure. If it isn't really pure, you'll have to use a cast (eg, by taking its address and then casting the function pointer).

Re: multiple alias this in class/struct not allowed?

2010-11-09 Thread Don
Adam Cigánek wrote: Ok guys, thanks. Got it. Well, good to know. Any chance of knowing when could this feature be implemented? First half of next year. adam. 2010/11/9 Jonathan M Davis : In most cases, dmd matches up with TDPL already, but there are several cases where it hasn't caught up

Re: ponce

2010-11-09 Thread Don
main() {} But this limit may be eventually removed for some well behaved classes (like classes with pure methods that don't contain other things forbidden in CTFE). Don is more expert on this and he is probably able to give you a better answer. Bye, bearophile Yes. The rules will be: * no global

Re: ponce

2010-11-09 Thread Don
bearophile wrote: Jonathan M Davis: it would be possible to make it so that any objects allocated with new during CTFE would be in the dynamic heap during runtime. This is possible, but it doesn't seem what you usually desire when you allocate an object at compile time. Bye, bearophile If

Re: ponce

2010-11-10 Thread Don
Steven Schveighoffer wrote: On Tue, 09 Nov 2010 17:14:33 -0500, Don wrote: bearophile wrote: Jonathan M Davis: it would be possible to make it so that any objects allocated with new during CTFE would be in the dynamic heap during runtime. This is possible, but it doesn't seem wha

Re: CTFE history

2010-11-19 Thread Don
bearophile wrote: Michal Minich: see thread "Compile time function execution..." at http://www.digitalmars.com/d/archives/ digitalmars/D/index2007.html. In the previous discussion you can see this idea forming (I searched for the word "compile").< Thank you, I have found and read some of th

Re: Current status of toString in phobos

2010-11-19 Thread Don
Matthias Walter wrote: I've read the bug comments. Seems as it will take some time until the toString system gets renewed (although I like Don's way, but without the corresponding format/writefln implementation, it is pretty useless). The bug in format/writefln has now been fixed. Works in svn.

Re: A CTFE Segfault (with explanation, but I'm not sure what the

2010-11-22 Thread Don
bearophile wrote: Per Ångström: I haven't yet found the official document describing the naming standard for D, http://www.digitalmars.com/d/2.0/dstyle.html That's not really authoritative. That was written by Walter, without any consultation with anybody else. Consider it to be a draft, r

Re: public imports and template functions

2010-11-24 Thread Don
Jonathan M Davis wrote: Am I correct in my understanding that if you wish a template function which is imported from another module to compile correctly without requiring other imports in the module that your using the function in that the module with the template function needs to publically i

Re: Internal error: e2ir.c 4629

2010-11-27 Thread Don
Trass3r wrote: If this isn't in bugzilla, please file a bug report. http://d.puremagic.com/issues/query.cgi It probably has the same root cause as bug 4066.

Re: bigint

2010-11-28 Thread Don
Kagamin wrote: Matthias Walter Wrote: bool opEquals(Tdummy=void)(ref const BigInt y) const bool opEquals(T: int)(T y) const The only working sigature for array-of-structs-comparison to work is bool opEquals(ref const BigInt y) const But this removes the ability to compare against ints. Why

Re: bigint

2010-11-29 Thread Don
Kagamin wrote: Don Wrote: Why are they templated to begin with? Just for the heck of it? bool opEquals(ref const BigInt y) const bool opEquals(long y) const No, because then it fails for ulong. It's those bloody C implicit conversions. hmm... works for me: --- struct A {

Re: Crash in struct opAssign

2010-12-02 Thread Don
Adam Burton wrote: olivier wrote: Hi, This program, compiled with dmd 1.065 under Linux, crashes: void main() { Num a = 1; } struct Num { int[] d; Num opAssign( int v ) { d.length = 1; d[0] = v; return *this; } } It looks like d is not initialized before opAssign() is called. It doesn't cr

Re: casting int to uint and vice versa - performance

2010-12-03 Thread Don
spir wrote: On Fri, 03 Dec 2010 17:49:47 -0500 "Steven Schveighoffer" wrote: just that i + i generates different instructions than ui + ui where int i; uint ui; Not really important, because I'm currently interested in cast only. Thank you. That is odd, I would think that i+i generates the

Re: Ddoc doesn't support documentation for mixined code?

2010-12-10 Thread Don
Alex Moroz wrote: Hi, As of present Ddoc doesn't seem to process documenatation for code that is inserted with mixins. Bug 2440?

Re: Why does this floating point comparison fail?

2010-12-16 Thread Don
Jonathan M Davis wrote: Maybe I'm just totally missing something, but this seems really wrong to me. This program: import std.stdio; void main() { writeln(2.1); writeln(2.1 == 2.1); writeln(3 * .7); writeln(2.1 == 3 * .7); auto a = 2.1; auto b = 3 * .7; writeln(a);

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 never

Re: DMD2 out parameters

2010-12-23 Thread Don
Pete wrote: Ok, i've done some more investigating and it appears that in DMD2 a float NaN is 0x7FE0 (in dword format) but when it initialises a float 'out' parameter it initialises it with 0x7FA0H. This causes an FPU trap which is where the time is going. This looks like a bug to me. Can

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-12 Thread Don
%u wrote: Should I post it as a bug, even though I have no code to accompany it? I have no clue as to where to start my directed search for a minimal case. Can you post the entire source code? It's important that it be reproducible. It doesn't need to be minimal - someone else can reduce it.

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-13 Thread Don
%u wrote: == Quote from Don (nos...@nospam.com)'s article %u wrote: Should I post it as a bug, even though I have no code to accompany it? I have no clue as to where to start my directed search for a minimal case. Can you post the entire source code? It's important that it be reprod

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-13 Thread Don
%u wrote: == Quote from Don (nos...@nospam.com)'s article It's in a switch statement somewhere. It sounds as though this is a bug which involves multiple files, so it'll be difficult to reduce it. If you're able to compile DMD, change this line in statement.c

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-14 Thread Don
%u wrote: == Quote from Don (nos...@nospam.com)'s article Yay for first time compiling dmd :) Sorry you had to do that! Had to learn that once anyway :) Maybe I'll even be able to take a stab at fixing bugs someday.. Added your bug as: http://d.puremagic.com/issues/show_bug.cgi?id=5453

Re: array of elements of various sybtypes

2011-01-28 Thread Don
spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.T0 to __trials__.T2 Error: cannot implicitly convert expressio

Re: github syntax hilighting

2011-01-28 Thread Don
Jacob Carlborg wrote: On 2011-01-26 20:30, Jonathan M Davis wrote: On Wednesday, January 26, 2011 11:21:55 Brad Roberts wrote: On 1/26/2011 7:13 AM, Steven Schveighoffer wrote: Anyone have any clue why this file is properly syntax-aware: https://github.com/D-Programming-Language/druntime/blob

Re: BigInt problem

2011-02-18 Thread Don
tsukikage wrote: Please see source in attachment. The output is M2 M3 M5 M7 M13 M17 M19 M31 M61 M89 M107 M127 M521 M607 M1279 M2203 M2281 M3217 M4253 M4423 *** M9689*** M9941 M11213 M19937 *** M21701*** M23209 It missed 2 Mersenne Primes 9689 & 21701. Is it my program bug or bigint broken?

Want to help DMD bugfixing? Write a simple utility.

2011-03-19 Thread Don
would like to do something really useful. -Don

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-19 Thread Don
Jonathan M Davis wrote: On Saturday 19 March 2011 17:11:56 Don wrote: Here's the task: Given a .d source file, strip out all of the unittest {} blocks, including everything inside them. Strip out all comments as well. Print out the resulting file. Motivation: Bug reports frequently come

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-19 Thread Don
Jonathan M Davis wrote: On Saturday 19 March 2011 18:04:57 Don wrote: Jonathan M Davis wrote: On Saturday 19 March 2011 17:11:56 Don wrote: Here's the task: Given a .d source file, strip out all of the unittest {} blocks, including everything inside them. Strip out all comments as well.

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-20 Thread Don
Jonathan M Davis wrote: Jonathan M Davis wrote: On Saturday 19 March 2011 18:04:57 Don wrote: Jonathan M Davis wrote: On Saturday 19 March 2011 17:11:56 Don wrote: Here's the task: Given a .d source file, strip out all of the unittest {} blocks, including everything inside them. Stri

Re: Want to help DMD bugfixing? Write a simple utility.

2011-03-25 Thread Don
spir wrote: On 03/25/2011 12:08 PM, Regan Heath wrote: On Wed, 23 Mar 2011 21:16:02 -, Jonathan M Davis wrote: There are tasks for which you need to be able to lex and parse D code. To 100% correctly remove unit tests would be one such task. Is that last bit true? You definitely need to

Re: Assertion failure: '!vthis->csym' on line 703 in file 'glue.c'

2011-03-28 Thread Don
nrgyzer wrote: Hey guys, I got "Assertion failure: '!vthis->csym' on line 703 in file 'glue.c'" after I add "LinkList!(uint) myList;" to my source file. I figured out that the same bug was already reported on http://lists.puremagic.com/ pipermail/digitalmars-d-bugs/2010-October/019237.html Ticke

Re: Next Release

2011-04-20 Thread Don
Jonathan M Davis wrote: Greetings All It has been 2 months since we had release 2.052. Just wondering when is the 2.053 release planned? There isn't really a release schedule. A release kind of just happens when Walter decides that it's time or when someone else on the dev team

Re: Which import lib holds lrintf()?

2011-04-28 Thread Don
Andrej Mitrovic wrote: I have a hunch that this function is only available on Linux. If that's so it should maybe be put in a version(linux) statement. But I just found lrint is in std.math as well so I can actually use that. There should be no reason to use anything from c.math.

Re: Matrix creation quiz

2011-04-30 Thread Don
bearophile wrote: Pedro Rodrigues: The fact that 'i' and 'j' are deduced to type 'uint' in the second version. That's the kind of bug that would keep me up at night. Almost right answer. i and j are size_t, that is not uint in 64 bit compilations. Unsigned numbers cause the (i-j) sub-express

Re: opDollar()

2011-05-02 Thread Don
Dmitry Olshansky wrote: On 26.03.2011 11:03, Caligo wrote: "In the expression a[, ...,], if $ occurs in, it is rewritten as a.opDollar!(i)()." -- TDPL, pg 380 Is that correct? if so, could some one give an example code? I don't understand the need for the parameter. Also, what is the signatu

Re: expression templates

2011-05-02 Thread Don
Mr enuhtac wrote: Hello everyone, I'm new to D and this list (although I've had a look onto D a few years ago). I hope you guys can help me with my questions. At the moment I'm trying to implement some expression template stuff. My first goal is to encode an expression into a type representin

Re: Cannot interpret struct at compile time

2011-05-09 Thread Don
Robert Clipsham wrote: Hey all, I was wondering if anyone could enlighten me as to why the following code does not compile (dmd2, latest release or the beta): Added as bug 5969.

Re: github: What to do when unittests fail?

2011-05-29 Thread Don
Dmitry Olshansky wrote: On 24.05.2011 1:33, Andrej Mitrovic wrote: I've cloned Phobos just a few minutes ago, and I've tried to build it with unittests, I'm getting these: Warning: AutoImplement!(C_6) ignored variadic arguments to the constructor C_6(...) --- std.socket(316) broken test --

Re: how to get the local?

2011-06-01 Thread Don
Lloyd Dupont wrote: I tried to add that to my D file === public import std.c.windows.windows; extern(Windows) { int GetUserDefaultLocaleName(LPWSTR lpLocaleName, int cchLocaleName); } === Try: extern(Windows) { int GetUserDefaultLocaleNameW(LPWSTR lpLocaleName, int cchLocaleName); } and

Re: DMD Backend: Deciding instructions to use/avoid?

2011-06-08 Thread Don
Nick Sabalausky wrote: So my main question: Does DMD do anything like, say, detecting the CPU at compile time and then enabling instructions only available on that CPU and up? Or does it do anything like always assuming the target CPU has SSE2? Anything like that that could cause differences be

Re: Is it reasonable to learn D

2011-06-08 Thread Don
f the compiler is very slow More and more people are contributing patches so development has definitely become faster. Also Don has more or less taken over development of the CTFE functionality. Nice trend. - Only a small community => no real German community There is no separate German c

Re: DMD Backend: Deciding instructions to use/avoid?

2011-06-10 Thread Don
Nick Sabalausky wrote: "Nick Sabalausky" wrote in message news:isoltk$1ehd$1...@digitalmars.com... "Don" wrote in message news:isoh6c$15jb$1...@digitalmars.com... Nick Sabalausky wrote: So my main question: Does DMD do anything like, say, detecting the CPU at compile ti

Re: + operators

2011-06-12 Thread Don
Jonathan M Davis wrote: On 2011-06-12 02:37, bearophile wrote: Jonathan M Davis: Certainly, once range propagation has been fully implemented, this particular will work without needing any casts, but as soon as the compiler doesn't know what the values of x and y are, I believe that it would st

Re: A different vector op

2011-07-06 Thread Don
bearophile wrote: Currently this is not allowed, but do you desire a feature like this? struct Foo { int x, y; int[100] array; } void main() { auto foos = new Foo[100]; foos[].y += 10; // *** } Bye, bearophile An interesting use case: void main() { cdouble[100] foos; f

Re: Constructor call must be in a constructor

2011-07-07 Thread Don
Jesse Phillips wrote: Loopback Wrote: Hi! While implementing and overloading several different operators for my structure I've got stuck with an error. As noticed in the attachment, in my opBinaryRight function I mimic the opBinary (left) operator by instantiating the structure itself to avoi

Re: This seems like what could be a common cause of bugs

2011-07-22 Thread Don
Andrej Mitrovic wrote: This is just an observation, not a question or anything. void main() { enum width = 100; double step = 1 / width; writeln(step); // 0 } I've just had this bug in my code. I forgot to make either width or 1 a floating-point type. IOW, I didn't do this: void

Re: Need OMF MySQL lib that actually f^*&^ works...

2011-07-22 Thread Don
Nick Sabalausky wrote: Anyone have a known-working Windows OMF library for MySQL? Static or dynamic, I don't care. I've tried fucking everything and I can't get the dang thing to work. Static was a total no-go. With dynamic, using implib I got it to link, but calling any of it resulted in an Ac

Re: (int << ulong) == int ?

2011-08-09 Thread Don
Jonathan M Davis wrote: On Monday 08 August 2011 00:33:31 Dmitry Olshansky wrote: Just lost the best part of an hour figuring the cause of this small problem, consider: void main() { uint j = 42; ulong k = 1< I would not expect that type of integer being used to give the numb

Re: (int << ulong) == int ?

2011-08-09 Thread Don
Jonathan M Davis wrote: On Tuesday 09 August 2011 09:32:41 Don wrote: Jonathan M Davis wrote: On Monday 08 August 2011 00:33:31 Dmitry Olshansky wrote: Just lost the best part of an hour figuring the cause of this small problem, consider: void main() { uint j = 42; ulong k

Re: How do "pure" member functions work?

2011-08-21 Thread Don
bearophile wrote: Sean Eskapp: Oh, I see, thanks! This isn't documented in the function documentation! D purity implementation looks like a simple thing, but it's not simple, it has several parts that in the last months have be added to the language and compiler, and we are not done yet, th

Re: How do "pure" member functions work?

2011-08-22 Thread Don
Timon Gehr wrote: On 08/21/2011 09:10 PM, Don wrote: bearophile wrote: Sean Eskapp: Oh, I see, thanks! This isn't documented in the function documentation! D purity implementation looks like a simple thing, but it's not simple, it has several parts that in the last months have b

Re: How do "pure" member functions work?

2011-08-24 Thread Don
Simen Kjaeraas wrote: On Mon, 22 Aug 2011 22:19:50 +0200, Don wrote: BTW: The whole "weak pure"/"strong pure" naming was just something I came up with, to convince Walter to relax the purity rules. I'd rather those names disappeared, they aren't very helpful.

How to get WinDbg to show a call stack on Windows 7?

2011-09-12 Thread Don
I've set up a Windows 7 machine for working on DMD but I can't get windbg to work properly. Specifically, when I try to debug DMD itself, I don't get a call stack; I only see the current function. Everything else seems OK. Has anyone else experienced this? Any ideas?

Re: -release compiler switch and associative arrays

2011-10-11 Thread Don
On 09.10.2011 13:24, Graham Cole wrote: I understand from the documentation that the "-release" compiler switch turns off "array bounds checking for system and trusted functions". Is it correct that the following code should seg fault when compiled with "-release" ? string[string] h; h["abc"]

Re: Why is null lowercase?

2013-01-25 Thread Don
On Friday, 25 January 2013 at 01:17:44 UTC, Ali Çehreli wrote: On 01/24/2013 12:42 PM, Matthew Caron wrote: >> for not null checks >> >> if ( ptr !is null) ... > > And too much perl has me wanting to write: > > if (ptr is not null) IIRC, the !is operator is thanks to bearophile. No, it's from

Re: Why is the 'protected' attribute considered useless?

2013-01-30 Thread Don
On Wednesday, 30 January 2013 at 03:38:39 UTC, Chad Joan wrote: I've read more than once now that 'protected' is considered useless in D. Why is this? I've never heard that before. Where have you read that? Several people, including me, have said that 'package' is useless -- could that be wha

Re: What does this compile-time error mean?

2013-02-25 Thread Don
n a CTFE >> function, but >> you can't >> initialize a module-level or static variable (or enum) with >> them, and >> you're >> attempting to initialize maint_cont with a RedBlackTree, >> which is a >> class. It >> won't work

Re: C++ vs D aggregates

2011-12-03 Thread Don
On 03.12.2011 20:14, Dejan Lekic wrote: I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8< - begin - The Standard says in section §8.5.1/1,

Re: How are 2D static arrays allocated?

2008-11-06 Thread Don
Lars Kyllingstad wrote: Lars Kyllingstad wrote: Jarrett Billingsley wrote: Performance of dynamic arrays is the same no matter where their data is. Fixed-size 2D arrays are not faster _because_ they are on the stack, they just happen to be allocated on the stack. They are faster (usually) bec

Re: Branch Prediction strange results

2008-11-12 Thread Don
bearophile wrote: I have found an interesting small article about optimization, so I've tried the code in C and D, and I have found strange results (the D code shows timings opposite of the article). This is the article, look at the "Branch Prediction" section: http://www.ddj.com/184405848 The

Re: .bat file to help compile easier - dmd/build

2009-01-03 Thread Don
Tim M wrote: On Sat, 03 Jan 2009 08:17:17 +1300, Michael P. wrote: Okay, so right now, I'm making a small game(Mario) using DAllegro. I use build, and every time, I have to type this in to compile my progress: build mario alleg.lib Now, I know it's not a lot of typing. But considering I ty

Re: .bat file to help compile easier - dmd/build

2009-01-05 Thread Don
Tim M wrote: No way! On Windows, bud is much better. dsss can't build dlls, for example, which is a blocker for me. It also seems to be based around the flawed concept that you have a small number of build configurations. GC'd memory and DLL just don't go well together. I use C++ for my dll

Re: casting int[] to bool[]

2009-01-30 Thread Don
Steven Schveighoffer wrote: "Jarrett Billingsley" wrote On Thu, Jan 29, 2009 at 6:15 PM, Saaa wrote: That gives the same error.. only casting x to real works :/ That's more an issue with D's extremely (overly?) strict overload resolution rules. Functions like sin() shouldn't be an issue, sin

Re: casting int[] to bool[]

2009-01-30 Thread Don
Steven Schveighoffer wrote: "Don" wrote Steven Schveighoffer wrote: This is such a common "mistake", and really more of an annoyance, I wonder if it might be better if pow were switched to a template that called the actual pow after casting the first argument to real. Of

Re: C struct -> D struct (alignment hacks)

2009-02-05 Thread Don
Mike wrote: On Wed, 04 Feb 2009 21:04:16 +0100, Jarrett Billingsley wrote: Nope. The C struct is defining a bitfield; a and b will actually be contained within a single 4-byte field. Your D version defines three integers. Unfortunately the C specification does not specify any required orde

Re: project euler #10: optimization with primes

2009-04-01 Thread Don
Michael P. wrote: Spacen Jasset Wrote: Michael P. wrote: Hey, I've started to do some of the problems on Project Euler to practice my programming skills. I'm doing #10 right now, and I think I've got a working solution. It's just that it's way too slow. Here's the link: http://projecteuler.n

Re: Wht std.complex is needed?

2009-04-06 Thread Don
bearophile wrote: Sam Hu: Doesn't D already has the built-in types cfloat, cdouble, creal, ifloat, idouble, and ireal?What's the advantage having complex class instead? The intention is that cfloat, cdouble,... will be deprecated eventually. I don't think std.complex should be part of Phobo

Re: Wht std.complex is needed?

2009-04-06 Thread Don
Sam Hu wrote: Thank you! Anothe silly question then:What's the disadvantage to have the built-in type of i-type? Regards, Sam It's a very nasty type. It supports *, but isn't closed under *. Which is really annoying for generic programming. idouble x = 2i; x *= x; // oops, this isn't imagina

Re: Wht std.complex is needed?

2009-04-06 Thread Don
Steven Schveighoffer wrote: On Mon, 06 Apr 2009 08:36:18 -0400, Don wrote: Sam Hu wrote: Thank you! Anothe silly question then:What's the disadvantage to have the built-in type of i-type? Regards, Sam It's a very nasty type. It supports *, but isn't closed under *.

Re: Wht std.complex is needed?

2009-04-06 Thread Don
Steven Schveighoffer wrote: On Mon, 06 Apr 2009 09:50:35 -0400, Don wrote: Steven Schveighoffer wrote: On Mon, 06 Apr 2009 08:36:18 -0400, Don wrote: Sam Hu wrote: Thank you! Anothe silly question then:What's the disadvantage to have the built-in type of i-type? Regards, Sam I

Re: Sort trouble

2009-04-07 Thread Don
bearophile wrote: Even just: void main() { auto a = new uint[10_000_000]; a.sort; a.sort; } Bye, bearophile Confirmed. In fact, any size below 0x8F_ works, and any size >= 0x8F_ fails. On DMD2.027 as well. void main() { auto a = new uint[0x8F_]; // smallest size t

Re: Sort trouble

2009-04-07 Thread Don
Don wrote: bearophile wrote: Even just: void main() { auto a = new uint[10_000_000]; a.sort; a.sort; } Bye, bearophile Confirmed. In fact, any size below 0x8F_ works, and any size >= 0x8F_ fails. On DMD2.027 as well. void main() { auto a = new uint[0x8F_F

Re: Sort trouble

2009-04-07 Thread Don
Stewart Gordon wrote: bearophile wrote: - It can be more flexible (for example mine accepts an optional "key" mapping function) What is there preventing a built-in sort being implemented to do this? It's more difficult than doing it in a library. For apparently no benefit at all. - It

Re: Bit operator conversions

2009-04-09 Thread Don
Jarrett Billingsley wrote: On Mon, Apr 6, 2009 at 8:53 AM, Kagamin wrote: Is it valid for this to compile: --- ushort a(ushort b) pure nothrow { return b<<10|b; } --- And for this to not compile: --- ushort a(ushort b) pure nothrow { return b<<10; } --- ? There was a terribly l

Re: Andrie's new Phobos preview package

2009-04-16 Thread Don
Sam Hu wrote: Hi, I am interested to the subjected new phobos from below link: http://www.erdani.dreamhosters.com/d/ So I downloaded the libphobos2.lib and libphobos2.a from this site manually and then I downloaded the whole package from http://svn.dsource.org/projects/phobos/trunk using Tortoi

Re: Attribute introspection

2009-04-22 Thread Don
bearophile wrote: Are there ways in D2 to tell if a function has the 'pure' attribute? (To create a parallel_map() function we will want to be sure it takes a pure mapping function as argument). Bye, bearophile It's easy enough if it's a function pointer or delegate: int foo(T, U...)(T functi

Re: *this

2009-04-24 Thread Don
Paul D. Anderson wrote: Looking at Don Clugston's BigInt code I see usage of "*this": BigInt opMulAssign(T: BigInt)(T y) { *this = mulInternal(*this, y); return *this; } I think I know what it does (passes this by reference) but I can't find any

Re: Get the name of a function and the parameters?

2009-04-30 Thread Don
Georg Wrede wrote: Jarrett Billingsley wrote: On Wed, Apr 29, 2009 at 2:52 AM, Georg Wrede wrote: Jarrett Billingsley wrote: Don't you love it? "Most C++ template features are discovered." So are D's. Well, one could say that this is the very definition of a well working metaprogramming

Re: Learning D2 from nearly zero

2009-04-30 Thread Don
Grzegorz Adam Hankiewicz wrote: After toying with D1 some years ago I've returned to see D2 and ported it a program I had written in D1. 99% of the time was figuring out why my chars[] suddenly didn't want to work/interface correctly with C library calls. After going through some documentatio

Re: Learning D2 from nearly zero

2009-04-30 Thread Don
Grzegorz Adam Hankiewicz wrote: Don escribió: The key piece of information which I think you're missing is that D2 just underwent an earthquake change in the last release. D2.029 is alpha 1 of Phobos 2.0. It's a major break from D2.028, and has lots of ground-breaking stuff.

Re: DLLs and headaches

2009-05-04 Thread Don
Unknown W. Brackets wrote: This is kinda complicated, hopefully someone will still read it and try it. DLLs typically don't have access to the host process. Sometimes, when creating plugins, such access may be desirable. The typical solution is to have the host and plugins both load a second

Re: Cryptic DMD error

2009-05-08 Thread Don
Lars T. Kyllingstad wrote: Can someone with knowledge of the DMD source code please explain this error message for me? dmd: glue.c:652: virtual void FuncDeclaration::toObjFile(int): Assertion `!v->csym' failed. I had a look at the DMD source to try and make some sense of it myself, but didn

Re: Cryptic DMD error

2009-05-08 Thread Don
Lars T. Kyllingstad wrote: Don wrote: Lars T. Kyllingstad wrote: Can someone with knowledge of the DMD source code please explain this error message for me? dmd: glue.c:652: virtual void FuncDeclaration::toObjFile(int): Assertion `!v->csym' failed. I had a look at the DMD sourc

Re: Cryptic DMD error

2009-05-08 Thread Don
Georg Wrede wrote: Don wrote: Lars T. Kyllingstad wrote: Don wrote: Lars T. Kyllingstad wrote: Can someone with knowledge of the DMD source code please explain this error message for me? dmd: glue.c:652: virtual void FuncDeclaration::toObjFile(int): Assertion `!v->csym' failed.

Re: Why use float and double instead of real?

2009-07-01 Thread Don
Lars T. Kyllingstad wrote: Is there ever any reason to use float or double in calculations? I mean, when does one *not* want maximum precision? Will code using float or double run faster than code using real? I understand they are needed for I/O and compatibility purposes, so I am by no means

Re: Why use float and double instead of real?

2009-07-02 Thread Don
BCS wrote: Hello Don, Size. Since modern CPUs are memory-bandwidth limited, it's always going to be MUCH faster to use float[] instead of real[] once the array size gets too big to fit in the cache. Maybe around 2000 elements or so. I was under the impression that the memory buss could

Re: Release binary

2009-07-13 Thread Don
Vladimir Voinkov wrote: I've noticed that constant strings are still presented in release bynary: static invariant string Abc0 = "abcdefg"; static const string Abc1 = "abcdefg"; A source compiles with -O -release and the strings are not referenced. Is linked able to optimize them out? No, th

Re: formatting floating point

2009-07-13 Thread Don
Saaa wrote: Ohh, I see. Your initial question was really vague, now that I see what you were asking. sorry You'd just have to convert each element of the array separately. I found the formatting options, they are in std.format.. (I was apparently searching for the 'g' option.. ) this seems

Re: At compile time

2009-08-05 Thread Don
Jarrett Billingsley wrote: I don't think you can call struct methods at compile-time. Kind of lame, I know. Try making norm a free function. Can the D2 compiler modified/improved to allow this? It sure would be nice. In fact the D1 compiler should support it too. BTW a few of the restrict

Re: .patch

2009-08-05 Thread Don
Dimitar Kolev wrote: BCS Wrote: Hello Dimitar, Hello I am new to D. Hello, welcome. My question is: How do you apply a .patch file? this seems to be somewhat usefull: http://docs.moodle.org/en/Development:How_to_apply_a_patch windows tools (linux will already have them): http://gnuwin

Re: A floating-point puzzle

2009-08-05 Thread Don
Lars T. Kyllingstad wrote: Lars T. Kyllingstad wrote: Here's a puzzle for you floating-point wizards out there. I have to translate the following snippet of FORTRAN code to D: REAL B,Q,T C -- C |*** COMPUTE MACHINE BASE ***| C -

  1   2   3   >