Re: Bypassing the postblit?

2013-12-26 Thread John Colvin
On Thursday, 26 December 2013 at 05:06:26 UTC, Ritu wrote: Dear D Experts I have a situation where I want to pass a D struct object as an argument to a function. Now in my case, I do not want to invoke the default D copy constructor for the struct. Is there a way of doing that? I have tried d

Re: D has 22 place at the Tiobe index

2013-12-26 Thread John Colvin
On Thursday, 26 December 2013 at 03:34:55 UTC, Joakim wrote: The problem with web devs is that D is too heavy for them. This is why most of them use php, maybe ruby or java, and not C++. I think D doing well in web dev is a lost cause, better to focus on native GUI apps, especially on mobile.

Re: std.complex

2013-12-26 Thread Shammah Chancellor
On 2013-12-20 16:25:53 +, Joseph Rushton Wakeling said: On 26/11/13 17:28, Andrei Alexandrescu wrote: On 11/26/13 3:22 AM, Joseph Rushton Wakeling wrote: So, as other people have suggested, really the only thing we can reasonably do is to define a separate Imaginary type I agree. Let's m

Re: Bug report (sorry, couldn't register at bugzilla for some reason)

2013-12-26 Thread Jakob Ovrum
On Thursday, 26 December 2013 at 05:01:08 UTC, Hannes Steffenhagen wrote: I'm not sure what's the cause and I don't know enough about dmd's internals to make an educated guess, but I'm pretty sure this is a bug in dmd and not in LuaD. Indeed it is a DMD regression. I haven't been able to reduc

Re: Reserving/Preallocating associative array?

2013-12-26 Thread bearophile
GC.disable; size_t[size_t] unions; foreach (line; "input.txt".File.byLineFast) { line.munch(" \t"); // skip ws immutable i = line.parse!size_t; line.munch(" \t"); // skip ws immutable j = line.parse!size_t; unions[i] = j; } GC.enable; }

Re: Reserving/Preallocating associative array?

2013-12-26 Thread thedeemon
On Thursday, 26 December 2013 at 14:09:29 UTC, bearophile wrote: A question for people that know something about the D garbage collector: can it be added some logic to the GC to detect the situations where you have to allocate many times very frequently, and disable or rarefy the collection fr

Re: D has 22 place at the Tiobe index

2013-12-26 Thread Joakim
On Thursday, 26 December 2013 at 05:55:08 UTC, Rikki Cattermole wrote: I disagree with D not having a good chance at web development. PHP is a good language for small to medium sites that need to be done quickly. But if you need to scale or do anything complex its really not a good solution. Th

Re: Reserving/Preallocating associative array?

2013-12-26 Thread Benjamin Thaut
Am 25.12.2013 21:26, schrieb Gordon: On Wednesday, 25 December 2013 at 18:51:22 UTC, Andrei Alexandrescu wrote: On 12/25/13 10:25 AM, John Colvin wrote: Gordon, you may find this has better performance if you add () to sort. Also, can you share your data somewhere if it's not confidential?

Can D be Interpreted?

2013-12-26 Thread Jeroen Bollen
Are there any programs allowing to interpret D and run it similarly to how you would run a Python application? It doesn't need to have the whole Window support, just console application using just the standard Phobos library is more than enough.

Re: Can D be Interpreted?

2013-12-26 Thread Jernej Krempus
On Thu, 26 Dec 2013 18:50:25 +, Jeroen Bollen wrote: > Are there any programs allowing to interpret D and run it similarly to > how you would run a Python application? It doesn't need to have the > whole Window support, just console application using just the standard > Phobos library is more

Re: Can D be Interpreted?

2013-12-26 Thread Iain Buclaw
On 26 December 2013 18:50, Jeroen Bollen wrote: > Are there any programs allowing to interpret D and run it similarly to how > you would run a Python application? It doesn't need to have the whole Window > support, just console application using just the standard Phobos library is > more than enou

Re: Reserving/Preallocating associative array?

2013-12-26 Thread Gordon
On Thursday, 26 December 2013 at 18:07:38 UTC, Benjamin Thaut wrote: Did you use D to convert that SQL dump to tabular data? If so, could you post the small snippet? If not did you convert the "relationship" table? No, I use "D" for some internal experimentation. To get the data as tabular I

Re: Can D be Interpreted?

2013-12-26 Thread thedeemon
On Thursday, 26 December 2013 at 18:50:27 UTC, Jeroen Bollen wrote: Are there any programs allowing to interpret D and run it similarly to how you would run a Python application? If you don't mean interactively, then "rdmd prog.d" will act just as "python prog.py" or "ruby prog.rb" etc.

Re: Can D be Interpreted?

2013-12-26 Thread Rémy Mouëza
To execute a D source file as one would do with a Python script, you can use rdmd. On Linux, you can make your can directly execute D source file by changing its mode (chmod u+x file.d) and adding a "shebang" first line like: #!/usr/bin/rdmd --shebang -I/path/to/libs -L-L/path/to/libs -L-lyourL

Re: Can D be Interpreted?

2013-12-26 Thread bearophile
Rémy Mouëza: There also have been several projects to make a D REPL, I'd like a good REPL in the default distributions, because it's an useful tool to speed up coding, to test and try things, it's very useful if you want to use D for exploratory coding, and it's kind of standard if you want

Re: D.git

2013-12-26 Thread Vladimir Panteleev
On Wednesday, 25 December 2013 at 13:16:20 UTC, Vladimir Panteleev wrote: On Wednesday, 25 December 2013 at 02:19:24 UTC, Vladimir Panteleev wrote: https://github.com/CyberShadow-D/D Hmm, looks like it's spamming the D repositories because of the hyperlinks :( https://github.com/D-Programmi

Re: Can D be Interpreted?

2013-12-26 Thread Manu
On 27 December 2013 06:59, bearophile wrote: > Rémy Mouëza: > > > There also have been several projects to make a D REPL, >> > > I'd like a good REPL in the default distributions, because it's an useful > tool to speed up coding, to test and try things, it's very useful if you > want to use D fo

Modifing local variables with anonymous delegate?

2013-12-26 Thread Gordon
Hello, A question regarding delegates and local variables: I have the following code, which seems to indicate the delegate function can access "b", but makes a private copy of it, instead of using the "real" b. --- import std.stdio; import std.algorithm; void main() { int[] a = [1,1,1

Re: Can D be Interpreted?

2013-12-26 Thread Joseph Rushton Wakeling
On Thursday, 26 December 2013 at 22:01:40 UTC, Manu wrote: In my experience with vibe.d, it's a massive pain in the arse that it's compiled. It seems to me that web dev involves squillions of micro-changes and tweaks, and it's bloody annoying to compile and reboot the server every time. vibe.

Re: Modifing local variables with anonymous delegate?

2013-12-26 Thread Timon Gehr
On 12/27/2013 12:23 AM, Gordon wrote: Hello, A question regarding delegates and local variables: I have the following code, which seems to indicate the delegate function can access "b", but makes a private copy of it, instead of using the "real" b. --- ... Map is a lazy range. --- import std.

Re: Modifing local variables with anonymous delegate?

2013-12-26 Thread Adam D. Ruppe
On Thursday, 26 December 2013 at 23:23:02 UTC, Gordon wrote: But the "b" in "main" retains its original value of 42. Try printing the b in main again AFTER printing c. You should see the change. std.algorithm for the most part doesn't actually do any of its calculations until it has to. Thi

Re: Can D be Interpreted?

2013-12-26 Thread Adam D. Ruppe
On Thursday, 26 December 2013 at 23:37:07 UTC, Joseph Rushton Wakeling wrote: Could it be workable to have a minimal server + plugins design akin to what you did with Remedy for game functionality? You could also just use CGI, which doesn't require any restart for changes, and can also easily

Re: Modifing local variables with anonymous delegate?

2013-12-26 Thread Gordon
On Thursday, 26 December 2013 at 23:52:09 UTC, Adam D. Ruppe wrote: On Thursday, 26 December 2013 at 23:23:02 UTC, Gordon wrote: But the "b" in "main" retains its original value of 42. Try printing the b in main again AFTER printing c. You should see the change. std.algorithm for the most p

Re: D.git

2013-12-26 Thread Martin Nowak
On 12/25/2013 02:16 PM, Vladimir Panteleev wrote: Hmm, looks like it's spamming the D repositories because of the hyperlinks :( https://github.com/D-Programming-Language/dmd/pull/3016 Sorry about that. I disabled updating until I get a reply from GitHub tech support. Yikes, I remember writin

Re: Can D be Interpreted?

2013-12-26 Thread Martin Nowak
On 12/26/2013 11:01 PM, Manu wrote: In my experience with vibe.d, it's a massive pain in the arse that it's compiled. It seems to me that web dev involves squillions of micro-changes and tweaks, and it's bloody annoying to compile and reboot the server every time. vibe.d apps should be compiled f

Re: Can D be Interpreted?

2013-12-26 Thread Martin Nowak
On 12/26/2013 08:15 PM, Iain Buclaw wrote: I've been tempted to implement D in Guile - which is a cool extension language platform. Implementing D ontop of its VM would make it effectively a REPL (with one or two features missing). But when will I ever get time to do this? Probably never.:) I

does std.file.slurp work with string data field?

2013-12-26 Thread Big Tummy
I have a file containing data like, --- data.txt --- abc, 1 def, 2 --- end data.txt --- I try to read in the data like following, but the the codes do not compile: --- mytest.d --- import std.file, std.stdio; void main() { auto arr = "data.txt".slurp!(string, int)("%s, %s"); foreach(a

Re: Bypassing the postblit?

2013-12-26 Thread Ritu
D struct copying is done by a bit-level copy of the source. A postblit - the closest we have to a struct copy constructor - is only run if you specify one yourself, i.e. there is no default one to disable. Thanks John Ok. Let me rephrase the question. I do not want to perform bit-wise copy

Re: Bypassing the postblit?

2013-12-26 Thread Ali Çehreli
On 12/26/2013 05:43 PM, Ritu wrote: >> D struct copying is done by a bit-level copy of the source. A postblit >> - the closest we have to a struct copy constructor - is only run if >> you specify one yourself, i.e. there is no default one to disable. > > Thanks John > > Ok. Let me rephrase the qu

Re: does std.file.slurp work with string data field?

2013-12-26 Thread bearophile
Big Tummy: auto arr = "data.txt".slurp!(string, int)("%s, %s"); Use (I also have added a space after the second %s because slurp is buggy with Windows-style newlines): auto arr = slurp!(string, int)("data.txt", "%s, %s "); Bye, bearophile

Re: does std.file.slurp work with string data field?

2013-12-26 Thread bearophile
auto arr = slurp!(string, int)("data.txt", "%s, %s "); Sorry, ignore this because it's essentially the same code as yours. What's the error you are receiving? (And better to ask such questions in D.learn). Bye, bearophile

Re: does std.file.slurp work with string data field?

2013-12-26 Thread Big Tummy
On Friday, 27 December 2013 at 02:05:42 UTC, bearophile wrote: Big Tummy: auto arr = "data.txt".slurp!(string, int)("%s, %s"); Use (I also have added a space after the second %s because slurp is buggy with Windows-style newlines): auto arr = slurp!(string, int)("data.txt", "%s, %s ");

Re: does std.file.slurp work with string data field?

2013-12-26 Thread Ali Çehreli
On 12/26/2013 06:16 PM, Big Tummy wrote: On Friday, 27 December 2013 at 02:05:42 UTC, bearophile wrote: Big Tummy: auto arr = "data.txt".slurp!(string, int)("%s, %s"); Use (I also have added a space after the second %s because slurp is buggy with Windows-style newlines): auto arr = slurp

Re: Reserving/Preallocating associative array?

2013-12-26 Thread Marco Leise
Am Wed, 25 Dec 2013 16:12:09 + schrieb "Gordon" : > On Wednesday, 25 December 2013 at 08:27:53 UTC, Philippe Sigaud > wrote: > > Out of curiosity, do you know which one of his 3 suggestions > > brought you > > the highest speed boost? What happens if you do not disable the > > GC, for > > e

Re: Natural Word Length

2013-12-26 Thread Marco Leise
Am Tue, 24 Dec 2013 08:57:41 + schrieb "Mike" : > Is there a type in D that represents is always the unsigned > natural word of the platform? alias ℕ = size_t; ℕ myWord = 123; -- Marco