Re: file i/o in a variety of languages

2010-08-30 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 18:03:19 -0400, Simen kjaeraas simen.kja...@gmail.com wrote: On Fri, 27 Aug 2010 22:28:56 +0200, Steven Schveighoffer schvei...@yahoo.com wrote: No, the code does this: f.writeln(hello); f.writeln(world); The example is supposed to demonstrate how to re-open the file

Re: file i/o in a variety of languages

2010-08-28 Thread Peter Alexander
On 27/08/10 9:25 PM, Andrei Alexandrescu wrote: On 8/27/10 13:18 PDT, Johannes Pfau wrote: On 27.08.2010 20:27, Andrei Alexandrescu wrote: Is it my thunderbird installation, or does everybody see a chopped message? Thanks, Andrei I see the complete message in this case, Thunderbird 3.1.2

Re: file i/o in a variety of languages

2010-08-28 Thread Jacob Carlborg
On 2010-08-27 22:25, Andrei Alexandrescu wrote: On 8/27/10 13:18 PDT, Johannes Pfau wrote: On 27.08.2010 20:27, Andrei Alexandrescu wrote: Is it my thunderbird installation, or does everybody see a chopped message? Thanks, Andrei I see the complete message in this case, Thunderbird 3.1.2

file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed Andrei

Re: file i/o in a variety of languages

2010-08-27 Thread Trass3r
D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to write error-checking code in as C. Even Java's less verbose! – DK

Re: file i/o in a variety of languages

