Spurious imports in Phobos ?

2011-11-09 Thread Somedude
Hello, When I display the dependencies with "dmd -deps=depends", I see that simply importing std.stdio imports dozens of modules, among which std.ranges, std.datetime, std.c.windows.winsock, std.regex, etc In fact, the depends file is 433 lines long. I noticed that std.string imports quite a lot

Re: Spurious imports in Phobos ?

2011-11-09 Thread Somedude
Le 09/11/2011 10:14, Somedude a écrit : > > My question is: how do we know if std.range, std.regex, std.traits and > std.algorithm are spurious imports or if we can (and threfore should) > remove them safely from std.string ? > > Dude I meant: how do we know if std.range, std

Re: Spurious imports in Phobos ?

2011-11-09 Thread Somedude
Le 09/11/2011 13:15, Jacob Carlborg a écrit : Phobos contains a lot of templates and if a template isn't instantiated it won't be compiled. Meaning there can be hidden compile errors if you start to remove imports and they will not show until a template that uses something from the import is inst

Re: Spurious imports in Phobos ?

2011-11-10 Thread Somedude
Le 09/11/2011 14:15, Trass3r a écrit : 2. what is your opinion about public import ? In C++, "hidden" or "implicit" #includes is a common source of compilation problems (order of #includes), I tend to think it's a bad thing. It can be quite useful. I use it often for C library wrappers. As soon

Database API

2011-11-10 Thread Somedude
Hello, what is the currently DB API considered usable today ? http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings#ODBC d-dbapi looked quite decent, but the source code is no longer available :( Thank you Dude

Re: Spurious imports in Phobos ?

2011-11-10 Thread Somedude
Le 09/11/2011 14:50, Jacob Carlborg a écrit : 2. what is your opinion about public import ? In C++, "hidden" or "implicit" #includes is a common source of compilation problems (order of #includes), I tend to think it's a bad thing. Sometimes public imports are useful. It's possible to emulate

Re: Sampling algorithms for D

2012-04-12 Thread SomeDude
On Thursday, 12 April 2012 at 16:59:31 UTC, Joseph Rushton Wakeling wrote: On 12/04/12 16:45, Joseph Rushton Wakeling wrote: What I thought I'd do is implement some clever algorithms for random sampling which I've already done in a C based on the GNU Scientific Library. I noticed that there i

Re: D 50% slower than C++. What I'm doing wrong?

2012-04-14 Thread Somedude
Le 14/04/2012 21:53, q66 a écrit : > On Saturday, 14 April 2012 at 19:05:40 UTC, ReneSac wrote: >> I have this simple binary arithmetic coder in C++ by Mahoney and >> translated to D by Maffi. I added "notrow", "final" and "pure" and >> "GC.disable" where it was possible, but that didn't made much

Re: Thread join behaviour

2012-04-14 Thread Somedude
Le 14/04/2012 18:04, Russel Winder a écrit : > I thought the following would terminate gracefully having printed 0..9 > in some (random) order: > > #! /usr/bin/env rdmd > > import std.algorithm ; > import std.range ; > import std.stdio ; > import co

Re: D 50% slower than C++. What I'm doing wrong?

2012-04-15 Thread Somedude
Le 15/04/2012 09:23, ReneSac a écrit : > On Sunday, 15 April 2012 at 02:56:21 UTC, Joseph Rushton Wakeling wrote: >>> On Saturday, 14 April 2012 at 19:51:21 UTC, Joseph Rushton Wakeling >>> wrote: GDC has all the regular gcc optimization flags available IIRC. The >> > > I notice the 2D arra

Re: Thread join behaviour

2012-04-15 Thread Somedude
Le 15/04/2012 20:40, Russel Winder a écrit : > On Sun, 2012-04-15 at 16:04 +0200, Artur Skawina wrote: > [...] >> (my old GDC needs the explicit "function", no idea if newer >> frontends still require that) > > OK, works for me with GDC as well, DMD is broken! I'll file a bug > report. > It work

