Re: [OT] Programming language WATs

2012-02-09 Thread Bruno Medeiros
On 20/01/2012 15:40, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. LOL, that was good presentation! :) -- Bruno Medeiros - Sof

std.stream vs std.stdio (Was: Re: [OT] Programming language WATs)

2012-02-07 Thread H. S. Teoh
[Changed subject to match where discussion is going.] On Mon, Feb 06, 2012 at 11:27:36PM -0800, Jonathan M Davis wrote: > On Monday, February 06, 2012 23:01:06 H. S. Teoh wrote: [...] > > I don't see what's the discrepancy between formatting and streams. > > As far as I'm concerned, writeln() is e

Re: [OT] Programming language WATs

2012-02-07 Thread Stewart Gordon
On 07/02/2012 01:18, Jonathan M Davis wrote: I guess that it depends on how you think or what you're used to. I wouldn't necessarily expect std.stream to be related to std.stdio at all. Certainly. in C++, stream-based and non-stream-based I/O isn't related at all std.stream and std.stdio are

Re: [OT] Programming language WATs

2012-02-07 Thread Stewart Gordon
On 20/01/2012 20:59, Denis Shelomovskij wrote: 20.01.2012 19:40, Robert Clipsham пишет: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Good talk! But with a mistake: there are 15 delimiters in 16 element array (printing/join result), not 16. I'm

Re: [OT] Programming language WATs

2012-02-07 Thread Timon Gehr
On 02/07/2012 06:49 AM, H. S. Teoh wrote: In D, however, I did not expect this stream/stdio divide to exist, though I suppose the name "std.stdio" is a kind of giveaway. In any case, std.stdio is used all over the place in D docs and tutorials, besides write/writeln() being a pet example mo

Re: [OT] Programming language WATs

2012-02-06 Thread Jonathan M Davis
On Monday, February 06, 2012 23:01:06 H. S. Teoh wrote: > On Mon, Feb 06, 2012 at 10:02:15PM -0800, Jonathan M Davis wrote: > > On Monday, February 06, 2012 21:49:23 H. S. Teoh wrote: > [...] > > > In my experience, most C++ programmers ignore streams for basic I/O, > > if not in general. They're

Re: [OT] Programming language WATs

2012-02-06 Thread H. S. Teoh
On Mon, Feb 06, 2012 at 10:02:15PM -0800, Jonathan M Davis wrote: > On Monday, February 06, 2012 21:49:23 H. S. Teoh wrote: [...] > In my experience, most C++ programmers ignore streams for basic I/O, > if not in general. They're nice for some basic stuff and for object > oriented stuff, but as so

Re: [OT] Programming language WATs

2012-02-06 Thread Jonathan M Davis
On Monday, February 06, 2012 21:49:23 H. S. Teoh wrote: > On another note, I find this divide between std.stream and std.stdio > quite jarring. The C++ model is to use by default, and > optionally provide to those who prefer it. This, I find, makes > sense, because streams are a much more powerf

Re: [OT] Programming language WATs

2012-02-06 Thread H. S. Teoh
On Mon, Feb 06, 2012 at 05:18:14PM -0800, Jonathan M Davis wrote: > On Monday, February 06, 2012 17:13:28 H. S. Teoh wrote: > > OK, so this thread was supposed to be about WATs in D. Today I found > > one. > > > > std.stdio.File != std.stream.File > > > > which means you can't assign stdin to

Re: [OT] Programming language WATs

2012-02-06 Thread Jonathan M Davis
On Monday, February 06, 2012 17:13:28 H. S. Teoh wrote: > OK, so this thread was supposed to be about WATs in D. Today I found > one. > > std.stdio.File != std.stream.File > > which means you can't assign stdin to InputStream. > > Yes I know, you need to import cstream and use cstream.din

Re: [OT] Programming language WATs

2012-02-06 Thread H. S. Teoh
OK, so this thread was supposed to be about WATs in D. Today I found one. std.stdio.File != std.stream.File which means you can't assign stdin to InputStream. Yes I know, you need to import cstream and use cstream.din instead, but this is very counterintuitive to a newcomer. It certainly

Re: [OT] Programming language WATs

2012-02-06 Thread H. S. Teoh
On Mon, Feb 06, 2012 at 09:11:35PM +0100, HansBKK wrote: > On Friday, 20 January 2012 at 20:59:57 UTC, Denis Shelomovskij > wrote: > >But with a mistake: there are 15 delimiters in 16 element array > >(printing/join result), not 16. > > That is truly sad - not only that you counted the commas, but

Re: [OT] Programming language WATs

2012-02-06 Thread Timon Gehr
On 02/06/2012 09:11 PM, HansBKK wrote: On Friday, 20 January 2012 at 20:59:57 UTC, Denis Shelomovskij wrote: But with a mistake: there are 15 delimiters in 16 element array (printing/join result), not 16. That is truly sad - not only that you counted the commas, but publicly admitted it 8-)

