dmd v2.065 compatibility

2014-03-14 Thread Chris
[1] Yesterday I tried to build a project with dub. dub had downloaded and installed dmd v2.065. The project and accompanying library had been built with dmd v2.064. dub said that the project was up to date and didn't need compiling. However, I got a long long error message informing me that

Re: dmd v2.065 compatibility

2014-03-14 Thread bearophile
Chris: [2] Another issue I encountered was when I recompiled the library, dmd 2.065 gave me an error that a goto statement skipped a variable. The case is as follows: if (condition) { goto Label; } auto variable = getVariableValue(); // Only needed, if condition above not true // do

Re: dmd v2.065 compatibility

2014-03-14 Thread Chris
On Friday, 14 March 2014 at 10:49:57 UTC, bearophile wrote: Chris: [2] Another issue I encountered was when I recompiled the library, dmd 2.065 gave me an error that a goto statement skipped a variable. The case is as follows: if (condition) { goto Label; } auto variable =

Re: dmd v2.065 compatibility

2014-03-14 Thread bearophile
Chris: Thanks for the answer. Any particular reason why the variable declaration should not be skipped? Security? Code generation? In D all variables get initialized at the definition point (unless you add a = void). A goto skips this initialization, and this breaks certain safety generates

Re: dmd v2.065 compatibility

2014-03-14 Thread bearophile
In D all variables get initialized at the definition point (unless you add a = void). A goto skips this initialization, and this breaks certain safety generates D relies on. Look for @safe functions: void main() @safe { int* p = void; } test.d(2,10): Error: variable test.main.p void

Re: dmd v2.065 compatibility

2014-03-14 Thread Chris
On Friday, 14 March 2014 at 11:14:15 UTC, bearophile wrote: Chris: Thanks for the answer. Any particular reason why the variable declaration should not be skipped? Security? Code generation? In D all variables get initialized at the definition point (unless you add a = void). A goto skips

Re: dmd v2.065 compatibility

2014-03-14 Thread Dicebot
On Friday, 14 March 2014 at 11:41:49 UTC, Chris wrote: Interesting, though, that I got away with it until v2.065. DMD still has quite a lot of accepts-invalid bugs.

Re: dmd v2.065 compatibility

2014-03-14 Thread Mike Parker
On 3/14/2014 7:43 PM, Chris wrote: [1] Yesterday I tried to build a project with dub. dub had downloaded and installed dmd v2.065. The project and accompanying library had been I'm curious what you mean by this. I don't see any way to get DMD through dub. built with dmd v2.064. dub said

Re: dmd v2.065 compatibility

2014-03-14 Thread Mike Parker
On 3/14/2014 7:43 PM, Chris wrote: [3] Last but not least, could [2] have triggered the error I got in [1]? [Part of error message] source/lib//libdlts.a(regex_770_e66.o): In function

Function tuples

2014-03-14 Thread bearophile
This comes from a Rosettacode entry: http://rosettacode.org/wiki/First-class_functions#D import std.stdio, std.math, std.typetuple, std.functional; enum static sin = (in real x) pure nothrow = std.math.sin(x), asin = (in real x) pure nothrow = std.math.asin(x), cos =

Re: dmd v2.065 compatibility

2014-03-14 Thread Chris
On Friday, 14 March 2014 at 14:11:45 UTC, Mike Parker wrote: On 3/14/2014 7:43 PM, Chris wrote: [1] Yesterday I tried to build a project with dub. dub had downloaded and installed dmd v2.065. The project and accompanying library had been I'm curious what you mean by this. I don't see any

Re: Get Compile Errors - Command Line

2014-03-14 Thread bearophile
Bauss: When compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there was anything. Thanks. Probably you have to use redirect to

Get Compile Errors - Command Line

2014-03-14 Thread Bauss
When compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there was anything. Thanks.

Re: Function tuples

2014-03-14 Thread Ali Çehreli
On 03/14/2014 09:37 AM, bearophile wrote: This comes from a Rosettacode entry: http://rosettacode.org/wiki/First-class_functions#D import std.stdio, std.math, std.typetuple, std.functional; enum static sin = (in real x) pure nothrow = std.math.sin(x), asin = (in real x) pure

Re: Get Compile Errors - Command Line

2014-03-14 Thread Bauss
On Friday, 14 March 2014 at 16:58:09 UTC, bearophile wrote: Bauss: When compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there

Re: Function tuples

2014-03-14 Thread John Colvin
On Friday, 14 March 2014 at 17:10:53 UTC, John Colvin wrote: On Friday, 14 March 2014 at 16:38:00 UTC, bearophile wrote: This comes from a Rosettacode entry: http://rosettacode.org/wiki/First-class_functions#D import std.stdio, std.math, std.typetuple, std.functional; enum static sin = (in

Re: Function tuples

2014-03-14 Thread John Colvin
On Friday, 14 March 2014 at 16:38:00 UTC, bearophile wrote: This comes from a Rosettacode entry: http://rosettacode.org/wiki/First-class_functions#D import std.stdio, std.math, std.typetuple, std.functional; enum static sin = (in real x) pure nothrow = std.math.sin(x), asin = (in

Re: alignment of struct

2014-03-14 Thread TJB
On Friday, 14 March 2014 at 00:07:12 UTC, bearophile wrote: Justin Whear: It did change a few versions ago (not sure exactly when). Try adding `align(1):` inside the structs before the members. Yes it's a recent change, the align() on outside is the alignment of the whole struct, and the

Re: Function tuples

2014-03-14 Thread bearophile
Ali Çehreli: DMD64 D Compiler v2.066-devel-1a70764 prints the following for me: 0.500 0.500 0.500 0.500 0.500 0.500 Maybe a bug fixed? Probably yes, thank for all the answers :-) Bye, bearophile