Re: D 50% slower than C++. What I'm doing wrong?

2012-04-15 Thread Somedude
Le 15/04/2012 23:33, Ashish Myles a écrit : > On Sun, Apr 15, 2012 at 5:16 PM, Somedude wrote: >> Le 15/04/2012 09:23, ReneSac a écrit : >>> On Sunday, 15 April 2012 at 02:56:21 UTC, Joseph Rushton Wakeling wrote: >>>>> On Saturday, 14 April 2012 at 19:5

Re: D 50% slower than C++. What I'm doing wrong?

2012-04-15 Thread Somedude
Le 15/04/2012 23:41, Somedude a écrit : > Le 15/04/2012 23:33, Ashish Myles a écrit : >> On Sun, Apr 15, 2012 at 5:16 PM, Somedude wrote: > > Oh right, sorry for this. It's a bit confusing. Now apart from comparing the generated asm, I don't see.

Re: Thread join behaviour

2012-04-16 Thread Somedude
Le 15/04/2012 20:40, Russel Winder a écrit : > On Sun, 2012-04-15 at 16:04 +0200, Artur Skawina wrote: > [...] >> (my old GDC needs the explicit "function", no idea if newer >> frontends still require that) > > OK, works for me with GDC as well, DMD is broken! I'll file a bug > report. > Did you

"No stack address"

2012-04-16 Thread Somedude
I'm trying to compile a D source on win32 with DMD 2.059, and I get this: PS E:\DigitalMars\dmd2\samples> rdmd xinoksort.d OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 23: No Stack OP

Re: "No stack address"

2012-04-16 Thread Somedude
Le 16/04/2012 21:51, Andrej Mitrovic a écrit : > On 4/16/12, Somedude wrote: >> OPTLINK : Warning 134: No Start Address > > This means you're missing a void main or int main function. You can > pass --main to rdmd to add it automatically (useful when e.g. > unittestin

Re: "No stack address"

2012-04-17 Thread Somedude
Le 17/04/2012 01:26, Andrej Mitrovic a écrit : > On 4/17/12, Somedude wrote: >> But running the exe crashes immediately at execution with "unauthorized >> instruction". Why ? > > That's the old exectuable leftover from the previous compile. RDMD > generat