Re: [OT] Programming language WATs

2012-02-06 Thread HansBKK
On Friday, 20 January 2012 at 20:59:57 UTC, Denis Shelomovskij wrote: But with a mistake: there are 15 delimiters in 16 element array (printing/join result), not 16. That is truly sad - not only that you counted the commas, but publicly admitted it 8-)

Re: [OT] Programming language WATs

2012-01-22 Thread Timon Gehr
On 01/23/2012 01:27 AM, Jonathan M Davis wrote: On Sunday, January 22, 2012 13:26:57 bcs wrote: http://www.d-programming-language.org/statement.html#ForStatement Everything from after the '(' up to and including the first ';' is defined by use of an NoScopeNonEmptyStatement or ';' (the first ha

Re: [OT] Programming language WATs

2012-01-22 Thread Jonathan M Davis
On Sunday, January 22, 2012 13:26:57 bcs wrote: > http://www.d-programming-language.org/statement.html#ForStatement > > Everything from after the '(' up to and including the first ';' is > defined by use of an NoScopeNonEmptyStatement or ';' (the first happens > to include variable decelerations,

Re: [OT] Programming language WATs

2012-01-22 Thread bcs
On 01/22/2012 12:49 PM, Matt Soucy wrote: On 01/22/2012 03:24 PM, bcs wrote: On 01/20/2012 07:40 AM, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WAT

Re: [OT] Programming language WATs

2012-01-22 Thread Matt Soucy
On 01/22/2012 03:24 PM, bcs wrote: On 01/20/2012 07:40 AM, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. IIRC: int i, j = get

Re: [OT] Programming language WATs

