Re: What the hell is wrong with D?

2017-09-26 Thread Brad Anderson via Digitalmars-d-learn
On Saturday, 23 September 2017 at 20:43:36 UTC, Patrick Schluter wrote: So I checked for all the languages listed: C, C#, Java, Javascript, C++, PHP, Perl and D. All have the same order of precedence except, as always the abomination of all languages: C++ (kill it with fire). C++ is the only

Re: What the hell is wrong with D?

2017-09-19 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:16:05 UTC, EntangledQuanta wrote: [snip] I'm just glad there is at least one sane person that decided to chime in... was quite surprised actually. I find it quite pathetic when someone tries to justify a wrong by pointing to other wrongs. It takes away all

Re: What the hell is wrong with D?

2017-09-19 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 18:17:47 UTC, jmh530 wrote: On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta wrote: Thanks for wasting some of my life... Just curious about who will justify the behavior and what excuses they will give. Pretty sure it would be exactly the same

Re: Ranges suck!

2017-09-14 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 14 September 2017 at 23:53:20 UTC, Your name wrote: Every time I go to use something like strip it bitches and gives me errors. Why can't I simply do somestring.strip("\n")??? import std.string would be the likely strip yet it takes a range and somestring, for some retarded

Re: Chain a range of ranges?

2017-01-16 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 03:21:39 UTC, Yuxuan Shui wrote: The built in chain seems to only be able to chain a fixed number of ranges, is there a way to chain a range/array of ranges? See std.algorithm.iteration.joiner

Re: D code optimization

2016-09-22 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. While my D code runs in about

Re: Can vibe d leverage existing web technologies?

2016-09-13 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 23:45:18 UTC, Intersteller wrote: vibe.d does not have much lateral support as the most commons web technologies do. Can vibe.d leverage pre-existing techs such as php, ruby/rails, etc? Starting from scratch and having to build a robust and secure framework is

Re: dlang.org using apache?

2016-06-08 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 14:41:55 UTC, Ola Fosheim Grøstad wrote: [snip] I like the "are we fast yet" websites that various project put up, displaying improvements over time. You mean like this? http://digger.k3.1azy.net/trend/

Re: iota access in foreach loop