2010-08-27 Thread bearophile
Andrei Alexandrescu: D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed Yes, it looks nice, File looks well designed, its design is almost equal to the Python one (despite in that page they have used a different code strategy in

Re: file i/o in a variety of languages

2010-08-27 Thread bearophile
Andrei Alexandrescu: D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed I find it stupid that they have closed this quite interesting thread. Even if the purpose of the stackoverflow site is a bit of difference, they have shown

Re: file i/o in a variety of languages

2010-08-27 Thread Jesse Phillips
I'm assuming the file.open() function will close any open file. When does your suggestion close the file? bearophile Wrote: Regarding this: auto f = File(fileio.txt, w); ... f.open(fileio.txt, r); It is correct, because it first calls detach(), but what is the purpose of the open()

Re: file i/o in a variety of languages

2010-08-27 Thread Andrej Mitrovic
They keep closing informational topics like these. And yet topics like Jon Skeet facts stay open. It's ridiculous. On Fri, Aug 27, 2010 at 3:43 PM, bearophile bearophileh...@lycos.com wrote: Andrei Alexandrescu: D doesn't look half bad:

Re: file i/o in a variety of languages

2010-08-27 Thread bearophile
Jesse Phillips: I'm assuming the file.open() function will close any open file. When does your suggestion close the file? If you write: auto f = File(foo.txt, w); f = File(bar.txt, r); I think the first file will be closed, thanks to the reference counter. My complete version was: import

Re: file i/o in a variety of languages

2010-08-27 Thread Jonathan M Davis
On Friday, August 27, 2010 08:16:39 Andrej Mitrovic wrote: They keep closing informational topics like these. And yet topics like Jon Skeet facts stay open. It's ridiculous. There's definitely some great stuff at stack overflow, and it's generally a great place to ask questions, but it does

Re: file i/o in a variety of languages

2010-08-27 Thread Walter Bright
Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to write error-checking code in as C. Even Java's less verbose! – DK

Re: file i/o in a variety of languages

2010-08-27 Thread Walter Bright
Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to write error-checking code in as C. Even Java's

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 11:25 PDT, Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to write error-checking code in

Re: file i/o in a variety of languages

2010-08-27 Thread Daniel Gibson
Andrei Alexandrescu schrieb: On 8/27/10 11:25 PDT, Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to

Re: file i/o in a variety of languages

2010-08-27 Thread Nick Sabalausky
bearophile bearophileh...@lycos.com wrote in message news:i58fdo$ru...@digitalmars.com... Andrei Alexandrescu: D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed I find it stupid that they have closed this quite interesting

Re: file i/o in a variety of languages

2010-08-27 Thread Robert Jacques
On Fri, 27 Aug 2010 14:27:27 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 11:25 PDT, Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language

Re: file i/o in a variety of languages

2010-08-27 Thread Andrej Mitrovic
I wonder if Go will become another Wave from Google. :p On Fri, Aug 27, 2010 at 8:25 PM, Walter Bright newshou...@digitalmars.com wrote: Here's the Go example. I think Go has made a serious error in centering their design around error codes. snip

Re: file i/o in a variety of languages

2010-08-27 Thread bearophile
I don't see the need of the open() method, it looks like noise in the File API. Do you know its purpose? If no one is able or has time to give me an answer I may file a bug report for removal of that method. Bye, bearophile

Re: file i/o in a variety of languages

2010-08-27 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:i580v8$2us...@digitalmars.com... D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed LOLCODE is my new favorite langauge. (Previously it was fuckfuck - like

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 12:09 PDT, bearophile wrote: I don't see the need of the open() method, it looks like noise in the File API. Do you know its purpose? If no one is able or has time to give me an answer I may file a bug report for removal of that method. Bye, bearophile The open() method saves

Re: file i/o in a variety of languages

2010-08-27 Thread Andrej Mitrovic
Someone even made a Brainfuck compiler in LOLCODE. I don't have the link, but google should help. :p On Fri, Aug 27, 2010 at 9:12 PM, Nick Sabalausky a...@a.a wrote: Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:i580v8$2us...@digitalmars.com... D doesn't look half bad:

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 12:12 PDT, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message news:i580v8$2us...@digitalmars.com... D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed LOLCODE is my new favorite

Re: file i/o in a variety of languages

2010-08-27 Thread simendsjo
On 27.08.2010 20:27, Andrei Alexandrescu wrote: On 8/27/10 11:25 PDT, Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new

Re: file i/o in a variety of languages

2010-08-27 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 05:36:32 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed Note that D's version doesn't follow the rules, you were supposed to re-open the

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 11:29 PDT, Walter Bright wrote: Walter Bright wrote: Trass3r wrote: D doesn't look half bad: Yeah that comment about Go says it all: It's rather amazing that given 30 years of evolution and language design, they've still managed to invent a new language that's as hard to write

Re: file i/o in a variety of languages

2010-08-27 Thread Johannes Pfau
On 27.08.2010 20:27, Andrei Alexandrescu wrote: Is it my thunderbird installation, or does everybody see a chopped message? Thanks, Andrei I see the complete message in this case, Thunderbird 3.1.2 Linux, but I have seen this problem before with other posts. Don't know what causes it,

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 13:01 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 05:36:32 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: D doesn't look half bad: http://stackoverflow.com/questions/3538156/file-i-o-in-every-programming-language-closed Note that D's version doesn't

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 13:18 PDT, Johannes Pfau wrote: On 27.08.2010 20:27, Andrei Alexandrescu wrote: Is it my thunderbird installation, or does everybody see a chopped message? Thanks, Andrei I see the complete message in this case, Thunderbird 3.1.2 Linux, but I have seen this problem before with

Re: file i/o in a variety of languages

2010-08-27 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 16:18:26 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:01 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 05:36:32 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: D doesn't look half bad:

Re: file i/o in a variety of languages

2010-08-27 Thread Don
Steven Schveighoffer wrote: On Fri, 27 Aug 2010 16:18:26 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:01 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 05:36:32 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: D doesn't look half bad:

Re: file i/o in a variety of languages

2010-08-27 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 16:35:49 -0400, Don nos...@nospam.com wrote: Steven Schveighoffer wrote: On Fri, 27 Aug 2010 16:18:26 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:01 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 05:36:32 -0400, Andrei

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 13:28 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 16:18:26 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:01 PDT, Steven Schveighoffer wrote: On Fri, 27 Aug 2010 05:36:32 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: D

Re: file i/o in a variety of languages

2010-08-27 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 16:41:58 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:28 PDT, Steven Schveighoffer wrote: No, the code does this: f.writeln(hello); f.writeln(world); The example is supposed to demonstrate how to re-open the file for appending and write

Re: file i/o in a variety of languages

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 13:48 PDT, Steven Schveighoffer wrote: Hm.. this still allocates. We can do better than the C++ example: char[128] buf; char[] line = buf[]; f.readln(line); f.readln(line); Which should not allocate at all in this case, and is completely safe if it *does* have to allocate (like if

Re: file i/o in a variety of languages

2010-08-27 Thread Stanislav Blinov
Johannes Pfau wrote: On 27.08.2010 20:27, Andrei Alexandrescu wrote: Is it my thunderbird installation, or does everybody see a chopped message? Thanks, Andrei I see the complete message in this case, Thunderbird 3.1.2 Linux, but I have seen this problem before with other posts. Don't know

Re: file i/o in a variety of languages

2010-08-27 Thread dsimcha
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Fri, 27 Aug 2010 16:41:58 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:28 PDT, Steven Schveighoffer wrote: No, the code does this: f.writeln(hello); f.writeln(world); The example

Re: file i/o in a variety of languages

2010-08-27 Thread Steven Schveighoffer
On Fri, 27 Aug 2010 17:16:37 -0400, dsimcha dsim...@yahoo.com wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Fri, 27 Aug 2010 16:41:58 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 8/27/10 13:28 PDT, Steven Schveighoffer wrote: No, the code

Re: file i/o in a variety of languages

2010-08-27 Thread Simen kjaeraas
On Fri, 27 Aug 2010 22:28:56 +0200, Steven Schveighoffer schvei...@yahoo.com wrote: No, the code does this: f.writeln(hello); f.writeln(world); The example is supposed to demonstrate how to re-open the file for appending and write world. Look at some of the other examples. Not that

Re: file i/o in a variety of languages

2010-08-27 Thread Simen kjaeraas
Nick Sabalausky a...@a.a wrote: LOLCODE is my new favorite langauge. (Previously it was fuckfuck - like brainfuck, but replaces the symbols with four-letter words) LOLCODE is indeed a great language. Perhaps not the biggest on features or standardization, but who cares when you can program in

Re: file i/o in a variety of languages

2010-08-27 Thread torhu
On 27.08.2010 23:11, Stanislav Blinov wrote: Actually, this was what caused me to wonder if anyone sees my messages correctly (test: does anybody read my messages normally? in D.learn newsgroup). Funny thing, I've posted my message via mailing list (and got it back correctly with Thunderbird on

Re: file i/o in a variety of languages

2010-08-27 Thread bearophile
Andrei: The open() method saves on reallocating the refcounted structured stored inside the File. Thank you for your answer. So the API is designed a bit larger than necessary for performance reasons. This the reformatted first part of the interesting implementation of File: struct File {