Re: Is this a compiler bug, or a breaking fix/enhancement?

2013-05-28 Thread Kenji Hara
On Wednesday, 29 May 2013 at 04:44:16 UTC, estew wrote: Hi All, I updated to dmd 2.063 today and all has been going smoothly until I decided to try out msgpack.d. I got an error compiling the msgpack.d unittest, so out of interest I decided to check this using dmd2.062 and it compiled and ran

Re: Linker error

2013-05-28 Thread Namespace
Davis (Debug) wird erzeugt Performing main compilation... Current dictionary: C:\Users\Besitzer\Documents\Projects\Davis\Davis D:\D\dmd2\windows\bin\dmd.exe -debug -gc "main.d" "-ID:\D\dmd2\src\ext" "-ID:\D\dmd2\src\druntime\import" "-ID:\D\dmd2\src\phobos" "-odobj\Debug" "-ofC:\Users\Bes

Issue with linking to dll

2013-05-28 Thread Stephen Jones
I am trying to get my head around linking to dlls, and have been playing around with the mydll sample distributed with dmd2.062. If I create mydll.lib from implib with the driver (implib /noi /s mydll.lib mydll.dll) I get a lib file that I can link in with an interface file (dmd test.d mydll.di

Re: Linker error

2013-05-28 Thread alex
On Tuesday, 28 May 2013 at 22:28:50 UTC, Namespace wrote: I don't even understand the error. Where is a previous definition? And why? Seems like I have to switch back to 2.062. In the case of using Mono-D, could you give me your build log please? That might help! When copypasting the command,

Re: Is this a compiler bug, or a breaking fix/enhancement?

2013-05-28 Thread estew
Here's a link to the msgpack.d source: https://github.com/msgpack/msgpack-d/blob/master/src/msgpack.d And the error is on line 3211, not 3215 as mentioned in the previous post. Thanks, Stewart

Is this a compiler bug, or a breaking fix/enhancement?

2013-05-28 Thread estew
Hi All, I updated to dmd 2.063 today and all has been going smoothly until I decided to try out msgpack.d. I got an error compiling the msgpack.d unittest, so out of interest I decided to check this using dmd2.062 and it compiled and ran fine. I admit I don't really understand whether the co

Re: Failed to sort range

2013-05-28 Thread Sergei Nosov
On Tuesday, 28 May 2013 at 20:43:32 UTC, Ali Çehreli wrote: On 05/28/2013 12:47 PM, Anthony Goins wrote: > sort!("a > This worked for me with the code at your link. I've noticed that too. The reason that works is because in that case it uses Tim Sort. Apparently, the Tim Sort algorithm does n

Re: Linker error

2013-05-28 Thread Namespace
I don't even understand the error. Where is a previous definition? And why? Seems like I have to switch back to 2.062.

Re: Linker error

2013-05-28 Thread Namespace
This is still there with the new release of 2.063. [quote] OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html Graphics.lib(object) Offset 201F6H Record Type 0091 Error 1: Previous Definition Different :

direct conversion to integral type for floor, ceil, and friends that return integer as real

2013-05-28 Thread Timothee Cour
What's the most efficient way to convert a float/double/real to an integer type with a specified rounding scheme (eg floor/ceil etc)? Is there anything besides: int x=floor(1.2); ? there's also core.stdc.math.floor{l,f,} Because these first convert to floating point representation and then then t

Re: Immutability vs reference types

2013-05-28 Thread Ali Çehreli
On 05/27/2013 05:24 PM, Francois Chabot wrote: > If with immutable(Type)[], I can have a re-assignable reference > to arrays of immutable data, I really should be able to have some > form of syntactical equivalent for single instances. But there > just doesn't seem to be one. Immutability for ref

Re: iteration over a string

2013-05-28 Thread bearophile
Timothee Cour: 3A) why not having an Enumerate(R) containing a single 'opApply' public method, Unfortunately opApply doesn't not work well with all the other range-based functions. Also that Enumerate code is for illustrative purposes, it's not meant to be good library code. 3B) requiri

Re: Where does the log get written when there's a core dump?

2013-05-28 Thread Adam D. Ruppe
On Tuesday, 28 May 2013 at 21:06:14 UTC, Gary Willoughby wrote: playing and I got a message of a seg fault and a core dump written to a log. like this? Segmentation fault (core dumped) That's actually more of a linux thing than a D thing. The file will be called "core" in the current direct