2016-06-04 Thread Brad Anderson via Digitalmars-d-learn
On Saturday, 4 June 2016 at 18:55:09 UTC, Brad Anderson wrote: On Saturday, 4 June 2016 at 18:20:26 UTC, Alex wrote: [...] Check out enumerate() in std.range; int counter = 5; foreach(i, el; enumerate(randomCover(iota(counter writeln("index: ", i, " element: ", el);

Re: iota access in foreach loop

2016-06-04 Thread Brad Anderson via Digitalmars-d-learn
On Saturday, 4 June 2016 at 18:20:26 UTC, Alex wrote: Hi all! Could you help me clearify why a iota can't be accessed with two arguments in a foreach loop? following tests show my problem: What does work: int[] ku = [0, 1, 2, 3, 4]; foreach(i, el; ku) writeln("index: ", i, "

Re: Speed of csvReader

2016-01-21 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 21 January 2016 at 22:13:38 UTC, Brad Anderson wrote: On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote: [...] What about wrapping the slices in a range-like interface that would unescape the quotes on demand? You could even set a flag on it during the initial pass

Re: Speed of csvReader

2016-01-21 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote: [snip] There are some limitations to this approach: while the current code does try to unwrap quoted values in the CSV, it does not correctly parse escaped double quotes ("") in the fields. This is because to process those values

Re: Disabling GC in D

2016-01-21 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 21 January 2016 at 21:54:36 UTC, Dibyendu Majumdar wrote: Is there a way to disable GC in D? I am aware of the @nogc qualifier but I would like to completely disable GC for the whole app/library. Regards Dibyendu GC.disable(); This prevents the garbage collector from running

Re: DUB config format: SDLang or JSON?

2015-12-18 Thread Brad Anderson via Digitalmars-d-learn
On Friday, 18 December 2015 at 22:30:00 UTC, Jakob Jenkov wrote: I am just looking at DUB and I can read that there are two config formats: SDLang and JSON. Which one is the "new" format? Which one is the "future" of DUB? SDLang is the new one. JSON will remain supported. Use whichever you

Re: Palindromes

2015-12-03 Thread Brad Anderson via Digitalmars-d-learn
On Friday, 4 December 2015 at 00:50:17 UTC, Meta wrote: On Friday, 4 December 2015 at 00:26:23 UTC, Jim Barnett wrote: On Friday, 4 December 2015 at 00:23:45 UTC, Jim Barnett wrote: The `import` statement inside the `for`-loop kind of smells to me. Sorry, inside the `while` loop In D

Re: Password Storage

2015-11-27 Thread Brad Anderson via Digitalmars-d-learn
On Friday, 27 November 2015 at 00:17:34 UTC, brian wrote: [snip] Can the developers in the room confirm if this is the correct approach? Are there examples of betters ways of doing this? Regards Brian Botan has well thought out password hashing:

Re: compatible types for chains of different lengths

2015-11-17 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 22:47:17 UTC, Jon D wrote: I'd like to chain several ranges and operate on them. However, if the chains are different lengths, the data type is different. This makes it hard to use in a general way. There is likely an alternate way to do this that I'm missing.

Re: How to install DMD 64bit on Windows?

2015-10-21 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 21 October 2015 at 18:50:08 UTC, Adam D. Ruppe wrote: Use the .exe installer and it will offer to download and install visual studio for you as part for its process. I don't know if that feature has made it into a release yet. I don't think Vc2015 is supported yet either in a

Re: 'strong types' a la boost

2015-03-14 Thread Brad Anderson via Digitalmars-d-learn
On Saturday, 14 March 2015 at 15:45:30 UTC, Charles Cooper wrote: I think I may have answered my own question. It seems std.typecon provides a facility for this. http://dlang.org/phobos/std_typecons.html#.Proxy http://dlang.org/phobos/std_typecons.html#.Typedef Is this the 'right' way to do

Re: Beginner ?. Why does D suggest to learn java

2014-10-16 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the the parser section. I actually don't see any unicode escape encoder in here. Perhaps he meant the upcoming JSON module.

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:03:37 UTC, jicman wrote: On Tuesday, 14 October 2014 at 19:49:16 UTC, Sean Kelly wrote: On Tuesday, 14 October 2014 at 19:47:00 UTC, jicman wrote: Greetings. Imagine this code, char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:08:03 UTC, Brad Anderson wrote: On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the the parser section. I actually don't see any unicode escape

Re: Turn function into infinite range

2014-09-29 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 29 September 2014 at 17:02:43 UTC, Martin Nowak wrote: Does anyone know a construct to turn a lambda into an infinite range. import std.random; unittest { Random gen; foreach(v; xxx!(() = uniform(0, 100, gen)).take(10)) writeln(v); } I

Re: Using the delete Keyword /w GC

2014-08-25 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 25 August 2014 at 17:10:11 UTC, Etienne wrote: People have been saying for quite a long time not to use the `delete` keyword on GC-allocated pointers. I've looked extensively through the code inside the engine and even made a few modifications on it/benchmarked it for weeks and I

Re: new error message in 2.066, type bool (const)

2014-08-21 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 21 August 2014 at 03:02:53 UTC, Paul D Anderson wrote: What changed? It ran okay with early beta versions, but not with the release. Paul It compiles in beta-5 but not beta-6. Is the list of changes in the beta testing wiki complete? None seem pertinent. monarch_dodra:

Re: Produce some COFF object with 2.066 ?

2014-08-20 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 23:56:23 UTC, Baz wrote: Hello, I've been very interested about the announce saying that DMD is able to produce COFF object files. Mostly because I'm thinking using some objects programmed in D in a software programmed in another lang, a bit like when statically

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-08-14 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 14 August 2014 at 07:46:29 UTC, Carl Sturtivant wrote: The default size of the runtime stack for a Fiber is 4*PAGESIZE which is very small, and a quick test shows that a Fiber suffers a stack overflow that doesn't lead to a clean termination when this limit is exceeded. This

Re: Appender is ... slow

2014-08-14 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 14 August 2014 at 19:10:18 UTC, Jonathan M Davis wrote: I've never really tried to benchmark it, but it was my understanding that the idea behind Appender was to use it to create the array when you do that via a lot of appending, and then you use it as a normal array and stop

Re: Need help with building dmd

2014-08-06 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 7 August 2014 at 01:15:36 UTC, Phil Lavoie wrote: [...] make release -fwin32 Here is the output: Error: can't read makefile 'win32' I'm building on Windows btw. Thanks, Phil Close. You need the extension, I believe. make -f win32.mak release

Re: Need help with building dmd

2014-08-06 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 7 August 2014 at 01:27:55 UTC, Phil Lavoie wrote: Nope, still not working, but thx. Hmm, are you in the src directory?

Re: Need help with building dmd

2014-08-06 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 7 August 2014 at 01:50:50 UTC, Phil Lavoie wrote: On Thursday, 7 August 2014 at 01:37:46 UTC, Brad Anderson wrote: On Thursday, 7 August 2014 at 01:27:55 UTC, Phil Lavoie wrote: Nope, still not working, but thx. Hmm, are you in the src directory? Yes and ls *.mak shows three

Re: Taking from infinite forward ranges

2014-08-04 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 01:23:19 UTC, Andrew Edwards wrote: Is there a way to take a bounded rage from a infinite forward range? Given the Fibonacci sequence: auto fib = recurrence!(a[n-1] + a[n-2])(1, 1); I can take the first n elements: take(fib, 10); But say I want

Re: Problem with trying sample from doc page

2014-07-16 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 16 July 2014 at 15:44:03 UTC, Adam D. Ruppe wrote: I would just change all the longs to ints and it would probably work. Or all the longs to ints. It really should have been consistent in the docs, since the point of this is delegate vs function, not int vs long...

Re: Regex match in for loop

2014-07-15 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 15 July 2014 at 20:18:58 UTC, seany wrote: Consider this: import std.stdio, std.regex, std.array, std.algorithms ; void main(string args[]) { string[] greetings = [hello, hallo, hoi, salut]; regex r = regex(hello, g); for(short i = 0; i greetings.count(); i++) { auto m =

Re: Generating Strings with Random Contents

2014-07-14 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 14 July 2014 at 22:21:36 UTC, bearophile wrote: Nordlöw: Is there a natural way of generating/filling a string/wstring/dstring of a specific length with random contents? Do you mean something like this? import std.stdio, std.random, std.ascii, std.range, std.conv; string

Re: Generating Strings with Random Contents

2014-07-14 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 14 July 2014 at 22:27:57 UTC, Brad Anderson wrote: Alternative: randomSample(lowercase, 10, lowercase.length).writeln; std.ascii should really be using std.encoding.AsciiString. Then that length wouldn't be necessary.

Re: Generating Strings with Random Contents

2014-07-14 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 14 July 2014 at 22:32:25 UTC, bearophile wrote: Brad Anderson: Alternative: randomSample(lowercase, 10, lowercase.length).writeln; From randomSample docs: Selects a random subsample out of r, containing exactly n elements. The order of elements is the same as in the original

Re: '!' and naming conventions

2014-06-18 Thread Brad Anderson via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 21:58:48 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: Sent: Wednesday, June 18, 2014 at 11:02 PM From: Brad Anderson via Digitalmars-d-learn digitalmars-d-learn@puremagic.com To: digitalmars-d-learn@puremagic.com Subject: Re: '!' and naming conventions

Re: Doing exercise from book, but I'm getting error with splitter

2014-06-16 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 16 June 2014 at 16:38:15 UTC, Sanios wrote: snip And I'm getting this - Error: undefined identifier splitter It seems like std.string doesn't contain splitter. You can find the solution to this and other issues you may hit in the errata: http://erdani.com/tdpl/errata/

Re: zip with fieldTuple

2014-06-06 Thread Brad Anderson via Digitalmars-d-learn
On Friday, 6 June 2014 at 22:16:36 UTC, John wrote: So let's say I'm trying to create a really simple ORM. I have a struct: struct foo { int a; float b; } I can iterate over the struct elements with the traits FieldTypeTuple!foo, I can iterate over the the string that

Re: zip with fieldTuple

2014-06-06 Thread Brad Anderson via Digitalmars-d-learn
On Friday, 6 June 2014 at 23:18:49 UTC, John wrote: On Friday, 6 June 2014 at 22:27:38 UTC, bearophile wrote: John: I can iterate over the struct elements with the traits FieldTypeTuple!foo, In such iteration you are using a static foreach. Types are compile-time constructs in D. If you

Re: how to get line number after readln

2014-06-04 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 5 June 2014 at 00:33:26 UTC, Ali Çehreli wrote: On 06/04/2014 05:05 PM, Robert Hathaway wrote: I've got a program that reads a text file line by line (using std.stdio readln()) Consider using byLine() instead. (Important: byLine uses an internal buffer for the line; so, don't

Re: DateTime custom string format

2014-06-03 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 18:22:59 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: Well, I would prefer to do it myself, but I obviously can't say that I wouldn't accept it if someone else did it and did a good job of it. The main problem however is that we need to come up with a good

Re: How to get array length

2014-05-22 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. Just use .length: void main() { import std.stdio; auto a = new int[5]; auto b = a[]; writeln(a.length, , b.length); }