2012-01-22 Thread bcs
On 01/20/2012 07:40 AM, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. IIRC: int i, j = getInt(); for (switch(j) { case 0: i

Re: [OT] Programming language WATs

2012-01-22 Thread Nick Sabalausky
"Robert Clipsham" wrote in message news:jfc1ts$2hck$1...@digitalmars.com... > > Anyone have any other WATs you can do in other languages? Bonus points for > WATs you can do in D. > I'm quickly learning that Git seems to have an assload of WATs... &*!(^$&*@%^&*#$&*()@^$*(!^$(*!&#*(!^

Re: [OT] Programming language WATs

2012-01-21 Thread Marco Leise
Am 21.01.2012, 05:28 Uhr, schrieb Kapps : This issue left me with a permanent avoidance of ref foreach after encountering it the first day I used D. On 20/01/2012 10:25 PM, Andrej Mitrovic wrote: One of the first bugs I've filed (now 1.5+ years old): void main() { float[] arr = [1.0, 2

Re: [OT] Programming language WATs

2012-01-20 Thread Kapps
This issue left me with a permanent avoidance of ref foreach after encountering it the first day I used D. On 20/01/2012 10:25 PM, Andrej Mitrovic wrote: One of the first bugs I've filed (now 1.5+ years old): void main() { float[] arr = [1.0, 2.5, 4.0]; foreach (ref double elem; arr)

Re: [OT] Programming language WATs

2012-01-20 Thread Andrej Mitrovic
One of the first bugs I've filed (now 1.5+ years old): void main() { float[] arr = [1.0, 2.5, 4.0]; foreach (ref double elem; arr) { elem /= 2; } writeln(arr); // still [1, 2.5, 4] } Issue 4510

Re: [OT] Programming language WATs

2012-01-20 Thread Caligo
On Fri, Jan 20, 2012 at 9:40 AM, Robert Clipsham wrote: > Just came across this amusing 4 minute video: > > https://www.destroyallsoftware.com/talks/wat > > Anyone have any other WATs you can do in other languages? Bonus points for > WATs you can do in D. > > -- > Robert > http://octarineparrot.co

Re: [OT] Programming language WATs

2012-01-20 Thread Bernard Helyer
On Friday, 20 January 2012 at 15:40:44 UTC, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. void main() { import std.stdio;

Re: [OT] Programming language WATs

2012-01-20 Thread Jonathan M Davis
On Saturday, January 21, 2012 04:20:36 Adam D. Ruppe wrote: > On Saturday, 21 January 2012 at 03:18:43 UTC, Jonathan M Davis > > wrote: > > Yeah. String literals should definitely be immutable rvalues, > > consider this though: > > auto a = "hello"; > a = "new"; > > If is("hello" == immutable(c

Re: [OT] [ot Programming language WATs

2012-01-20 Thread Adam D. Ruppe
On Friday, 20 January 2012 at 15:40:44 UTC, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D.

Re: [OT] Programming language WATs

2012-01-20 Thread Timon Gehr
On 01/21/2012 04:17 AM, Jonathan M Davis wrote: On Friday, January 20, 2012 22:14:43 Nick Sabalausky wrote: "Jonathan M Davis" wrote in message news:mailman.640.1327115503.16222.digitalmar...@puremagic.com... On Saturday, January 21, 2012 03:44:53 Andrej Mitrovic wrote: Probably Windows-only

Re: [OT] Programming language WATs

2012-01-20 Thread Adam D. Ruppe
On Saturday, 21 January 2012 at 03:18:43 UTC, Jonathan M Davis wrote: Yeah. String literals should definitely be immutable rvalues, consider this though: auto a = "hello"; a = "new"; If is("hello" == immutable(char[])), then a would be too, and the rebinding would fail. That'd be annoying.

Re: [OT] Programming language WATs

2012-01-20 Thread Jonathan M Davis
On Friday, January 20, 2012 22:14:43 Nick Sabalausky wrote: > "Jonathan M Davis" wrote in message > news:mailman.640.1327115503.16222.digitalmar...@puremagic.com... > > > On Saturday, January 21, 2012 03:44:53 Andrej Mitrovic wrote: > >> Probably Windows-only: > >> > >> void main() > >> { > >>

Re: [OT] Programming language WATs

2012-01-20 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.640.1327115503.16222.digitalmar...@puremagic.com... > On Saturday, January 21, 2012 03:44:53 Andrej Mitrovic wrote: >> Probably Windows-only: >> >> void main() >> { >> string a = "foo"; >> "foo" = "bar"; >> writeln(a); // "foo" >>

Re: [OT] Programming language WATs

2012-01-20 Thread Jonathan M Davis
On Saturday, January 21, 2012 03:44:53 Andrej Mitrovic wrote: > Probably Windows-only: > > void main() > { > string a = "foo"; > "foo" = "bar"; > writeln(a); // "foo" > assert(a == "foo"); // failure > } Yeah. I don't understand why string literals aren't treated as fully immuta

Re: [OT] Programming language WATs

2012-01-20 Thread Zachary Lund
On 01/20/2012 08:44 PM, Andrej Mitrovic wrote: Probably Windows-only: void main() { string a = "foo"; "foo" = "bar"; writeln(a); // "foo" assert(a == "foo"); // failure } I think this is a bug. This causes a segmentation fault on Linux DMD 2.057. Plus, assigning a litera

Re: [OT] Programming language WATs

2012-01-20 Thread Andrej Mitrovic
To give you a hint: void main() { "foo" = "bar"; writeln("foo"); }

Re: [OT] Programming language WATs

2012-01-20 Thread Andrej Mitrovic
Probably Windows-only: void main() { string a = "foo"; "foo" = "bar"; writeln(a); // "foo" assert(a == "foo"); // failure }

Re: [OT] Programming language WATs

2012-01-20 Thread Nick Sabalausky
"Robert Clipsham" wrote in message news:jfc1ts$2hck$1...@digitalmars.com... > Just came across this amusing 4 minute video: > > https://www.destroyallsoftware.com/talks/wat > OMGWTFBBQ! I ROFLed! (That really was hilarious.) > Anyone have any other WATs you can do in other languages? Bonus po

Re: [OT] Programming language WATs

2012-01-20 Thread Denis Shelomovskij
20.01.2012 19:40, Robert Clipsham пишет: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Good talk! But with a mistake: there are 15 delimiters in 16 element array (printing/join result), not 16.

Re: [OT] Programming language WATs

2012-01-20 Thread Mehrdad
On 1/20/2012 8:43 AM, Brad Anderson wrote: On Fri, Jan 20, 2012 at 8:40 AM, Robert Clipsham mailto:rob...@octarineparrot.com>> wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages

Re: [OT] Programming language WATs

2012-01-20 Thread Jonathan M Davis
On Friday, January 20, 2012 15:40:43 Robert Clipsham wrote: > Just came across this amusing 4 minute video: > > https://www.destroyallsoftware.com/talks/wat Hilarious! - Jonathan M Davis

Re: [OT] Programming language WATs

2012-01-20 Thread Brad Anderson
On Fri, Jan 20, 2012 at 8:40 AM, Robert Clipsham wrote: > Just came across this amusing 4 minute video: > > https://www.**destroyallsoftware.com/talks/**wat > > Anyone have any other WATs you can do in other languages? Bonus points for > WATs you can d

Re: [OT] Programming language WATs

2012-01-20 Thread Timon Gehr
On 01/20/2012 04:40 PM, Robert Clipsham wrote: Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. I think there are no spectacular WATs in D, but I'll give

[OT] Programming language WATs

2012-01-20 Thread Robert Clipsham
Just came across this amusing 4 minute video: https://www.destroyallsoftware.com/talks/wat Anyone have any other WATs you can do in other languages? Bonus points for WATs you can do in D. -- Robert http://octarineparrot.com/