Re: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 02:01, Ali Çehreli a écrit : > On 04/16/2012 04:56 PM, darkstalker wrote: >> i have this example program: >> >> --- >> void main() >> { >> int[3] a; >> foreach (p; a) >> p = 42; >> writeln(a); >> } >> --- >> >> after running it, i expect to get [42, 42, 42] but instead i get [0, 0, >>

Re: Thread join behaviour

2012-04-17 Thread Somedude
Le 17/04/2012 08:40, Russel Winder a écrit : > On Mon, 2012-04-16 at 21:03 +0200, Somedude wrote: > [...] > > Issue 7919 > > http://d.puremagic.com/issues/show_bug.cgi?id=7919 > Thanks.

Re: Compiling Was: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 12:19, Mike Parker a écrit : > On 4/17/2012 4:42 PM, Somedude wrote: > >>> >>> Ali >>> >>> >> Hi Ali, >> >> Sorry for hijacking this thread, but since you're around, I hope you'll >> see this message. A

Re: "No stack address"

2012-04-17 Thread Somedude
Le 17/04/2012 09:30, Somedude a écrit : > Anyway, I think I'll add this simple piece of info somewhere in the > wiki. I've already cleaned it up a little. Ok, here it is: http://prowiki.org/wiki4d/wiki.cgi?HowTo/UnitTests

Re: arrays and foreach

2012-04-18 Thread Somedude
Le 17/04/2012 16:07, Ali Çehreli a écrit : > On 04/17/2012 12:42 AM, Somedude wrote: > >> Sorry for hijacking this thread, but since you're around, I hope you'll >> see this message. As a D beginner, I'm browsing through your book. >> I wanted to tell you th

Re: arrays and foreach

2012-04-18 Thread Somedude
Le 18/04/2012 10:26, Somedude a écrit : > Yes, I think that you have a lot of valuable information, but the > organization is lacking. The advanced chapters look good, but the first > "beginner" chapters can be . > ... largely improved.

Re: Hacking on Phobos

2012-04-18 Thread Somedude
Le 18/04/2012 12:04, Jacob Carlborg a écrit : > >> I can't find any easy or friendly "get started hacking on Phobos" page, >> so can anyone advise how to get set up correctly? > > I've thought about this several times, we need one badly. > I've just created a page in the Wiki with the posts her

Re: appending newly initialized struct to array

2012-04-18 Thread Somedude
Le 18/04/2012 12:41, maarten van damme a écrit : > That's a very odd design. Making it work when instantiating a new struct > of that type but not inline. Anyway, test(3,5) works perfect, thank you. It's not odd at all. You append a structure, not an array. {3,5} is for array initialization, it's

Re: learn.newbie forum

2012-04-18 Thread Somedude
Le 18/04/2012 14:19, Paul a écrit : > I think there should be a learn.newbie forum. After I post my little > problems of a sample code snippet that won't compile, I read some of the > other threads. There are those c/c++ programmers learning the ins/outs > of D and then there are the greenies lik

Re: Clearly Label D1/D2/Tango/Phobos

2012-04-18 Thread Somedude
Le 18/04/2012 14:34, Paul a écrit : > I bought the book and am trying to patiently learn this language. I > follow various tutorials here and around the web that frequently won't > compile. I suspect it has something to do with D1/D2/Phobos/Tango and > not just really poor unvetted tutorials. It

Re: Sampling algorithms for D

2012-04-18 Thread Somedude
Le 18/04/2012 05:15, Joseph Rushton Wakeling a écrit : > On 13/04/12 10:04, Dmitry Olshansky wrote: >>> OK, I'll see what I can do. I'd like to discuss and refine the design a >>> bit further before making any pull request -- should I take things over >>> to the Phobos mailing list for this ... ? >

Re: Compiling Was: arrays and foreach

2012-04-18 Thread SomeDude
On Tuesday, 17 April 2012 at 12:11:21 UTC, David wrote: In this case, I had to type: rdmd -unittest --main test.d Without the --main, I would get linker errors, and couldn't find the reason for these errors. Happily, someone here explained me that the effect of the --main flag was to insert a

Re: tupleof.length of a class in a template return 0

2012-04-18 Thread SomeDude
On Tuesday, 17 April 2012 at 00:04:16 UTC, Michaël Larouche wrote: My template works with a struct but when I try to mixin my template in a class, I get compile error because T.tupleof.length returns 0. Here's the whole code: http://ideone.com/UR6YU For what it's worth, dmd 2.059 (it seems y

Re: appending newly initialized struct to array

2012-04-18 Thread SomeDude
On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote: Ali: That a thousandth time I have made that mistake and still have not learned. :( Yes, .nan may not be compared with any other value, including .nan. Today I'll present an enhancement request to remove this problem from D. Hu

Re: appending newly initialized struct to array

2012-04-18 Thread SomeDude
On Wednesday, 18 April 2012 at 18:18:44 UTC, Ali Çehreli wrote: On 04/18/2012 10:13 AM, Jonathan M Davis wrote: > > It's by design. An enhancement request is a waste of time. Comparisons with > NaN _always_ return false regardless of what they're compared against - even > NaN. It's not going to c

Re: Is this a bug in iota?

2012-04-19 Thread Somedude
Le 19/04/2012 05:36, bearophile a écrit : > Brad Anderson: >> You can popFront() for as long as you want well passed the length. >> Obviously popping off the front of a zero length range isn't valid but >> I would have expected a range violation to occur rather than it to >> silently continuing the

Re: Is this a bug in iota?

2012-04-19 Thread Somedude
Le 19/04/2012 10:07, Jonathan M Davis a écrit : > Having an assertion may be desirable, but the bug is in the usage of iota, > not > iota itself. At best, the assertion would help indicate that the caller has a > bug. It's exactly the same as doing something like > > for(size_t i = 3; cond; --i

Re: tupleof.length of a class in a template return 0

2012-04-19 Thread Somedude
Le 19/04/2012 05:04, "Michaël Larouche" " a écrit : > > Reading the bug thread, I am wondering why my template worked in a > struct but not inside a class. > > Anyway, I decided to move my mixin outside the struct/class and abuse > UFCS instead. Now everything works like a charm :) Cool. Glad it

Re: Is this a bug in iota?

2012-04-19 Thread Somedude
Le 19/04/2012 11:11, Jonathan M Davis a écrit : > On Thursday, April 19, 2012 10:14:39 Somedude wrote: >> Le 19/04/2012 10:07, Jonathan M Davis a écrit : >>> Having an assertion may be desirable, but the bug is in the usage of iota, >>> not iota itself. At best, the as

Re: Is this a bug in iota?

2012-04-19 Thread SomeDude
On Thursday, 19 April 2012 at 11:38:39 UTC, Steven Schveighoffer wrote: On Thu, 19 Apr 2012 04:07:00 -0400, Jonathan M Davis wrote: Having an assertion may be desirable, but the bug is in the usage of iota, not iota itself. Yes, and iota should detect that bug with an assert. No case can

How does this work ?

2012-04-19 Thread Somedude
I'm going through a number of bug reports, trying to reproduce the problems and see what can be closed easily (i.e non reproduced, correct behaviour, etc), and I just came accross http://d.puremagic.com/issues/show_bug.cgi?id=7326 titled "write interprets enum with byte backing type as a character"

Re: Newbie Introduction (was Re: arrays and foreach)

2012-04-19 Thread SomeDude
On Wednesday, 18 April 2012 at 19:43:50 UTC, Paul D. Anderson wrote: SomeDude: Your outline and especially your emphasis on what a rank beginner needs to know is very good. Would you consider writing it up yourself? Not the whole thing, maybe but the beginner info and the compiler/linker

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-22 Thread SomeDude
On Saturday, 21 April 2012 at 23:24:57 UTC, Jay Norwood wrote: While playing with sorting the unzip archive entries I tried use of the last example in http://dlang.org/phobos/std_algorithm.html#sort std.algorithm.sort!("toLower(a.name) < toLower(b.name)",std.algorithm.SwapStrategy.stable)(ent

What am I doing wrong ?

2012-04-22 Thread SomeDude
Sorry for the noob questions, but import std.stdio; struct Foo { int x; } void main() { auto array = new Foo[10]; auto i = array.length; foreach(Foo f; array) { f.x = --i; write(f.x);} writeln(); foreach(Foo f; array) { write(f.x);} } gives me: PS E:\DigitalMars\dmd2\sa

Re: What am I doing wrong ?

2012-04-22 Thread SomeDude
On Sunday, 22 April 2012 at 21:50:32 UTC, Dmitry Olshansky wrote: Omagad, thank you, too much Java is bd for your brains.

Strange measurements when reproducing issue 5650

2012-04-25 Thread SomeDude
Discussion here: http://d.puremagic.com/issues/show_bug.cgi?id=5650 On my Windows box, the following program import std.stdio, std.container, std.range; void main() { enum int range = 100; enum int n = 1_000_000; auto t = redBlackTree!int(0); for (int i = 0; i < n; i++) {

Re: Strange measurements when reproducing issue 5650

2012-04-25 Thread SomeDude
On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote: Noone reproduces this ?

Re: Strange measurements when reproducing issue 5650

2012-04-25 Thread SomeDude
On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote: On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude wrote: On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote: Noone reproduces this ? On my linux box, it runs in about 580ms, with or without the writeln. This

Re: Strange measurements when reproducing issue 5650

2012-04-25 Thread SomeDude
On Wednesday, 25 April 2012 at 17:06:00 UTC, SomeDude wrote: On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote: On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude wrote: On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote: Noone reproduces this ? On my linux box

Re: Strange measurements when reproducing issue 5650

2012-04-27 Thread SomeDude
On Wednesday, 25 April 2012 at 17:37:33 UTC, H. S. Teoh wrote: First of all, differences as small as 20ms really should be considered as background noise. The exact measurements depend on a lot of system-specific and environment-specific factors, such as OS memory usage, CPU cache behaviour,

Re: Strange measurements when reproducing issue 5650

2012-04-27 Thread SomeDude
On Friday, 27 April 2012 at 14:14:37 UTC, Steven Schveighoffer wrote: Have you tried measuring the code timings just inside main instead of the full execution of the program including runtime startup and shutdown? -Steve OK, it seems you are right. It turns out using Measure-Command{...} wa

Should I wait for the new edition of TDPL ?

2012-04-28 Thread SomeDude
Hi all, Not owning TDPL right now, I feel I could learn the language much more quickly with it. But Andrei hinted somewhere that there would be a new edition of his book. Should I wait for it ?

Re: [OT] functional programming resources ?

2012-04-28 Thread SomeDude
On Friday, 27 April 2012 at 20:52:28 UTC, Mariusz Gliwiński wrote: Hello, could You recommend me some books / materials explaining different concepts in functional programming from *practical point of view*? Most preferably not requiring me to understand Haskell or other classical functional l

Re: Should I wait for the new edition of TDPL ?

2012-04-28 Thread SomeDude
On Saturday, 28 April 2012 at 19:06:27 UTC, Jesse Phillips wrote: On Saturday, 28 April 2012 at 16:27:53 UTC, SomeDude wrote: Hi all, Not owning TDPL right now, I feel I could learn the language much more quickly with it. But Andrei hinted somewhere that there would be a new edition of his

Re: Frustration [Was: mysql binding/wrapper?]

2012-05-01 Thread SomeDude
On Tuesday, 1 May 2012 at 02:04:03 UTC, Ary Manzana wrote: On 5/1/12 2:44 AM, simendsjo wrote: On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana wrote: Looking at the code of mysql.d I see a big switch with many cases like "case 0x01: // TINYINT". But then there's the SQLType enum with those c

Re: Frustration [Was: mysql binding/wrapper?]

2012-05-01 Thread SomeDude
On Tuesday, 1 May 2012 at 08:40:27 UTC, SomeDude wrote: On Tuesday, 1 May 2012 at 02:04:03 UTC, Ary Manzana wrote: On 5/1/12 2:44 AM, simendsjo wrote: On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana wrote: Looking at the code of mysql.d I see a big switch with many cases like "case

Re: mysql binding/wrapper?

2012-05-01 Thread SomeDude
On Saturday, 28 April 2012 at 17:42:42 UTC, Adam D. Ruppe wrote: On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: As it resides in this big misc repository, does it have many dependecies? It depends on the database.d module in there too. (database.d provides the base interface and

Re: A little of coordination for Rosettacode

2013-02-09 Thread SomeDude
On Tuesday, 5 February 2013 at 20:10:37 UTC, bearophile wrote: Jos van Uden: I'll give it a shot if you like. The RCRPG I'd like to try first. I have already partially written those: Partial translation of rcrpg-Python: http://codepad.org/SflrKqbT Partial translation of permutations_rank_o

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-16 Thread SomeDude
On Friday, 15 November 2013 at 22:22:32 UTC, Jacek Furmankiewicz wrote: Sohow does Facebook handle it with their new D code? No GC at all, explicit memory management? AFAWK, Facebook doesn't use D for its core business yet, only for buiding tools. OTOH, Andrei has been working hard on mem