Where does the log get written when there's a core dump?

2013-05-28 Thread Gary Willoughby
I was trying some funky stuff with D, not real code just playing and I got a message of a seg fault and a core dump written to a log. I just wondered where these logs are written to. It's not immediately apparent where it is.

Re: iteration over a string

2013-05-28 Thread Timothee Cour
Thanks for the enumerate pointer. 3A) why not having an Enumerate(R) containing a single 'opApply' public method, to avoid returning tuples in 'front()' 3B) requiring one to use 'myrange.enumerate' for inputRanges and 'myrange' in other cases is bad for generic programming and user time. This is

Re: Failed to sort range

2013-05-28 Thread Ali Çehreli
On 05/28/2013 12:47 PM, Anthony Goins wrote: > sort!("a > This worked for me with the code at your link. I've noticed that too. The reason that works is because in that case it uses Tim Sort. Apparently, the Tim Sort algorithm does not expose the bugs that were in the code. Ali

Re: Failed to sort range

2013-05-28 Thread Anthony Goins
On Tuesday, 28 May 2013 at 12:57:12 UTC, Sergei Nosov wrote: Hi! I'm trying to implement an array, which uses malloc to allocate memory. Also, I want to implement a random access range interface for it. That went pretty well, until I tried to sort it. Sorting function asserted "Failed to so

Re: Failed to sort range

2013-05-28 Thread Sergei Nosov
On Tuesday, 28 May 2013 at 18:38:01 UTC, Ali Çehreli wrote: On 05/28/2013 11:31 AM, Ali Çehreli wrote: > @property Array!T opSlice(size_t i, size_t j) { > // ... > ret.front_ = i; > > I feel like the initialization of front_ above is not right either. > Imagine quick sort

Re: Failed to sort range

2013-05-28 Thread Ali Çehreli
On 05/28/2013 11:31 AM, Ali Çehreli wrote: > @property Array!T opSlice(size_t i, size_t j) { > // ... > ret.front_ = i; > > I feel like the initialization of front_ above is not right either. > Imagine quick sort where we are slicing the right-hand side of a range > as [0..

Re: Failed to sort range

2013-05-28 Thread Ali Çehreli
On 05/28/2013 11:19 AM, Sergei Nosov wrote: > Do you mean it's a good idea > to separate storage and access (via range) to the container? Like > std.container's containers (heh) have nested Range struct? Yes, that is generally the right approach. Note that built-in arrays have a similar design

Re: Failed to sort range

2013-05-28 Thread Sergei Nosov
Thx, Ali! 1) First, an observation: This Array design conflates the concepts of container and range. If there are actual elements that are being stored (as opposed to elements being generated), it is better tha a range merely provides access to those elements. popFront should consume the rang

Re: iteration over a string

2013-05-28 Thread bearophile
Timothee Cour: Where do you think it can cause clashing? I don't know. But my solution is to introduce a simple "enumerate" range: http://d.puremagic.com/issues/show_bug.cgi?id=5550 So if you have a range and you don't need indexes you use: foreach (item; myrange) {} If you also want an in

Re: iteration over a string

2013-05-28 Thread Jonathan M Davis
On Tuesday, May 28, 2013 03:05:52 Timothee Cour wrote: > 2A) > Thanks for your answer; > > You skipped over this one, which I don't understand: > > string a="ΩΩab"; > > auto b1=a.map!(a=>"<"d~a~">"d).array; > > writeln(b1);//["<Ω>", "<Ω>", "", "", "", ""] > > Why are there 2 empty strings at the e

Re: Failed to sort range

2013-05-28 Thread Ali Çehreli
On 05/28/2013 05:57 AM, Sergei Nosov wrote: Hi! I'm trying to implement an array, which uses malloc to allocate memory. Also, I want to implement a random access range interface for it. That went pretty well, until I tried to sort it. Sorting function asserted "Failed to sort range of type Arra

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread Kenji Hara
On Tuesday, 28 May 2013 at 11:49:25 UTC, Gary Willoughby wrote: Why does the following snippet print: "Started name revision" instead of "Started my-app 1.0a"? import std.stdio; enum application : string { name = "my-app", revision = "1.0a", } void main(string[] arguments)

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread bearophile
On Tuesday, 28 May 2013 at 14:35:22 UTC, Jesse Phillips wrote: I do not believe this is a bug. You are right, I was wrong. writeln is meant to write the name of enums and not their contents. Bye, bearophile

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread Jesse Phillips
I do not believe this is a bug. You should be able to print the value by casting to string. (to!() will not work as it will provide the same results) Usually enumeration values are not descriptive for how they should be used. And when printing to the screen it is usually for debugging or some

Re: Failed to sort range

2013-05-28 Thread Sergei Nosov
On Tuesday, 28 May 2013 at 13:41:19 UTC, bearophile wrote: Sergei Nosov: That went pretty well, until I tried to sort it. Sorting function asserted "Failed to sort range of type Array!(int)." If you take a look a the implementation of Phobos sort, you see there is a recently added runtime te

Re: Failed to sort range

2013-05-28 Thread bearophile
Sergei Nosov: That went pretty well, until I tried to sort it. Sorting function asserted "Failed to sort range of type Array!(int)." If you take a look a the implementation of Phobos sort, you see there is a recently added runtime test mostly meant to catch wrongly implemented comparison fun

Re: Failed to sort range

2013-05-28 Thread Sergei Nosov
On Tuesday, 28 May 2013 at 12:57:12 UTC, Sergei Nosov wrote: Hi! I'm trying to implement an array, which uses malloc to allocate memory. Also, I want to implement a random access range interface for it. That went pretty well, until I tried to sort it. Sorting function asserted "Failed to so

Re: Passing large or complex data structures to threads

2013-05-28 Thread Joseph Rushton Wakeling
On 05/28/2013 08:56 AM, Ali Çehreli wrote: > That is a difficult situation to manage though: What operations are valid > under > the 8 total mutable combinations of 3 members? The compiler must know what > operations to be applied on what type of data so that it can both check the > code > and co

Failed to sort range

2013-05-28 Thread Sergei Nosov
Hi! I'm trying to implement an array, which uses malloc to allocate memory. Also, I want to implement a random access range interface for it. That went pretty well, until I tried to sort it. Sorting function asserted "Failed to sort range of type Array!(int)." I've spent quite some time tr

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread John Colvin
On Tuesday, 28 May 2013 at 12:16:51 UTC, John Colvin wrote: There really ought to be a property .value of enums. or alternatively .name of course. Either way there should be a way to choose whether you want the name or the value.

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread John Colvin
On Tuesday, 28 May 2013 at 11:49:25 UTC, Gary Willoughby wrote: Why does the following snippet print: "Started name revision" instead of "Started my-app 1.0a"? import std.stdio; enum application : string { name = "my-app", revision = "1.0a", } void main(string[] arguments)

Re: Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread bearophile
Gary Willoughby: Why does the following snippet print: "Started name revision" instead of "Started my-app 1.0a"? import std.stdio; enum application : string { name = "my-app", revision = "1.0a", } void main(string[] arguments) { writefln("Started %s %s", application.name

Why does this snippet print the enum identifiers instead of their values?

2013-05-28 Thread Gary Willoughby
Why does the following snippet print: "Started name revision" instead of "Started my-app 1.0a"? import std.stdio; enum application : string { name = "my-app", revision = "1.0a", } void main(string[] arguments) { writefln("Started %s %s", application.name, application.revi

Re: Two questions about assignments

2013-05-28 Thread bearophile
I will add it to Bugzilla then, if it's not already there. http://d.puremagic.com/issues/show_bug.cgi?id=10192 Bye, bearophile

Re: How do you guys debug large programs?

2013-05-28 Thread Timon Gehr
On 05/27/2013 09:55 PM, Gary Willoughby wrote: This is quite an open ended question but i wondered how you guys debug your D programs (i'm talking about stepping through code, setting breakpoints, etc). The lack of nice IDE's with integrated debuggers is worrying when working with D but up until

Re: How do you guys debug large programs?

2013-05-28 Thread estew
Sorry, ignore the two lines stating "Then (12 months ago):" and "Now:". They are a cut-paste schmozzle and shouldn't be there...no edits of posts?. My middle mouse button is both a blessing an a curse :) Stewart

Re: How do you guys debug large programs?

2013-05-28 Thread estew
Then (12 months ago): If you're on linux and after VStudio style debugging in the GUI then I found QtCreator worked well. I was just using the Qt SDK bundle but it should work just from the QtCreator download (saves installing the monolithic Qt development libs). I would build the D applica

Re: iteration over a string

2013-05-28 Thread Timothee Cour
On Tue, May 28, 2013 at 3:20 AM, bearophile wrote: > Timothee Cour: > > string a="ΩΩab"; >>> auto b1=a.map!(a=>"<"d~a~">"d).**array; >>> writeln(b1);//["<Ω>", "<Ω>", "", "", "", ""] >>> Why are there 2 empty strings at the end? (one per Omega if you vary the >>> >> number of such symbols in the s

Re: iteration over a string

2013-05-28 Thread bearophile
I think it's a bug, it's shown here, I will put it in Bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=10191 Bye, bearophile

Re: iteration over a string

2013-05-28 Thread bearophile
Timothee Cour: string a="ΩΩab"; auto b1=a.map!(a=>"<"d~a~">"d).array; writeln(b1);//["<Ω>", "<Ω>", "", "", "", ""] Why are there 2 empty strings at the end? (one per Omega if you vary the number of such symbols in the string). The above is just weird; is that a bug? I think it's a bug, it's

Re: iteration over a string

2013-05-28 Thread Timothee Cour
2A) Thanks for your answer; You skipped over this one, which I don't understand: > string a="ΩΩab"; > auto b1=a.map!(a=>"<"d~a~">"d).array; > writeln(b1);//["<Ω>", "<Ω>", "", "", "", ""] > Why are there 2 empty strings at the end? (one per Omega if you vary the number of such symbols in the string

Re: iteration over a string

2013-05-28 Thread Jonathan M Davis
On Tuesday, May 28, 2013 00:26:03 Timothee Cour wrote: > Questions regarding iteration over code points of a utf8 string: > > In all that follows, I don't want to go through intermediate UTF32 > representation by making a copy of my string, but I want to iterate over > its code points. > > say my

Re: How do you guys debug large programs?

2013-05-28 Thread Timothee Cour
On Tue, May 28, 2013 at 12:32 AM, nazriel wrote: > On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote: > >> This is quite an open ended question but i wondered how you guys debug >> your D programs (i'm talking about stepping through code, setting >> breakpoints, etc). The lack of nice

Re: iteration over a string

2013-05-28 Thread Diggory
Most algorithms for strings need the offset rather than the character index, so: foreach (i; dchar c; str) Gives the offset into the string for "i" If you really need the character index just count it: int charIndex = 0; foreach (dchar c; str) { // ... ++charIndex; } If strings were t

Re: iteration over a string

2013-05-28 Thread Ali Çehreli
On 05/28/2013 12:42 AM, Ali Çehreli wrote: > The output: > > Ω a b c Rather: 0,Ω 1,a 2,b 3,c Ali

Re: iteration over a string

2013-05-28 Thread Ali Çehreli
On 05/28/2013 12:26 AM, Timothee Cour wrote: > In all that follows, I don't want to go through intermediate UTF32 > representation by making a copy of my string, but I want to iterate over > its code points. Yes, the whole situation is a little messy. :) There is also std.range.stride: for

Re: How do you guys debug large programs?

2013-05-28 Thread nazriel
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote: This is quite an open ended question but i wondered how you guys debug your D programs (i'm talking about stepping through code, setting breakpoints, etc). The lack of nice IDE's with integrated debuggers is worrying when working wi

Re: How do you guys debug large programs?

2013-05-28 Thread Nathan M. Swan
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote: This is quite an open ended question but i wondered how you guys debug your D programs (i'm talking about stepping through code, setting breakpoints, etc). The lack of nice IDE's with integrated debuggers is worrying when working wi

iteration over a string

2013-05-28 Thread Timothee Cour
Questions regarding iteration over code points of a utf8 string: In all that follows, I don't want to go through intermediate UTF32 representation by making a copy of my string, but I want to iterate over its code points. say my string is declared as: string a="Ωabc"; //if email reader screws thi

Re: Passing large or complex data structures to threads

2013-05-28 Thread Ali Çehreli
On 05/27/2013 06:55 PM, Joseph Rushton Wakeling wrote: > On 05/27/2013 11:33 PM, Simen Kjaeraas wrote: >> Short answer: If you will have mixed arrays, no. There's no way to make >> that safe. If you don't have mixed arrays, there are ways. > > So you mean there's no way to have one member variab