Re: Function tuples

2014-03-14 Thread bearophile
John Colvin: (You can't define a staticZip in D?) You can. I hope it will end up in in std.meta, along with a whole load of other such goodies that I've been working on :) Is the code for staticZip somewhere online? Bye, bearophile

Re: Improving IO Speed

2014-03-14 Thread bearophile
TJB: Do you have any suggestions for improving the speed in this situation? I have never used readExact so far, so I don't have many suggestions. But try to not pack the struct. Bye, bearophile

Re: Improving IO Speed

2014-03-14 Thread monarch_dodra
On Friday, 14 March 2014 at 18:26:36 UTC, bearophile wrote: TJB: Do you have any suggestions for improving the speed in this situation? I have never used readExact so far, so I don't have many suggestions. But try to not pack the struct. Given he's using a raw read, I suspect he doesn't

Re: Improving IO Speed

2014-03-14 Thread monarch_dodra
On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: Do you have any suggestions for improving the speed in this situation? Thank you! TJB I expect you'd get better performance with std.stdio rather than std.stream. stream is class based and (AFAIK) not as optimized for performance. I'd

Re: Improving IO Speed

2014-03-14 Thread Craig Dillabaugh
On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: I have a program in C++ that I am translating to D as a way to investigate and learn D. The program is used to process potentially hundreds of TB's of financial transactions data so it is crucial that it be performant. Right now the C++

Re: to! converting 1D to 2D array

2014-03-14 Thread Chris Williams
On Friday, 14 March 2014 at 04:36:27 UTC, ed wrote: As to whether or not this should work: int[4] a=[1,2,3,4]; int[2][2] b; b=a; is up to the D language gurus. I think it should... but I'm no language developer, there may be other side-effects I haven't thought about. Cheers, ed In C,

Re: Test

2014-03-14 Thread Timothee Cour
On 3/22/05, 3:00 PM, AEon wrote: Jan Knepper wrote: Testing Modzilla Thunderbird... AEon test

Re: Improving IO Speed

2014-03-14 Thread TJB
On Friday, 14 March 2014 at 19:11:12 UTC, Craig Dillabaugh wrote: On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: I have a program in C++ that I am translating to D as a way to investigate and learn D. The program is used to process potentially hundreds of TB's of financial transactions

Array initialisation vs assignment

2014-03-14 Thread ed
Hi All, I would expect both blocks of code below to behave in the same manner but they don't. --- void main() { int[] a = [1,2,3,4]; int[2][2] b = a; // fine, does an array copy } --- void main() { int[] a=[1,2,3,4]; int[2][2] b; b = a; // compile time error } --- Is it a

Re: Array initialisation vs assignment

2014-03-14 Thread bearophile
ed: void main() { int[] a = [1,2,3,4]; int[2][2] b = a; // fine, does an array copy } Is it a bug or by design? That looks like a compiler bug. You are supposed to use a cast to do an assignment like that. Bye, bearophile

Re: Array initialisation vs assignment

2014-03-14 Thread ed
On Friday, 14 March 2014 at 23:10:57 UTC, bearophile wrote: ed: void main() { int[] a = [1,2,3,4]; int[2][2] b = a; // fine, does an array copy } Is it a bug or by design? That looks like a compiler bug. You are supposed to use a cast to do an assignment like that. Bye,

Re: to! converting 1D to 2D array

2014-03-14 Thread ed
On Friday, 14 March 2014 at 19:24:21 UTC, Chris Williams wrote: It looks like you might be right after all about the code being invalid D. It could be a bug when it compiles without the cast. I filed a bug report about it, see where it leads :D Thanks, ed

Regarding fixed size arrays

2014-03-14 Thread bearophile
A small question about the D type system. Currently this code doesn't compile: int[5] foo(int[2] a, int[3] b) { return a ~ b; } void main() {} test.d(2,12): Error: cannot implicitly convert expression (cast(int[])a ~ cast(int[])b) of type int[] to int[5] But I think it's easy to

Re: Regarding fixed size arrays

2014-03-14 Thread Chris Williams
On Saturday, 15 March 2014 at 00:11:22 UTC, bearophile wrote: Do you think it's useful/worth supporting code like that? My expectation would be that your code is implicitly the same as: int[5] foo(int[2] a, int[3] b) { int[5] staticArray; int[] dynamicArray = a ~ b; staticArray =

Re: Regarding fixed size arrays

2014-03-14 Thread Meta
On Saturday, 15 March 2014 at 00:11:22 UTC, bearophile wrote: Do you think it's useful/worth supporting code like that? Yes, I'm surprised that doesn't currently work. I hate how static arrays throw away their length at the drop of a hat. In the meantime, here's a workaround: T[N + M]

Re: Regarding fixed size arrays

2014-03-14 Thread Meta
On Saturday, 15 March 2014 at 01:14:02 UTC, Meta wrote: On Saturday, 15 March 2014 at 00:11:22 UTC, bearophile wrote: Do you think it's useful/worth supporting code like that? Yes, I'm surprised that doesn't currently work. I hate how static arrays throw away their length at the drop of a

Re: Get Compile Errors - Command Line

2014-03-14 Thread Chris Williams
On Friday, 14 March 2014 at 17:10:46 UTC, Bauss wrote: I'm using dmd.exe and not cmd.exe dmd.exe doesn't have a GUI. You're probably running dmd.exe inside cmd.exe. dmd foo.d mylog.txt

Re: Regarding fixed size arrays

2014-03-14 Thread bearophile
Chris Williams: Short of changing the standard to consider a = b to be equivalent to a[] = b when both a and b are arrays, I don't think your code should be handled. And I think such a change would be dangerous.. I think I was the one that has asked for the systematic introduction of such