Re: I like D

2015-03-25 Thread Sönke Ludwig via Digitalmars-d
Am 24.03.2015 um 21:19 schrieb Steven Schveighoffer: On 3/24/15 4:11 PM, Andrei Alexandrescu wrote: On 3/24/15 11:56 AM, "Jacques =?UTF-8?B?TcO8bGxlciI=?= " wrote: On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: New code: immutable nfields = header.count('\t'); ... outp

Re: I like D

2015-03-24 Thread Steven Schveighoffer via Digitalmars-d
On 3/24/15 4:38 PM, Dylan Knutson wrote: immutable nfields = header.count('\t'); ... output.writeln(cycle("\t-").take(2 * nfields)); Super-win, now I only ever have to update the original column list. Little things like this are what make me love D. -Steve I see that `take` returns a lazy ra

Re: I like D

2015-03-24 Thread John Colvin via Digitalmars-d
On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: Recently, while updating a D utility I wrote to process a binary log file into a tab-separated text file, I found a nice use for ranges. So I have N columns, separated by tabs. The header looks like this: "TIME\tCOL1\tCO

Re: I like D

2015-03-24 Thread Dylan Knutson via Digitalmars-d
immutable nfields = header.count('\t'); ... output.writeln(cycle("\t-").take(2 * nfields)); Super-win, now I only ever have to update the original column list. Little things like this are what make me love D. -Steve I see that `take` returns a lazy range. That's really neat! How does write

Re: I like D

2015-03-24 Thread Steven Schveighoffer via Digitalmars-d
On 3/24/15 4:11 PM, Andrei Alexandrescu wrote: On 3/24/15 11:56 AM, "Jacques =?UTF-8?B?TcO8bGxlciI=?= " wrote: On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: New code: immutable nfields = header.count('\t'); ... output.writeln(cycle("\t-").take(2 * nfields)); output.w

Re: I like D

2015-03-24 Thread Andrei Alexandrescu via Digitalmars-d
On 3/24/15 11:56 AM, "Jacques =?UTF-8?B?TcO8bGxlciI=?= " wrote: On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: New code: immutable nfields = header.count('\t'); ... output.writeln(cycle("\t-").take(2 * nfields)); output.writeln("\t-".repeat(nfields).join); output.wri

Re: I like D

2015-03-24 Thread Walter Bright via Digitalmars-d
On 3/24/2015 11:35 AM, Adam D. Ruppe wrote: On Tuesday, 24 March 2015 at 18:16:08 UTC, Dicebot wrote: Can be nice entry for weekly D newsletter tips & tricks. Aye, write it up! Also, as a Phobos example for take or cycle.

Re: I like D

2015-03-24 Thread via Digitalmars-d
On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: New code: immutable nfields = header.count('\t'); ... output.writeln(cycle("\t-").take(2 * nfields)); output.writeln("\t-".repeat(nfields).join);

Re: I like D

2015-03-24 Thread Adam D. Ruppe via Digitalmars-d
On Tuesday, 24 March 2015 at 18:16:08 UTC, Dicebot wrote: Can be nice entry for weekly D newsletter tips & tricks. Aye, write it up!

Re: I like D

2015-03-24 Thread Dicebot via Digitalmars-d
On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote: Recently, while updating a D utility I wrote to process a binary log file into a tab-separated text file, I found a nice use for ranges. So I have N columns, separated by tabs. The header looks like this: "TIME\tCOL1\tCO

I like D

2015-03-24 Thread Steven Schveighoffer via Digitalmars-d
Recently, while updating a D utility I wrote to process a binary log file into a tab-separated text file, I found a nice use for ranges. So I have N columns, separated by tabs. The header looks like this: "TIME\tCOL1\tCOL2\t..." With about 30 or 40 columns. The first output is a line like thi

Re: Why I like D

2008-12-05 Thread Nick Sabalausky
"bearophile" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Nick Sabalausky: >> bearophile: >> > But the dynamic languages allow you to save time in other ways. >> >> I'd argue that most of those time-saving things are things that have >> absolutely nothing to do with dynamic typing

Re: Why I like D

2008-12-05 Thread bearophile
Nick Sabalausky: > bearophile: > > But the dynamic languages allow you to save time in other ways. > > I'd argue that most of those time-saving things are things that have > absolutely nothing to do with dynamic typing and are perfectly possible with > static typing. I mostly agree, what I want

Re: Why I like D

2008-12-05 Thread Nick Sabalausky
"bearophile" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > But the dynamic languages allow you to save time in other ways. I'd argue that most of those time-saving things are things that have absolutely nothing to do with dynamic typing and are perfectly possible with static t

Re: Why I like D

2008-12-05 Thread Nick Sabalausky
"Robert Fraser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Nick Sabalausky Wrote: >> That's the reason I refuse to use dynamic languages and >> indentation-syntax >> languages whenever I have a choice. They're nothing but a giant step >> backwards, constantly replacing the most

Re: Why I like D

2008-12-05 Thread bearophile
Don: > I think for dynamic languages, test-driven development is mandatory. I generally write tests after the code in all languages I use :-) Maybe I'll learn to use TDD in the future, who knows. > But you have to write zillions of tests because the compiler accepts all > kinds of garbage. [..

Re: Why I like D

2008-12-05 Thread Don
bearophile wrote: Bill Baxter: You never mistype the name of a variable? Probably I do such mistakes often or very often, but I test every little piece of code I write, so such bugs are fixed seconds or minutes after I have put them in, so even not using an IDE I have never felt it as proble

Re: Why I like D

2008-12-04 Thread Robert Fraser
Nick Sabalausky Wrote: > That's the reason I refuse to use dynamic languages and indentation-syntax > languages whenever I have a choice. They're nothing but a giant step > backwards, constantly replacing the most basic and standard compiler > diagnostics with the world's most unnecessary runtim

Re: Why I like D

2008-12-04 Thread Graham St Jack
On Thu, 04 Dec 2008 17:44:34 -0500, Nick Sabalausky wrote: > "bearophile" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Bill Baxter: >>>And I also got increasingly annoyed by the silly runtime errors that >>>any decent compiler would tell me about.< >> >> Generally I don't have

Re: Why I like D

2008-12-04 Thread Derek Parnell
On Fri, 5 Dec 2008 07:45:27 +0900, Bill Baxter wrote: > On Fri, Dec 5, 2008 at 6:07 AM, bearophile <[EMAIL PROTECTED]> wrote: >> Generally I don't have such problems, but maybe my style of coding is quite >> "careful" anyway. > You never mistype the name of a variable? "careful" != "perfect"

Re: Why I like D

2008-12-04 Thread bearophile
Bill Baxter: > You never mistype the name of a variable? Probably I do such mistakes often or very often, but I test every little piece of code I write, so such bugs are fixed seconds or minutes after I have put them in, so even not using an IDE I have never felt it as problem :-) There are far

Re: Why I like D

2008-12-04 Thread Bill Baxter
On Fri, Dec 5, 2008 at 6:07 AM, bearophile <[EMAIL PROTECTED]> wrote: > Bill Baxter: > >>It was sitting down and realizing that with OCaml I was basically going to >>have to re-learn how to do everything I already knew how to do, but using >>Monads or whatever.< > > A little learning pain may be

Re: Why I like D

2008-12-04 Thread Nick Sabalausky
"bearophile" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Bill Baxter: >>And I also got increasingly annoyed by the silly runtime errors that any >>decent compiler would tell me about.< > > Generally I don't have such problems, but maybe my style of coding is > quite "careful" a

Re: Why I like D

2008-12-04 Thread bearophile
Bill Baxter: >It was sitting down and realizing that with OCaml I was basically going to >have to re-learn how to do everything I already knew how to do, but using >Monads or whatever.< A little learning pain may be useful to grow. So learning some functional programming may be positive. It ma

Re: Why I like D

2008-12-04 Thread Bill Baxter
ownership and total control. Now I just wish the BigMegaCorps of the world would take notice and write us some nice VisualStudio-caliber integrated gui IDE/debuggers. --bb On Fri, Dec 5, 2008 at 4:20 AM, bearophile <[EMAIL PROTECTED]> wrote: > Few moths ago someone here has implicitaly

Why I like D

2008-12-04 Thread bearophile
Few moths ago someone here has implicitaly asked why I like D, now I can answer. Feel free to skip this boring wall of text. I don't like the syntax and rules of C++, to me they look ugly, confusing and too much complex, and when I can I avoid this language. It makes me waste too much