www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [OT] Programming language WATs

reply Robert Clipsham <robert octarineparrot.com> writes:
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/
Jan 20 2012
next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
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 it a try. $ short s = -1; $ s >>> 1
 2147483647

$ int[] a = []; $ int[][] b = []; $ a ~ []
 []

 [[]]

$ const(int)[] a; $ int[] b; $ immutable(int)[] c; $ typeof(a ~ b)
 int[]

 int[]

 const(int)[]

$ class A{} $ class B : A{} $ __traits(compiles, {A[] a = [new B];})
 true

 false

 true

(BTW: We have an almost complete D interpreter. Why don't we have a REPL?)
Jan 20 2012
prev sibling next sibling parent reply Brad Anderson <eco gnuk.net> writes:
--f46d040169bdb99a1904b6f85fcc
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Jan 20, 2012 at 8:40 AM, Robert Clipsham
<robert octarineparrot.com>wrote:

 Just came across this amusing 4 minute video:

 https://www.**destroyallsoftware.com/talks/**wat<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/

I don't know of any for D but Stack Overflow had a great list that contained many of these. The deletionists (which I thought we had successfully quarantined to Wikipedia) have gotten it deleted though. I found a copy on Archive.org: http://web.archive.org/web/20101221234152/http://stackoverflow.com/questions/1995113/strangest-language-feature Regards, Brad Anderson --f46d040169bdb99a1904b6f85fcc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Jan 20, 2012 at 8:40 AM, Robert Clipsham <span dir=3D"ltr">&lt;<a h= ref=3D"mailto:robert octarineparrot.com">robert octarineparrot.com</a>&gt;<= /span> wrote:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quot= e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Just came across this amusing 4 minute video:<br> <br> <a href=3D"https://www.destroyallsoftware.com/talks/wat" target=3D"_blank">= https://www.<u></u>destroyallsoftware.com/talks/<u></u>wat</a><br> <br> Anyone have any other WATs you can do in other languages? Bonus points for = WATs you can do in D.<span class=3D"HOEnZb"><font color=3D"#888888"><br> <br> -- <br> Robert<br> <a href=3D"http://octarineparrot.com/" target=3D"_blank">http://octarinepar= rot.com/</a><br> </font></span></blockquote></div><br><div>I don&#39;t know of any for D but= Stack Overflow had a great list that contained many of these. =A0The delet= ionists (which I thought we had successfully quarantined to Wikipedia) have= gotten it deleted though.</div> <div><br></div><div>I found a copy on Archive.org:=A0<a href=3D"http://web.= archive.org/web/20101221234152/http://stackoverflow.com/questions/1995113/s= trangest-language-feature">http://web.archive.org/web/20101221234152/http:/= /stackoverflow.com/questions/1995113/strangest-language-feature</a></div> <div><br></div><div>Regards,</div><div>Brad Anderson</div> --f46d040169bdb99a1904b6f85fcc--
Jan 20 2012
parent Mehrdad <wfunction hotmail.com> writes:
On 1/20/2012 8:43 AM, Brad Anderson wrote:
 On Fri, Jan 20, 2012 at 8:40 AM, Robert Clipsham 
 <robert octarineparrot.com <mailto:robert 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? Bonus
     points for WATs you can do in D.

     -- 
     Robert
     http://octarineparrot.com/


 I don't know of any for D but Stack Overflow had a great list that 
 contained many of these.  The deletionists (which I thought we had 
 successfully quarantined to Wikipedia) have gotten it deleted though.

 I found a copy on Archive.org: 
 http://web.archive.org/web/20101221234152/http://stackoverflow.com/questions/1995113/strangest-language-feature

 Regards,
 Brad Anderson

Jan 20 2012
prev sibling next sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
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
Jan 20 2012
prev sibling next sibling parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
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.
Jan 20 2012
next sibling parent reply "HansBKK" <hansbkk gmail.com> writes:
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-)
Feb 06 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
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-)

That is truly sad - not only that you thought counting of commas was required to reach Denis' conclusion, but publicly admitted it. :o)
Feb 06 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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 publicly admitted it 8-)

More Javascript WATs: []+1 // "1" (a string, not a number) []-1 // -1 (a number, not a string... WAT?) {}+1 // 1 (a number, not a string... huh?!) []+"a" // "a" (weird, but OK) {}+"a" // NaN (WAT?) Even worse: "a"+[] // "a" (weird, but OK, consistent with []+"a") "a"+{} // "a[object Object]" (WAT? inconsistent with {}+"a") T -- If it's green, it's biology, If it stinks, it's chemistry, If it has numbers it's math, If it doesn't work, it's technology.
Feb 06 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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 elicited a WAT
from me today when I first ran into this schizophrenic split between
std.stdio (which is pretty much used in every D code example I've seen,
which gives the impression that it's the "native" and "default" thing to
use) and std.stream (which one would expect should naturally extend the
functionality of std.stdio, but it doesn't).


T

-- 
The best compiler is between your ears. -- Michael Abrash
Feb 06 2012
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
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 guessing that Gary really did work this all out beforehand, but claimed there are 16 as he thought it would amaze people more if they didn't know what "Array" and "join" really mean. Stewart.
Feb 07 2012
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Robert Clipsham" <robert octarineparrot.com> 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 points for 
 WATs you can do in D.

I think just about any WAT in D would be a compiler or library bug. Or this:
 dmd a.d -c
 typeof("a.obj")

http://memegenerator.net/instance/13443461
Jan 20 2012
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
To give you a hint:

void main()
{
    "foo" = "bar";
    writeln("foo");
}
Jan 20 2012
prev sibling next sibling parent Zachary Lund <admin computerquip.com> writes:
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 literal to a literal doesn't make sense...
Jan 20 2012
prev sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
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 immutable in Windows. They are in Linux. It makes no sense to be able to alter string literals. - Jonathan M Davis
Jan 20 2012
parent reply "Nick Sabalausky" <a a.a> writes:
"Jonathan M Davis" <jmdavisProg gmx.com> wrote in message 
news:mailman.640.1327115503.16222.digitalmars-d 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"
     assert(a == "foo");  // failure
 }

Yeah. I don't understand why string literals aren't treated as fully immutable in Windows.

Or as rvalues.
 They are in Linux. It makes no sense to be able to alter string
 literals.

Jan 20 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
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"<jmdavisProg gmx.com>  wrote in message
 news:mailman.640.1327115503.16222.digitalmars-d 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"
      assert(a == "foo");  // failure

 }

Yeah. I don't understand why string literals aren't treated as fully immutable in Windows.

Or as rvalues.

Yeah. String literals should definitely be immutable rvalues, and they should be that way _regardless_ of the OS or architecture. - Jonathan M Davis

Tail immutable rvalue is fine. It would be annoying if they were immutable.
Jan 20 2012
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Probably Windows-only:

void main()
{
    string a = "foo";
    "foo" = "bar";
    writeln(a);  // "foo"
    assert(a == "foo");  // failure
}
Jan 20 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday, January 20, 2012 22:14:43 Nick Sabalausky wrote:
 "Jonathan M Davis" <jmdavisProg gmx.com> wrote in message
 news:mailman.640.1327115503.16222.digitalmars-d 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"
     assert(a == "foo");  // failure
 
 }

Yeah. I don't understand why string literals aren't treated as fully immutable in Windows.

Or as rvalues.

Yeah. String literals should definitely be immutable rvalues, and they should be that way _regardless_ of the OS or architecture. - Jonathan M Davis
Jan 20 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
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.
Jan 20 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
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.

Jan 20 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 20 January 2012 at 15:40:44 UTC, Robert Clipsham wrote:
 https://www.destroyallsoftware.com/talks/wat

Curious: anyone here checked out the author's screencasts? I found this video amusing so I looked at the others, but he wants money for it. Worth the ten bucks?
Jan 20 2012
next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:rjmwboyrrzxbbsjkasub dfeed.kimsufi.thecybershadow.net...
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

I thought I was the only one! I genuinely *am* proud to be a college dropout. Almost wish I had dropped out of high school, because that would have prevented me from wasting all that time, money and sanity on college. Most people think I'm nuts when I tell them I *want* to never have a degree ('Course, most people are morons...) But even if it does put me at a disadvantage in what are really only a few isolated cases (contrary to what sheeple are lead to beleive), it doesn't matter: The "college == good" brainwashing MUST STOP, period, and I'd sooner sell my soul than selfishly sit back and blindly contribute to the problem (which would really amount to the same thing). (Yea, I know Caltech sounds like it might be better, but even if it is...and *still* is...that only makes it the exception to the rule.)
Jan 20 2012
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:ykmzlppuwncgmvgzszbr dfeed.kimsufi.thecybershadow.net...
 On Saturday, 21 January 2012 at 04:20:16 UTC, Nick Sabalausky wrote:
 The "college == good" brainwashing MUST STOP, period

Aye. What's incredible is I've hard these arguments on other websites, and a *lot* of people fight it. Alas, I'm watching this video still, and it gets way too political as it goes on... even I am tempted to write the authors off as nutty, and I agree with most the college stuff!

Yea, I just stopped at the end of the intro (3 minutes) because I knew that even if it didn't get nutty, I wouldn't have the patience to listen to more without getting too pissed off and stressed out over it. Hell, I've mostly been trying to forget school. But that's the problem with persuasive videos/speeches/etc: Anyone who's willing to watch already agrees anyway. :/
 Anyway, I started arguing that college just isn't a good
 financial decision for a lot of people. Sure, there's
 exceptions, but people need to take a serious look at the
 cost/benefit for their specific case and consider all the
 other options, including just starting to work immediately.

 This argument quickly became a full blown flamewar.

 When I was in high school, there was no discussion of
 alternatives. When I was asked if I was going to college,
 I replied "of course", as if it was a stupid question.
 I think this same attitude caused the flamewar.

 We're conditioned to see it as not an option with pros
 and cons, but as the *only* path that's obviously all good.

It absolutely is a sacred cow. There's *no* doubt about that. What *really* pissed me off was when I was deciding I was done with college, *that's* when some administrators and instructors were willing to say things like "college isn't right for everyone". Can you believe it? Yea, *that's* a fine time to tell people things like that. *After* they've gone into debt to line your greedy goddamn pockets... Speaking of college greed, when I was at BGSU in the early 2000's, the university president (don't remember his name, but I'm sure it can be looked up) laid off 5 or 6 teachers and, at the same time, gave himself a $40k/yr raise (it was already around $200k/yr *before*). I say lock them all up.
 Maybe that was true twenty years ago, but it isn't now.

 (besides, autodidacts rock.)

Fuck yea they do! And I'm not just saying that because I am one. All the best professionals I've known, to my knowledge, have been primarily self-taught in their trade. All the worst ones were invariably people who learned in college classes. Which brings up another point: HR people do it completely ass-backwards. If I were hiring, the resumes with a heavy "degrees and academic achievements" focus would be the first ones in the trash, not the first ones called in (unless I wanted to go all Steve Jobs on their asses ;) ). Hell, I even have a good friend who's a web dev manager with hiring authority, and he's echoed just how terrible those fancy-degree people (sent to him by his organization's HR dept) inevitably are. It's a cycle of shit and it *needs* to stop. The moron-brigades have already fucked our society over far too much, and left alone it'll only get worse. Another example: around the time I was leaving BGSU (or maybe just a little after), the CS dept's website was *genuinely boasting* about a phenomenal achievement from [a few of] their CS graduate students: They wrote a program that ran on PalmOS. Yup! That's it! It wasn't even anything in particular, the faculty was chest-beating over the mere fact they got anything running on the PalmOS at all. Jesus fuck, that's the biggest brightest thing their **GRAD** students could handle? To pull their heads out of their asses *just* enough to write vaguely-real software? I had *already* been doing that as a *freshman* around a couple years prior! It ain't hard: You grab the device, you grab the compiler, you open the docs, and you move your fingers on the keyboard - just like any other half-way competent coder. What a bunch of utterly worthless self-deluded fucks.
Jan 20 2012
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"F i L" <witte2008 gmail.com> wrote in message 
news:szaqbqghgbzolydwwoxe dfeed.kimsufi.thecybershadow.net...
 I never went to college and I feel no worse for wear for it. At 24, around 
 an age I would be graduating, I'm glad I'm not looking at spending a 
 quarter of my income on school loans.

If you were *lucky* it would be as low as one-quarter.
 God knows taxes take a big enough toll as it is.

 It really is a case-by-case situation though, as much as I'm against "big 
 pharmaceutical", you can't/shouldn't be a doctor without proper education. 
 Unfortunately college, like so many other industries, seems to be growing 
 to fat for it's own good. But then, as a member of the Zeitgeist Movement, 
 I think that about a lot of for-profit organizations. ;) 

Jan 20 2012
prev sibling next sibling parent Paulo Pinto <pjmlp progtools.org> writes:
Am 21.01.2012 04:48, schrieb Adam D. Ruppe:
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

I guess this is a specific USA issue. In Europe you will hardly get a programming job as developer if you don't have a degree in Computer Science, Electronic, Physics or Mathematic applied to computation, just to name a few of the common degrees. At least if you are looking for a company job. In case you would be starting your own company then it is a total different matter. -- Paulo
Jan 21 2012
prev sibling parent reply Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 01/20/2012 10:48 PM, Adam D. Ruppe wrote:
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

Yeah, I like the qualifications that Paulo and Jonathan add to this. My current job would have been unreachable without a college degree. Was it worth it? Yes. Would it have been worth it if I had to burden the ENTIRE cost of college on my student loans? No, probably not. I had a lot of help from parents on this, and some grants. I pay about $400 a mo. in student loans. Annoying, but not bad if you're living on the cheap in Ohio. I also took a Physics degree instead of a CS degree. I don't think American colleges teach Computer Science/Engineering very well at all. My physics degree was an Engineering Physics degree and thus had an engineering "emphasis" which I filled with some CS courses, mostly because they'd bring up my grades after the physics classes. A few of them were pretty legit, but then OSU insisted on teaching this RESOLVE stuff. Now, I'm not going to make the argument that it's bad because no one uses that in the workplace. I'm down with using an obscure programming language for pedagogy as long as there is a reason. But what RESOLVE is... they want it to be reusable code, but obviously they don't take DRY seriously, because they make you duplicate code all over the place. Duplicate code is not reusable or maintainable. That is my biggest complaint with it, and it soured my opinion of the whole thing for the entire time. Oh, and they also liked to invent terminology for things that already had prior terminology, which is dumb. There are more complaints, but I'll stop there. Right. So I took a physics degree. The physics part actually seemed very legit. Physics profs tend to know their shit. I actually have a lot of respect for that side of things. I think I gained a lot from the Physics classes in terms of rigorous thinking and problem solving abilities. That's the stuff that allows me to tackle /hard/ problems, and in any field. I also took a game development class. Took it twice. It was pegged at grad-level. And it really was /development/; you were expected to be an expert in some field before signing on and teaming up. It was all about teaching people how to collaborate on these things and deal with the large amount of detail work that goes into games. I think I learned a lot about how to manage such projects from doing that class. But more importantly, I think it helped me build my self-identity. It taught me that I really do enjoy this game development stuff, even though there are some hard and shitty parts to it. I am OK with that, and still enjoy it for all of the novel challenges and cool experiences. So college wasn't all that bad to me. They still need to change the funding model here in the states though. That shit is broken as fuck. For some people, namely those that are talented and have good self-motivation, it may very well be worth their while to skip that mess. Probably doesn't work for physics though; it can be hard to do experimental physics on your own ;) Also, the D newsgroup is probably better at teaching programming than college. Hmmmmm. ;)
Jan 21 2012
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 1/21/12 3:56 PM, Chad J wrote:
 I don't think American colleges teach Computer Science/Engineering very
 well at all.

Wonder why. USA does have the best programmers in the world though. Andrei
Jan 21 2012
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
news:jffd0g$2d0u$1 digitalmars.com...
 On 1/21/12 3:56 PM, Chad J wrote:
 I don't think American colleges teach Computer Science/Engineering very
 well at all.

Wonder why. USA does have the best programmers in the world though.

At least part of that's because many of them move here. Like Linus Torvalds. And this one guy, I forget his name, but he's really well known for C++ template metaprogramming, even wrote a highly-regarded book about it... ;)
Jan 21 2012
prev sibling next sibling parent Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 01/21/2012 05:08 PM, Andrei Alexandrescu wrote:
 On 1/21/12 3:56 PM, Chad J wrote:
 I don't think American colleges teach Computer Science/Engineering very
 well at all.

Wonder why. USA does have the best programmers in the world though. Andrei

Sorry I have no numbers to back this up, but I conjecture that many of them are self-taught. Interestingly, my roommate also mentioned that a certain facet of the American culture might help in this regard: the higher regard for self-starting and making one's own way. Maybe this makes life easier for those that teach themselves their trade? (IMO, I also suspect it's partially responsible for the broken college funding model because it gets distorted in a financial context and becomes "college is your own financial decision, so you are expected to pay for it on your own".)
Jan 21 2012
prev sibling parent Peter Alexander <peter.alexander.au gmail.com> writes:
On 21/01/12 10:08 PM, Andrei Alexandrescu wrote:
 On 1/21/12 3:56 PM, Chad J wrote:
 I don't think American colleges teach Computer Science/Engineering very
 well at all.

Wonder why. USA does have the best programmers in the world though.

Depends on what you mean by the best. Most successful, yes. However, the East always wins the programming competitions :-) Last year's Google Code Jam world finals: http://code.google.com/codejam/contest/scoreboard?c=1327485 Top 25 breakdown Russia: 10 China: 7 Japan: 2 Poland: 2 USA: 1 UK: 1 Belarus: 1 Slovakia: 1 Seems to be like that every year. Same happens at the ICPC.
Jan 21 2012
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Chad J" <chadjoan __spam.is.bad__gmail.com> wrote in message 
news:jffcaj$2bug$1 digitalmars.com...
 I don't think American colleges teach Computer Science/Engineering very 
 well at all.  My physics degree was an Engineering Physics degree and thus 
 had an engineering "emphasis" which I filled with some CS courses, mostly 
 because they'd bring up my grades after the physics classes.  A few of 
 them were pretty legit, but then OSU insisted on teaching this RESOLVE 
 stuff.  Now, I'm not going to make the argument that it's bad because no 
 one uses that in the workplace.  I'm down with using an obscure 
 programming language for pedagogy as long as there is a reason. But what 
 RESOLVE is... they want it to be reusable code, but obviously they don't 
 take DRY seriously, because they make you duplicate code all over the 
 place.  Duplicate code is not reusable or maintainable.  That is my 
 biggest complaint with it, and it soured my opinion of the whole thing for 
 the entire time.  Oh, and they also liked to invent terminology for things 
 that already had prior terminology, which is dumb.  There are more 
 complaints, but I'll stop there.

I have a friend who went through OSU's CS program and I remember him complaining about Resolve, too. But I dunno, I've visited OSU and I still think it's more of a football franchise slash commercial real estate developer than a school... 'Course, considering what I think of schools, that may not be much of a complaint ;)
 So college wasn't all that bad to me.  They still need to change the 
 funding model here in the states though.  That shit is broken as fuck.

What are you talking about? It works great as long as your family's not middle-class, or if you're female, or if you're not caucasian...And that's ok for middle-class white males, since we apperently get everything we could ever desire handed to us on a silver platter just for being white males...I mean, show of hands, how many of the white males here got their "Set for life, because you're a white male" care package? See. Everybody.
Jan 21 2012
parent Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 01/21/2012 05:13 PM, Nick Sabalausky wrote:
 "Chad J"<chadjoan __spam.is.bad__gmail.com>  wrote in message
 news:jffcaj$2bug$1 digitalmars.com...
 So college wasn't all that bad to me.  They still need to change the
 funding model here in the states though.  That shit is broken as fuck.

What are you talking about? It works great as long as your family's not middle-class, or if you're female, or if you're not caucasian...And that's ok for middle-class white males, since we apperently get everything we could ever desire handed to us on a silver platter just for being white males...I mean, show of hands, how many of the white males here got their "Set for life, because you're a white male" care package? See. Everybody.

Whoops. My bad. Totally got that, uh, "care package". Yep. Right here next to me. My big gripe though is that somehow high school is considered good enough to be funded by the state, but the college only gets some token funding from the government and is ran as a for-profit enterprise. I think there was a time when college was elective because you didn't need skills to make a nice life for yourself, instead of now where it's only elective if you can acquire skills without it. I don't think it is elective for a large percentage of the population, rather it is requisite most of the time, but I think this is why it should be state funded instead of "pay for it yourself because you HAVE TO". It's an awful double-standard.
Jan 21 2012
prev sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:mvloclloufauudewjnrj dfeed.kimsufi.thecybershadow.net...
 First off, they required all the first year students
 to live on campus. WTF. And, of course, they required
 these exorbitant fees for all that too.

At BGSU, they required first *and* second year students to live on campus. They had some sort of bullshit excuse about "bettering yourself" or some other such meaningless crap like that. But that's not the bad part: There was one year (that I *know* of) where they had more first and second year students then they had dorms for. Obviously, they couldn't do the sane thing and relax the requirement (after all, that might make BGSU look bad!), so they made a bunch of students (not me, luckily) *live* together in the dorm's lounge rooms. That was one of first of many "College, WTF?!" moments for me. (I had thought Animal House was fiction!)
 Best of all, I have my own bathroom and kitchen. And it's
 quiet here, pretty much all day and all night. I live next
 to a fire station, and it's infinitely more quiet
 than living next to college drunkards.

And even in the dorms, you still get the middle-of-the-night fire alarms anyway (speaking of drunks). But in the place you have, I bet you don't have to leave the house every time it happens...
 The classes are OK, but the other crap they *required*
 just gets a huge HELL NO.

I was...sort of...the other way around (kinda): There was admittedly a lot about campus life that was terrible, but there was also a lot about it that I loved and still sometimes miss (Many intangibles, but also the panini sandwiches at the campus convenience store! Yum! Much as BGSU sucked, they *did* have very good dining halls as long as you avoided anything resembling asian). Even though there were a *few* very good teachers/classes, it was mostly the academic (and administrative, financial and bureaucratic) aspects I had a problem with. Oh, and the drunks, of course.
 Aaanyway, I did round two at the community college,
 and switched to computer science figuring an AS in
 computers is probably more useful than in physics,
 and is something I should be able to turn around
 quickly.

 And that wasn't bad at all. Government grants paid
 for the whole thing (for three semesters... I had
 already eaten a huge chunk of them in year 1) and
 I could live wherever I wanted.

 I might be ok with finishing that off someday if my
 business crashed and burned (and nobody took my years
 of experience as a substitute for college), but
 since the free money ran out, even the three or
 four grand they'd want to finish it off just doesn't
 look worth it.

Heh, I finished off with community college, too! I started college (in 2000) with 2.5 years at BGSU (public party school, and in retrospect, the *best* of all the colleges I've been to, not that that's saying much). I had an absolutely terrible apartment situation the last semester (Lesson: *Never* get into a student-oriented apt complex with management that's based out-of-state. Especilly if it's leased by anything longer than month-to-month.) So then I transferred to JCU (private school, highly-respected, at least locally) so I could commute and save on living expenses. Was there for 1.5 years, retaking all the same CS classes I had already aced at BGSU (because JCU didn't believe I could possibly know what I was doing - I was merely a "student" after all - and an "undergrad" at that). Although it was technically 1.5 years, the last semester I was so jaded I was really only there physically; I wasn't actually trying at all, and I didn't care to. So they did put me on a one-semester academic suspension, but it didn't matter since I was already done with them by that point anyway. (It was somewhere in the middle of my time at JCU that I decided I genuinely *wanted* to not have a degree. I know that sounds like a rationalization to most people, but I swear it really isn't one for me.) At that point I went to the super-cheap[1] local Lakeland Community College part time, mainly so I could keep the ~$100k (yes, that's right) I'd racked up in loans out of repayment until I could actually pay them (for the record: I still can't :/ ). At the first two schools, I had been declared CS all four years from day one. Did it differently at LCC: *Officially*, I was going for...I think it was some sort of EE associate's or something like that, but really I took the opportunity to *for once in my life* actually take the classes that *I wanted* to take[2]. I even took an acting class that I absolutely loved; heck, it was the only class in my life I was genuinely sad to see end (and then I took a second one that...umm...didn't work out so well...) That community college is very highly regarded locally, and I was fairly impressed with it - at first. Then the staff, administrators, and one or two very specific instructors, kept finding all manner of new and creative ways to severely fuck me over. Eventually their demands got *so* unreasonable, and their bullshit *so* deep, that I just said "Fuck it, I'm done." That was probably about six-ish years ago. Things haven't been easy since (Hah! Like they ever were!), but I've never had a hint of regret about leaving. I have, however, had many regrets about having ever gottn involved in the first place. And I've also had many regrets about having listened to the people who talked me into not cutting my losses much sooner than I actually did. ("You've already gotten this far, you may as well get something out of it!" Yea, *thanks*, all you self-righteous assholes, now my debt is double what it would have been.) [1] That's "super-cheap" relatively speaking: it's still insanely expensive (and less effective) compared to a good library. Or even a good bookstore. [2] That was one of the many things I despised about college. I had always been told that in college, unlike high school (which made my miserable college experience seem like utopia by comparison) you choose your area of study. But that turned out to be a load of crap - unless you go to a tech school, 65%-75% of credits are completely unrelated to your major and it's *dictated* that you take them. (Academically, college literally *is* an expensive redo of high school). Now, I might have not minded the lack of self-direction, except that *I* was the one paying tens of thousands of $$$ for the classes! Who the fuck has ever heard of, say, a grocery store that told people which of their stock they could and couldn't buy? *Everyone* in faculty/staff thought I was nuts for seeing it that way. In their mind, you're *expected* to be happy paying them a fortune for the privilege of being told what you're allowed to learn. Talk about narcissism.
Jan 21 2012
parent "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:klssvtelbzdqkrfbuafh dfeed.kimsufi.thecybershadow.net...
 Oh crap, I did it again. Sorry for the useless
 post, I clicked in the wrong place and it ended up
 being the send button :(

Don't you like having the "Send Message Before I'm Done Writing It" button? It's a pretty standard feature. I just made use of it myself talking to my brother the other day.
 It was cold and windy; upstate New York winter, and we
 all had to wait outside for... I think twenty minutes or
 so, maybe longer on short notice so we couldn't get properly
 dressed to be outside.

Yea. Northern Ohio here, which probably isn't much better. Some of us suspected one of the problems may have been students who didn't know/care about dryer lint traps.
 (Actually, I liked high school, but meh.)

It was a living hell for me. I'm not going to get into it though: If you think I get all worked up about *college*...well, whew!!!
 2) They transferred a lot of stupid classes from the
 HS credits and the other school, including two English
 credits. English 102 and 204 or something like that.

 But they did *not* count any of it toward English 101!
 Oswego was willing to, but JCC wasn't. And, it was, of
 course, required.

 What the hell. It's so arbitrary, and apparently changes
 every other year.

Yea, that doesn't surprise me. From what I've seen (this literally is from direct personal "in the same room" observation), a big part of credit transfer really amounts to a judgment call on the part of your assigned student counselor. Although to be fair, I'm not sure how else they could do it: There's so many colleges people could be transerring in from, and there isn't much standardization on classes/curriculum (which may actually be one of the *good* things about college vs high school).
 Ah, yes, the sunk cost fallacy. (I learned that term on the
 Internet, btw. The college philosophy and logic classes
 were pretty poor.)

I genuinely believe logic should be a standard required class in high school. It's a shame that it's not.
 Talk about narcissism.

They make you well rounded!

Argh! I had manged to totally forget about that line until now! ;) I can't even begin to count how many times I got the "well-rounded" speech, especially in HS (I was very narrowly-focused on computers until sometime in college. Still don't regret it though, it was the right thing for me at the time.) But I still like my old standard "well-rounded" response: "I'm 300lbs: I'm round enough already!!" (Ok, yea, that sounds really bad, but I'm tall too, so it's not *that* bad.)
Jan 21 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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(char[])), then a would be too, and the rebinding would fail. That'd be annoying.

Well, when it was changed so that IFTI treated arrays as tail-const, dsimcha proposed that we do the same with auto. If we did that, then it solves the problem. - Jonathan M Davis
Jan 20 2012
prev sibling next sibling parent reply Caligo <iteronvexor gmail.com> writes:
On Fri, Jan 20, 2012 at 9:28 PM, Adam D. Ruppe
<destructionator gmail.com> wrote:
 On Friday, 20 January 2012 at 15:40:44 UTC, Robert Clipsham wrote:
 https://www.destroyallsoftware.com/talks/wat

Curious: anyone here checked out the author's screencasts? I found this video amusing so I looked at the others, but he wants money for it. Worth the ten bucks?

You could watch this for free, but it's not amusing. I know, I just graduated. http://www.youtube.com/watch?v=VpZtX32sKVE
Jan 20 2012
parent "Nick Sabalausky" <a a.a> writes:
"Caligo" <iteronvexor gmail.com> wrote in message 
news:mailman.643.1327117430.16222.digitalmars-d puremagic.com...
 You could watch this for free, but it's not amusing.  I know, I just 
 graduated.

 http://www.youtube.com/watch?v=VpZtX32sKVE

Just watched the first 3 minutes. Out of everything in there, there wasn't one single thing I haven't already been saying for the past 5-10 years.
Jan 20 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.
Jan 20 2012
prev sibling next sibling parent reply "Bernard Helyer" <b.helyer gmail.com> writes:
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; auto a = cast(int[]) [cast(ushort)1, cast(ushort) 2]; writeln(a); auto b = [cast(ushort) 1, cast(ushort) 2]; auto c = cast(int[]) b; writeln(c); }
Jan 20 2012
parent Kapps <Kapps NotValidEmail.com> writes:
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) {
          elem /= 2;
      }
      writeln(arr);  // still [1, 2.5, 4]
 }

 Issue 4510

Jan 20 2012
prev sibling next sibling parent Caligo <iteronvexor gmail.com> writes:
On Fri, Jan 20, 2012 at 9:40 AM, Robert Clipsham
<robert 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? Bonus points for
 WATs you can do in D.

 --
 Robert
 http://octarineparrot.com/

Maybe a WAT for people new to D. I personally found this to be confusing and inconsistent. float[4] sa = [1, 2, 3, 4]; float[] da = [1, 2, 3, 4]; fill(da, map!(sqrt)(da)); // works fill(sa, map!(sqrt)(sa)); // doesn't work fill(sa[], map!(sqrt)(sa[])); // ok
Jan 20 2012
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
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
Jan 20 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 21 January 2012 at 04:20:16 UTC, Nick Sabalausky 
wrote:
 The "college == good" brainwashing MUST STOP, period

Aye. What's incredible is I've hard these arguments on other websites, and a *lot* of people fight it. Alas, I'm watching this video still, and it gets way too political as it goes on... even I am tempted to write the authors off as nutty, and I agree with most the college stuff! Anyway, I started arguing that college just isn't a good financial decision for a lot of people. Sure, there's exceptions, but people need to take a serious look at the cost/benefit for their specific case and consider all the other options, including just starting to work immediately. This argument quickly became a full blown flamewar. When I was in high school, there was no discussion of alternatives. When I was asked if I was going to college, I replied "of course", as if it was a stupid question. I think this same attitude caused the flamewar. We're conditioned to see it as not an option with pros and cons, but as the *only* path that's obviously all good. Maybe that was true twenty years ago, but it isn't now. (besides, autodidacts rock.)
Jan 20 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
On Saturday, 21 January 2012 at 04:20:16 UTC, Nick Sabalausky 
wrote:
 "Adam D. Ruppe" <destructionator gmail.com> wrote in message 
 news:rjmwboyrrzxbbsjkasub dfeed.kimsufi.thecybershadow.net...
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

I thought I was the only one! I genuinely *am* proud to be a college dropout. Almost wish I had dropped out of high school, because that would have prevented me from wasting all that time, money and sanity on college. Most people think I'm nuts when I tell them I *want* to never have a degree ('Course, most people are morons...) But even if it does put me at a disadvantage in what are really only a few isolated cases (contrary to what sheeple are lead to beleive), it doesn't matter: The "college == good" brainwashing MUST STOP, period, and I'd sooner sell my soul than selfishly sit back and blindly contribute to the problem (which would really amount to the same thing). (Yea, I know Caltech sounds like it might be better, but even if it is...and *still* is...that only makes it the exception to the rule.)

I never went to college and I feel no worse for wear for it. At 24, around an age I would be graduating, I'm glad I'm not looking at spending a quarter of my income on school loans. God knows taxes take a big enough toll as it is. It really is a case-by-case situation though, as much as I'm against "big pharmaceutical", you can't/shouldn't be a doctor without proper education. Unfortunately college, like so many other industries, seems to be growing to fat for it's own good. But then, as a member of the Zeitgeist Movement, I think that about a lot of for-profit organizations. ;)
Jan 20 2012
prev sibling next sibling parent "Marco Leise" <Marco.Leise gmx.de> writes:
Am 21.01.2012, 05:28 Uhr, schrieb Kapps <Kapps notvalidemail.com>:

 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) {
          elem /= 2;
      }
      writeln(arr);  // still [1, 2.5, 4]
 }

 Issue 4510


That's a harsh decision, when you can have correct and shorter code by removing the word "double". The bug report is of course still well deserved.
Jan 21 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 21 January 2012 at 18:14:42 UTC, Paulo Pinto wrote:
 In Europe you will hardly get a programming job as developer if
 you don't have a degree in Computer Science, Electronic, Physics
 or Mathematic applied to computation, just to name a few of the
 common degrees.

A lot of Americans are like that too. I work for myself though, so it's not a big deal to me personally.
Jan 21 2012
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, January 21, 2012 19:14:41 Paulo Pinto wrote:
 Am 21.01.2012 04:48, schrieb Adam D. Ruppe:
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

I guess this is a specific USA issue. In Europe you will hardly get a programming job as developer if you don't have a degree in Computer Science, Electronic, Physics or Mathematic applied to computation, just to name a few of the common degrees. At least if you are looking for a company job. In case you would be starting your own company then it is a total different matter.

I think that that's frequently the case in the US as well, but it's not impossible to get a job as long as you have decent programming skills - especially in a good economy (which wouldnt' be right now) - even if you don't have a colleg education. And once you have a decent amount of job experience under your belt, it'll matter a lot less. But there are definitely jobs that will be closed to you if you don't have a degree - especially early in your career. I have at least one co-worker who's never gone to college and whose an extremely good programmer and has been at it for 10 - 15 years now. But whether that route works and/or is a good idea depends on a lot of factors. You _will_ do better getting a job if you have a college degree, but it might be more economical to skip out on college if you can get a reasonable programming skillset on your own and manage to find work. - Jonathan M Davis
Jan 21 2012
parent reply "Nick Sabalausky" <a a.a> writes:
"Jonathan M Davis" <jmdavisProg gmx.com> wrote in message 
news:mailman.661.1327176314.16222.digitalmars-d puremagic.com...
 On Saturday, January 21, 2012 19:14:41 Paulo Pinto wrote:
 Am 21.01.2012 04:48, schrieb Adam D. Ruppe:
 On Saturday, 21 January 2012 at 03:43:50 UTC, Caligo wrote:
 http://www.youtube.com/watch?v=VpZtX32sKVE

Oh my, don't get me started on college! I'm so happy I dropped out of that waste.

I guess this is a specific USA issue. In Europe you will hardly get a programming job as developer if you don't have a degree in Computer Science, Electronic, Physics or Mathematic applied to computation, just to name a few of the common degrees. At least if you are looking for a company job. In case you would be starting your own company then it is a total different matter.

I think that that's frequently the case in the US as well, but it's not impossible to get a job as long as you have decent programming skills - especially in a good economy (which wouldnt' be right now) - even if you don't have a colleg education. And once you have a decent amount of job experience under your belt, it'll matter a lot less. But there are definitely jobs that will be closed to you if you don't have a degree - especially early in your career. I have at least one co-worker who's never gone to college and whose an extremely good programmer and has been at it for 10 - 15 years now. But whether that route works and/or is a good idea depends on a lot of factors. You _will_ do better getting a job if you have a college degree, but it might be more economical to skip out on college if you can get a reasonable programming skillset on your own and manage to find work.

That reminds me: There's a *LOT* of people who told me "If two equally good people apply for the same job, and one has a degree and other other doesn't, the one with the degree will get the job." They always seem to think that's convincing, but there's three problems with it: 1. That's a fairly contrived scenario. 2. So...what, it's a $100k, 4+ year **tie-breaker**?? Sounds like a collosal waste to me. And probably most importantly: 3. If you take all that time and money that would have gone into a degree and put it into building *real* skills and experience instead wasting it all on taking exams, cramming for exams instead of *actually* learning, homework assignments instead of *real* projects, etc., then you'd have something far better than a tie-breaker: You'd *be* the better candidate, by far. (And hell, if the other candidate is a middle-class white male, you'd have *far* less debt and could undercut the them on salary while *still* ending up with much more spending money.)
Jan 21 2012
parent Tobias Pankrath <tobias pankrath.net> writes:
 To slightly modify an old quote: "If you want a plush cubicle hell and
 debt, get a degree. If you want an education, get a library card."

I've learned more in university, than I could have learned myself in the same time. One obvious reason is, that the structure and presentation of the content helps. If I'd had to learn computer science by myself directly after school, I wouldn't have known where to start. Especially my math lectures where excellent. I was/am working during all my studies, too. First at Volkswagen, than at an 120 man SAP Consultant and now at a small company that verifies embedded systems. I've learned at my jobs things, that you can't learn in university, but it always was narrowed down to a very special point of view. University provides a wider view of CS. I'm glad for this. That said: I'm studing and living in Germany. I pay 200€ per semester for the university, where the main part is for a ticket that allows to use all the public transports in the area. It does not matter, which university you visit because all are considered equal. It's kind of said that USA (and internationalisation) is used as example and excuse to put more crap rules in german universities year by year.
Jan 22 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 21 January 2012 at 21:56:35 UTC, Chad J wrote:
 I also took a Physics degree instead of a CS degree.

That's what I did for my first go. I actually went to college twice: one year right after high school, doing physics (at SUNY Oswego), then wanted to go home, but a couple years later, figured I'll give college a second go and did a year and a half of CS at the local community college (SUNY Jefferson). What I hated most about year #1 wasn't the classes - they actually didn't bother me at all - but rather the college environment and all the bullshit. First off, they required all the first year students to live on campus. WTF. And, of course, they required these exorbitant fees for all that too. IIRC, when I went, it was $2,500 for the semester, but let's look at today's price. (Another annoying thing: the prices are always hidden on college websites...) http://www.oswego.edu/administration/student_accounts/tuition_and_fees.html I pity the fool who comes from out of state! But, even the in state folks are charged $6,000, per semester! A semester goes from the fail end of August to mid-December, a little more than three months (and they kick you out for at least one week in there..) This works out to about $2k / month! Unbelievable. That's flabbergasting. The room I had was, oh, I didn't measure, but I think about 10 feet by 10 feet is about right; 100 ft^2, divided by two people. Fifty square feet.... two THOUSAND dollars a month. Sure, that includes other stuff too, but wow. Compare that to what I'm paying right now in the real world, if you will. I have my own little house in the city of Watertown, about 950 square feet, and I pay about $1100 per month in total expenses, excluding taxes, but including rent, heat, electricity, internet, food, water and sewer. It's not even in the same /ballpark/ as the college room and board cost! Best of all, I have my own bathroom and kitchen. And it's quiet here, pretty much all day and all night. I live next to a fire station, and it's infinitely more quiet than living next to college drunkards. The classes are OK, but the other crap they *required* just gets a huge HELL NO. And then, there's the tuition on top of that, oh my. And they nail you with interest? Just outrageous. Aaanyway, I did round two at the community college, and switched to computer science figuring an AS in computers is probably more useful than in physics, and is something I should be able to turn around quickly. And that wasn't bad at all. Government grants paid for the whole thing (for three semesters... I had already eaten a huge chunk of them in year 1) and I could live wherever I wanted. I might be ok with finishing that off someday if my business crashed and burned (and nobody took my years of experience as a substitute for college), but since the free money ran out, even the three or four grand they'd want to finish it off just doesn't look worth it. oh my looks like i got started on college ranting anyway. :)
 Duplicate code is not reusable or maintainable.

Amen.
Jan 21 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Sunday, 22 January 2012 at 01:17:21 UTC, Nick Sabalausky wrote:
 "Adam D. Ruppe" <destructionator gmail.com> wrote in message 
 news:mvloclloufauudewjnrj dfeed.kimsufi.thecybershadow.net...
 First off, they required all the first year students
 to live on campus. WTF. And, of course, they required
 these exorbitant fees for all that too.

At BGSU, they required first *and* second year students to live on campus. They had some sort of bullshit excuse about "bettering yourself" or some other such meaningless crap like that. But that's not the bad part: There was one year (that I *know* of) where they had more first and second year students then they had dorms for. Obviously, they couldn't do the sane thing and relax the requirement (after all, that might make BGSU look bad!), so they made a bunch of students (not me, luckily) *live* together in the dorm's lounge rooms. That was one of first of many "College, WTF?!" moments for me. (I had thought Animal House was fiction!)
 Best of all, I have my own bathroom and kitchen. And it's
 quiet here, pretty much all day and all night. I live next
 to a fire station, and it's infinitely more quiet
 than living next to college drunkards.

And even in the dorms, you still get the middle-of-the-night fire alarms anyway (speaking of drunks). But in the place you have, I bet you don't have to leave the house every time it happens...
 The classes are OK, but the other crap they *required*
 just gets a huge HELL NO.

I was...sort of...the other way around (kinda): There was admittedly a lot about campus life that was terrible, but there was also a lot about it that I loved and still sometimes miss (Many intangibles, but also the panini sandwiches at the campus convenience store! Yum! Much as BGSU sucked, they *did* have very good dining halls as long as you avoided anything resembling asian). Even though there were a *few* very good teachers/classes, it was mostly the academic (and administrative, financial and bureaucratic) aspects I had a problem with. Oh, and the drunks, of course.
 Aaanyway, I did round two at the community college,
 and switched to computer science figuring an AS in
 computers is probably more useful than in physics,
 and is something I should be able to turn around
 quickly.

 And that wasn't bad at all. Government grants paid
 for the whole thing (for three semesters... I had
 already eaten a huge chunk of them in year 1) and
 I could live wherever I wanted.

 I might be ok with finishing that off someday if my
 business crashed and burned (and nobody took my years
 of experience as a substitute for college), but
 since the free money ran out, even the three or
 four grand they'd want to finish it off just doesn't
 look worth it.

Heh, I finished off with community college, too! I started college (in 2000) with 2.5 years at BGSU (public party school, and in retrospect, the *best* of all the colleges I've been to, not that that's saying much). I had an absolutely terrible apartment situation the last semester (Lesson: *Never* get into a student-oriented apt complex with management that's based out-of-state. Especilly if it's leased by anything longer than month-to-month.) So then I transferred to JCU (private school, highly-respected, at least locally) so I could commute and save on living expenses. Was there for 1.5 years, retaking all the same CS classes I had already aced at BGSU (because JCU didn't believe I could possibly know what I was doing - I was merely a "student" after all - and an "undergrad" at that). Although it was technically 1.5 years, the last semester I was so jaded I was really only there physically; I wasn't actually trying at all, and I didn't care to. So they did put me on a one-semester academic suspension, but it didn't matter since I was already done with them by that point anyway. (It was somewhere in the middle of my time at JCU that I decided I genuinely *wanted* to not have a degree. I know that sounds like a rationalization to most people, but I swear it really isn't one for me.) At that point I went to the super-cheap[1] local Lakeland Community College part time, mainly so I could keep the ~$100k (yes, that's right) I'd racked up in loans out of repayment until I could actually pay them (for the record: I still can't :/ ). At the first two schools, I had been declared CS all four years from day one. Did it differently at LCC: *Officially*, I was going for...I think it was some sort of EE associate's or something like that, but really I took the opportunity to *for once in my life* actually take the classes that *I wanted* to take[2]. I even took an acting class that I absolutely loved; heck, it was the only class in my life I was genuinely sad to see end (and then I took a second one that...umm...didn't work out so well...) That community college is very highly regarded locally, and I was fairly impressed with it - at first. Then the staff, administrators, and one or two very specific instructors, kept finding all manner of new and creative ways to severely fuck me over. Eventually their demands got *so* unreasonable, and their bullshit *so* deep, that I just said "Fuck it, I'm done." That was probably about six-ish years ago. Things haven't been easy since (Hah! Like they ever were!), but I've never had a hint of regret about leaving. I have, however, had many regrets about having ever gottn involved in the first place. And I've also had many regrets about having listened to the people who talked me into not cutting my losses much sooner than I actually did. ("You've already gotten this far, you may as well get something out of it!" Yea, *thanks*, all you self-righteous assholes, now my debt is double what it would have been.) [1] That's "super-cheap" relatively speaking: it's still insanely expensive (and less effective) compared to a good library. Or even a good bookstore. [2] That was one of the many things I despised about college. I had always been told that in college, unlike high school (which made my miserable college experience seem like utopia by comparison) you choose your area of study. But that turned out to be a load of crap - unless you go to a tech school, 65%-75% of credits are completely unrelated to your major and it's *dictated* that you take them. (Academically, college literally *is* an expensive redo of high school). Now, I might have not minded the lack of self-direction, except that *I* was the one paying tens of thousands of $$$ for the classes! Who the fuck has ever heard of, say, a grocery store that told people which of their stock they could and couldn't buy? *Everyone* in faculty/staff thought I was nuts for seeing it that way. In their mind, you're *expected* to be happy paying them a fortune for the privilege of being told what you're allowed to learn. Talk about narcissism.

Jan 21 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
Oh crap, I did it again. Sorry for the useless
post, I clicked in the wrong place and it ended up
being the send button :(


On Sunday, 22 January 2012 at 01:17:21 UTC, Nick Sabalausky wrote:
 And even in the dorms, you still get the middle-of-the-night 
 fire alarms anyway (speaking of drunks). But in the place you 
 have, I bet you don't have to leave the house every time it 
 happens...

Indeed. Actually, I rarely even hear them leave; they usually don't turn the siren on until they are starting to pull out, so unless my window is open, it's not noticeable. There was one time some idiot was smoking his drugs in the dorm at the college, and it triggered the file alarm. It was cold and windy; upstate New York winter, and we all had to wait outside for... I think twenty minutes or so, maybe longer on short notice so we couldn't get properly dressed to be outside. What a pain in the ass.
 the ~$100k > (yes, that's right) I'd racked up in loans

Jesus Christ. I was able to avoid the loans personally; I picked the college that gave the best easy scholarship that was also close to home. The biggest error I made, financially, was going to the fancy place first. I looked at the community college with disdain and didn't actually consider it. Which is right and wrong. It's bullshit high school 2.0, but so is the first year or two of the other thing, and it costs MUCH less. (Actually, I liked high school, but meh.)
 actually take the classes that *I wanted* to take

Yea. I got a good chunk of that in high school too (also most my college credits were gotten from high school! From what I've seen on the internet, my HS experience must be the top 1% of the country or something.) What got me at the community college though was two things: 1) Phys ed was required. College gym x4 to get the fucking degree. For crying out loud. 2) They transferred a lot of stupid classes from the HS credits and the other school, including two English credits. English 102 and 204 or something like that. But they did *not* count any of it toward English 101! Oswego was willing to, but JCC wasn't. And, it was, of course, required. What the hell. It's so arbitrary, and apparently changes every other year. Ridiculous.
 having ever gottn involved in the first place. And I've also 
 had many regrets about having listened to the people who talked 
 me into not cutting my losses much sooner than I actually did.

Ah, yes, the sunk cost fallacy. (I learned that term on the Internet, btw. The college philosophy and logic classes were pretty poor.) Gah.
 Talk about narcissism.

They make you well rounded!
Jan 21 2012
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, January 21, 2012 16:27:05 Nick Sabalausky wrote:
 That reminds me: There's a *LOT* of people who told me "If two equally good
 people apply for the same job, and one has a degree and other other doesn't,
 the one with the degree will get the job." They always seem to think that's
 convincing, but there's three problems with it:
 
 1. That's a fairly contrived scenario.
 
 2. So...what, it's a $100k, 4+ year **tie-breaker**?? Sounds like a collosal
 waste to me.
 
 And probably most importantly:
 
 3. If you take all that time and money that would have gone into a degree
 and put it into building *real* skills and experience instead wasting it all
 on taking exams, cramming for exams instead of *actually* learning,
 homework assignments instead of *real* projects, etc., then you'd have
 something far better than a tie-breaker: You'd *be* the better candidate,
 by far. (And hell, if the other candidate is a middle-class white male,
 you'd have *far* less debt and could undercut the them on salary while
 *still* ending up with much more spending money.)

The main problem is getting past HR. Sure, if you could get into a real interview with real programmers, you could show that you know what you're talking about, but without a degree and/or a lot of experience on your resume, there are many companies where HR will filter you out before you get far enough along to prove that you know anything (and in some companies, the lack of a degree is probably still enough for HR to filter out your resume, even if you have quite a few years of professional experience). So beyond whatever you get in terms of education, the degree often makes it possible to get past HR so that you can actually interview and possibly get the job. Now, I totally dispute that college is a waste of time. You're going to learn a lot at college - at least if you go to a college that's worth anything - especially if you _want_ to learn rather than just trying to pass the exams. There's a lot to be gotten out of college whether it's required for a job or not. The issue IMHO is whether what you get is worth the cost, not whether it's actually valuable. But I don't really want to argue the issue, so I guess that I should shut up. - Jonathan M Davis
Jan 21 2012
parent "Nick Sabalausky" <a a.a> writes:
"Jonathan M Davis" <jmdavisProg gmx.com> wrote in message 
news:mailman.672.1327198345.16222.digitalmars-d puremagic.com...
 The main problem is getting past HR. Sure, if you could get into a real
 interview with real programmers, you could show that you know what you're
 talking about, but without a degree and/or a lot of experience on your 
 resume,
 there are many companies where HR will filter you out before you get far 
 enough
 along to prove that you know anything (and in some companies, the lack of 
 a
 degree is probably still enough for HR to filter out your resume, even if 
 you
 have quite a few years of professional experience). So beyond whatever you 
 get
 in terms of education, the degree often makes it possible to get past HR 
 so
 that you can actually interview and possibly get the job.

Meh, companies like that deserve to go under as a result of gross incompetence anyway. I'm not normally an "invisible hand" guy, but I say let the those companies run themselves out of business instead of bending over backwards to help their idiocy work out. We'll all be better off for it.
 Now, I totally dispute that college is a waste of time. You're going to 
 learn
 a lot at college - at least if you go to a college that's worth anything -
 especially if you _want_ to learn rather than just trying to pass the 
 exams.
 There's a lot to be gotten out of college whether it's required for a job 
 or
 not. The issue IMHO is whether what you get is worth the cost, not whether
 it's actually valuable.

I won't deny that you can learn things in college. Hell, I'll even admit that I learned things there. I just don't think you can learn nearly as much, nearly as well, or nearly as inexpensively as you can via other means. I've had a *lot* of people tell me "You get out of college what you put into it", but even that's patently false: What you get out of it is *proportional* to what you put in, yes, but it's a miniscule fraction. There's one hell of an enormous overhead involved. To slightly modify an old quote: "If you want a plush cubicle hell and debt, get a degree. If you want an education, get a library card."
 But I don't really want to argue the issue,

Sorry...I couldn't help replying. :/ Don't mean to try to drag you into it.
Jan 21 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Sunday, 22 January 2012 at 02:12:25 UTC, Jonathan M Davis 
wrote:
 The main problem is getting past HR.

All the jobs I've had (so observation bias here) have been because I knew somebody or knew somebody who knew somebody. I find it's good business to stay on good terms with everyone I know, personally and professionally, since a good reference from the right person does wonders. Better yet, you might have jobs come to you when someone needs something, and his friend offers "I know a guy..."
Jan 21 2012
parent bearophile <bearophileHUGS lycos.com> writes:
Adam D. Ruppe:

 All the jobs I've had (so observation bias here) have been
 because I knew somebody or knew somebody who knew somebody.

This is very often true outside academia (and often inside it too). But no one tells this (and several other basic things, that probably require about 1 hour total to be told) to university students. Bye, bearophile
Jan 21 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, January 21, 2012 22:12:46 Nick Sabalausky wrote:
 Sorry...I couldn't help replying. :/  Don't mean to try to drag you into it.

I don't mind you replying. I'm just trying to get across that I'm not really interested in going back and forth on it. I clearly disagree with you on the value of college, and I just don't see the value in arguing it back and forth. - Jonathan M Davis
Jan 21 2012
prev sibling next sibling parent "Nick Sabalausky" <a a.a> writes:
"Robert Clipsham" <robert octarineparrot.com> 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... &*!(^$&* %^&*#$&*() ^$*(!^$(*!&#*(!^
Jan 22 2012
prev sibling next sibling parent reply bcs <bcs example.com> writes:
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 = 5; break; case 1: i = 4; break; default: i = 42; } i < 77; i++) writefln("Wat!?");
Jan 22 2012
parent reply Matt Soucy <msoucy csh.rit.edu> writes:
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 = getInt(); for (switch(j) { case 0: i = 5; break; case 1: i = 4; break; default: i = 42; } i < 77; i++) writefln("Wat!?");

Wat. This managed to confuse me and most of the people around me. Especially since it works.
Jan 22 2012
next sibling parent reply bcs <bcs example.com> writes:
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 WATs you can do in D.

IIRC: int i, j = getInt(); for (switch(j) { case 0: i = 5; break; case 1: i = 4; break; default: i = 42; } i < 77; i++) writefln("Wat!?");

Wat. This managed to confuse me and most of the people around me. Especially since it works.

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, expression statements and if/for/switch/etc.).
Jan 22 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
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 happens
 to include variable decelerations, expression statements and
 if/for/switch/etc.).

Yeah. I thought that that was extremely cool when I figured that out. I'm not sure that there's any real use for it being so flexible, and in most cases, doing the sort of thing that you just did shouldn't be done, but it does allow you to do some cool stuff with the first portion of the for loop. - Jonathan M Davis

All cool stuff that can be done elsewhere in a function body can also be done with the first portion of the for loop. ;)
Jan 22 2012
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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, expression statements and
 if/for/switch/etc.).

Yeah. I thought that that was extremely cool when I figured that out. I'm not sure that there's any real use for it being so flexible, and in most cases, doing the sort of thing that you just did shouldn't be done, but it does allow you to do some cool stuff with the first portion of the for loop. - Jonathan M Davis
Jan 22 2012
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
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 instead, but
 this is very counterintuitive to a newcomer. It certainly elicited a WAT
 from me today when I first ran into this schizophrenic split between
 std.stdio (which is pretty much used in every D code example I've seen,
 which gives the impression that it's the "native" and "default" thing to
 use) and std.stream (which one would expect should naturally extend the
 functionality of std.stdio, but it doesn't).

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 (or if it is, it's an implementation detail). So, my general expectation is that they're completely separate, though I suppose that they don't _have_ to be designed that way. Given that std.stream has its own File type, that would make it pretty obvious that the File from std.stdio would not work with std.stream. But I guess that you could see a function taking File in std.stream without having read enough of std.stream's documentation to realize that it had its own File type. - Jonathan M Davis
Feb 06 2012
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
On 07/02/2012 01:18, Jonathan M Davis wrote:
<snip>
 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 both stream based - they just use different stream APIs. But I am made to wonder why the wrapper for C FILE structures isn't implemented in terms of the std.stream API. I suppose if there's any such thing as non-stream-based I/O, it would be something like std.file.read/write or memory-mapped files. Though even these might be internally implemented in a stream-based way. Stewart.
Feb 07 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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 InputStream.
 
 Yes I know, you need to import cstream and use cstream.din instead,
 but this is very counterintuitive to a newcomer. It certainly
 elicited a WAT from me today when I first ran into this
 schizophrenic split between std.stdio (which is pretty much used in
 every D code example I've seen, which gives the impression that it's
 the "native" and "default" thing to use) and std.stream (which one
 would expect should naturally extend the functionality of std.stdio,
 but it doesn't).

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 (or if it is, it's an implementation detail). So, my general expectation is that they're completely separate, though I suppose that they don't _have_ to be designed that way.

The thing is, coming from a Linux background, I've become accustomed to the "everything is a file" concept, which entails "file == stream". So I found it very strange to discover that this is not true in D, at least as far as std.stdio is concerned.
 Given that std.stream has its own File type, that would make it pretty
 obvious that the File from std.stdio would not work with std.stream.
 But I guess that you could see a function taking File in std.stream
 without having read enough of std.stream's documentation to realize
 that it had its own File type.

I certainly did not realize this, since the docs refer to "File" rather than "std.stream.File" or "std.stdio.File" explicitly. But even after I realized there were two different File types, it took me yet another while to figure out how to bridge them with std.cstream. This is one of those things that *really* needs good docs for newbies, because it's a point of confusion to the uninitiated that needs to be explained. On another note, I find this divide between std.stream and std.stdio quite jarring. The C++ model is to use <iostream> by default, and optionally provide <cstdio> to those who prefer it. This, I find, makes sense, because streams are a much more powerful concept that subsumes the concept of a file, and having it as default makes sense. Having <cstdio> as an option is merely a concession for C programmers who migrated to C++ (and I'm one of them who still hold on to cstdio over iostream) -- so it's understandable that the two cannot be freely intermixed. 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 motivating variadic templates, so it seems to hold the equivalent place to <iostream> in C++. As such, I found it strange that this divide between streams and stdio files still persists in D. I would have thought that D should have integrated the two seamlessly into a single subsystem (or otherwise redesigned it in a more logical fashion), rather than perpetuating the schizophrenic divide inherited from C/C++. T -- Маленькие детки - маленькие бедки.
Feb 06 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
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 motivating variadic
 templates, so it seems to hold the equivalent place to<iostream>  in
 C++. As such, I found it strange that this divide between streams and
 stdio files still persists in D. I would have thought that D should have
 integrated the two seamlessly into a single subsystem (or otherwise
 redesigned it in a more logical fashion), rather than perpetuating the
 schizophrenic divide inherited from C/C++.


 T

To be exact, your comparison is between Phobos/STL, not D/C++.
Feb 07 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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 <iostream> by default, and
 optionally provide <cstdio> to those who prefer it. This, I find, makes
 sense, because streams are a much more powerful concept that subsumes
 the concept of a file, and having it as default makes sense. Having
 <cstdio> as an option is merely a concession for C programmers who
 migrated to C++ (and I'm one of them who still hold on to cstdio over
 iostream) -- so it's understandable that the two cannot be freely
 intermixed.

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 soon as you need formatting, they're a pain. So, for the most part, printf gets used. I think that about the only place that I see streams used much is binary streams which take advantage of an object knowing how to write and read itself to and and from a stream. But even that's rare in my experience. I'm sure that it depends on the programmers though.
 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 motivating variadic
 templates, so it seems to hold the equivalent place to <iostream> in
 C++. As such, I found it strange that this divide between streams and
 stdio files still persists in D. I would have thought that D should have
 integrated the two seamlessly into a single subsystem (or otherwise
 redesigned it in a more logical fashion), rather than perpetuating the
 schizophrenic divide inherited from C/C++.

You end up with pretty much the same thing in C# and Java. println and its friends are what's used most frequently (though it works better in D, C#, and Java than it does in C++, thanks to toString), though streams do get used for some stuff - usually not text though. It probably varies a bit from programmer to programmer though. Regardless, I wouldn't really consider a file to be specific to either the stdio approach or streams. If anything, I find it bizarre that std.stream uses the term File for a stream. That seems to me to be like making a container into a range or an iterator, which really doesn't make sense. You have a range _over_ a container, not a container which is a range. One of the reasons that dealing with dynamic arrays in D can be so confusing is that they're ranges and people think that they're containers (though they really aren't, since they don't own their memory). Mixing the concept of file and stream seems like a bad idea. But it's probably just a case of a poorly named type. In any case, std.stream is rather old and outdated and will be replaced at some point with a range-based API. And its replacement may interact with std.stdio better. - Jonathan M Davis
Feb 06 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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 soon as you need formatting, they're a pain.
 So, for the most part, printf gets used. I think that about the only
 place that I see streams used much is binary streams which take
 advantage of an object knowing how to write and read itself to and and
 from a stream. But even that's rare in my experience. I'm sure that it
 depends on the programmers though.

I don't see what's the discrepancy between formatting and streams. As far as I'm concerned, writeln() is essentially taking a bunch of objects, converting them to string representations, and writing said strings sequentially to some output channel (i.e., output stream). [...]
 You end up with pretty much the same thing in C# and Java. println and
 its friends are what's used most frequently (though it works better in
 D, C#, and Java than it does in C++, thanks to toString), though
 streams do get used for some stuff - usually not text though. It
 probably varies a bit from programmer to programmer though.

And println/writeln is essentially writing to an output stream. It can be a file, a socket, a pipe, whatever. The functionality of a stream is all that's needed to implement it.
 Regardless, I wouldn't really consider a file to be specific to either
 the stdio approach or streams. If anything, I find it bizarre that
 std.stream uses the term File for a stream. That seems to me to be
 like making a container into a range or an iterator, which really
 doesn't make sense. You have a range _over_ a container, not a
 container which is a range. One of the reasons that dealing with
 dynamic arrays in D can be so confusing is that they're ranges and
 people think that they're containers (though they really aren't, since
 they don't own their memory). Mixing the concept of file and stream
 seems like a bad idea. But it's probably just a case of a poorly named
 type.

To me, most file operations are essentially treating them as streams. Reading a text file, whether it's char by char or line by line, is essentially reading from an input stream. The program then does some processing, and writes out some other data, be it text or binary or whatever, but it's mostly just a series of sequential writes. So it's an output stream. Of course, files have more operations than just I/O streams; sometimes you do need seeking to some offset, and read/write stuff in non-sequential order. But usually this entails very specific file structures (e.g., using B-trees for databases, etc.). Most of the time it's just stream in, stream out. The advantage of using streams is that your code can then operate on more than just files. It can work with sockets and pipes (that cannot support random access), string buffers, procedural data generators and consumers, etc.. Files are just a small subset of what the code can actually be used for. In my mind, the D I/O system ought to be designed around this general concept. Files are just a specific instance of a stream (or range or what-have-you) that happens to have random-access operations, just as arrays just happen to be ranges with random-access operations, but ranges cover so much more. In fact, functions like writeln() really ought to be completely generic as to where the output is sent. One should be able to, for example, write to a char buffer, or even to a char consumer function or object. Similarly, things like readln() or byLine() should be able to work with anything that behaves like a sequential source of characters: console, files, sockets, strings, functions or objects that spit out chars, etc.. Couple this with buffers (which are themselves sources/sinks, that just happen to have random-access for a limited range), and you've pretty much covered 90% of what files are generally used for. The other 10% involve complicated file structures that will require hand-coding anyway, so it is sufficient for the actual File class to have extra methods for random access, and the user can code up the rest. Code that need just a data source and/or a data sink shouldn't need to be unnecessarily limited to files. Imagine if std.regex can work directly with files. Or sockets. With no additional code save opening the file/setting up the socket. Or procedurally generated strings, without needing any intermediate buffers.
 In any case, std.stream is rather old and outdated and will be
 replaced at some point with a range-based API. And its replacement may
 interact with std.stdio better.

Yikes! So I should just avoid using it altogether then? How come it's not marked deprecated? T -- Which is worse: ignorance or apathy? Who knows? Who cares? -- Erich Schubert
Feb 06 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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 nice for some basic stuff and for object
 oriented stuff, but as soon as you need formatting, they're a pain.
 So, for the most part, printf gets used. I think that about the only
 place that I see streams used much is binary streams which take
 advantage of an object knowing how to write and read itself to and and
 from a stream. But even that's rare in my experience. I'm sure that it
 depends on the programmers though.

I don't see what's the discrepancy between formatting and streams. As far as I'm concerned, writeln() is essentially taking a bunch of objects, converting them to string representations, and writing said strings sequentially to some output channel (i.e., output stream).

In C++, you end up with stuff like cout << "point: [" << x << ", " << y "]" << endl; That's already much uglier than printf("point: [%f, %f]\n", x, y); But what if you want to do something like %02f? With printf, that's easy: printf("point: [%02f, %02f]\n", x, y); With streams, it's hideous. I'd have to go look it up to give you an example. It involves setting flags in the stream and the like, and it's horrible. In my experience, no one uses it.
 [...]
 
 You end up with pretty much the same thing in C# and Java. println and
 its friends are what's used most frequently (though it works better in
 D, C#, and Java than it does in C++, thanks to toString), though
 streams do get used for some stuff - usually not text though. It
 probably varies a bit from programmer to programmer though.

And println/writeln is essentially writing to an output stream. It can be a file, a socket, a pipe, whatever. The functionality of a stream is all that's needed to implement it.
 Regardless, I wouldn't really consider a file to be specific to either
 the stdio approach or streams. If anything, I find it bizarre that
 std.stream uses the term File for a stream. That seems to me to be
 like making a container into a range or an iterator, which really
 doesn't make sense. You have a range _over_ a container, not a
 container which is a range. One of the reasons that dealing with
 dynamic arrays in D can be so confusing is that they're ranges and
 people think that they're containers (though they really aren't, since
 they don't own their memory). Mixing the concept of file and stream
 seems like a bad idea. But it's probably just a case of a poorly named
 type.

[snip]

The long term plan is to create a std.stream which then provides a range-based interface for streams. Then you can do with it whatever you can do with any input stream - though there's still a lot that you would lose out on, since it can't be a forward range. Exactly how that will interact with std.stdio, I don't know. That will depend on the API that's finally decided up. Regardless, my point was that while it might make sense to have a stream over a file, it doesn't make sense for a stream to _be_ a file, any more than it makes sense for a container to _be_ a range. You have a range over the container. The container itself isn't a range. So, std.stream's File type is poorly named IMHO. But it's going away in the long run, so it ultimately doesn't really matter what it was named.
 In any case, std.stream is rather old and outdated and will be
 replaced at some point with a range-based API. And its replacement may
 interact with std.stdio better.

[...] Yikes! So I should just avoid using it altogether then? How come it's not marked deprecated?

Because it doesn't have a replacement yet. The replacement has been discussed on some level, but no one has fleshed it out and implemented it yet. Steven Schveighoffer's rewrite of std.stdio may start that ball rolling. I don't know. What it really needs is a champion to take on the effort of leading the discussion, implementing it, and pushing it through the review process. No one has really stepped up to do that yet. It's like std.xml. You can use it, but it's not going to be around in the long term, and we don't have a replacement for it yet. We're just certain that the current version is unacceptable and needs to be replaced. It would probably be a good idea to put a warning of some kind in the documentation, but for the moment, it's not going away. - Jonathan M Davis
Feb 06 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
[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 essentially taking a bunch of
 objects, converting them to string representations, and writing said
 strings sequentially to some output channel (i.e., output stream).

In C++, you end up with stuff like cout << "point: [" << x << ", " << y "]" << endl; That's already much uglier than printf("point: [%f, %f]\n", x, y); But what if you want to do something like %02f? With printf, that's easy: printf("point: [%02f, %02f]\n", x, y); With streams, it's hideous. I'd have to go look it up to give you an example. It involves setting flags in the stream and the like, and it's horrible. In my experience, no one uses it.

But this is really just the result of a misguided implementation. Nothing about the concept of streams requires you to use C++'s very ugly scheme of setting stream manipulators just to get formatting right. Things like writeln() or writefln() are not inherently tied to stream or non-stream; they are just convenience functions for converting types into string representations. What you do with the converted result is orthogonal to the formatting itself. Nothing stops us, for example, from implementing writefln() such that it writes its output to a stream object. Formatted output in itself has nothing to do with whether the target is a stream or not. Nothing stops the implementation from using a temporary buffer for, say, formatting field widths, etc.. The result still written somewhere -- and my whole point is that, that "somewhere" is essentially just an output stream. You don't need random access, you don't need mmap(), all you need is a sink to send the characters to. Right now it has to be some kind of File, but my point is that it doesn't *have* to be. Any output stream would do. [...]
 The long term plan is to create a std.stream which then provides a
 range-based interface for streams. Then you can do with it whatever
 you can do with any input stream - though there's still a lot that you
 would lose out on, since it can't be a forward range. Exactly how that
 will interact with std.stdio, I don't know. That will depend on the
 API that's finally decided up.

 Regardless, my point was that while it might make sense to have a
 stream over a file, it doesn't make sense for a stream to _be_ a file,
 any more than it makes sense for a container to _be_ a range. You have
 a range over the container. The container itself isn't a range. So,
 std.stream's File type is poorly named IMHO. But it's going away in
 the long run, so it ultimately doesn't really matter what it was
 named.

Correct, it should be the other way round: a _file_ is a kind of stream, but a stream is not a kind of file (e.g. it could be a socket, a char array, a procedural source/sink of characters). It's pure and simple OO. In my mind, it's as simple as: class Stream { ... } class File : Stream { ... /* additional methods for random access */ } void writeln(T...)(OutputStream os, T args) { ... } void writeln(T...)(T args) { writeln(stdout, args); } void writefln(T...)(OutputStream os, string fmt, T args) { ... } void writefln(T...)(string fmt, T args) { writefln(stdout, fmt, args); } Of course, this is just the first level of refinement. To be truly generic, we could define popFront() on input streams and put() on output streams, and similarly for arrays or even arbitrary objects, then we can use writeln(), writefln(), etc., on all of these types freely.
 In any case, std.stream is rather old and outdated and will be
 replaced at some point with a range-based API. And its replacement
 may interact with std.stdio better.

[...] Yikes! So I should just avoid using it altogether then? How come it's not marked deprecated?

Because it doesn't have a replacement yet. [...] It's like std.xml. You can use it, but it's not going to be around in the long term, and we don't have a replacement for it yet. We're just certain that the current version is unacceptable and needs to be replaced. It would probably be a good idea to put a warning of some kind in the documentation, but for the moment, it's not going away.

I say it *definitely* should be clearly marked as "to be deprecated" in the docs. Otherwise unknowing newbies will invest lots of time to learn the API, only to discover months down the road that all of that was for nought. That will definitely turn away a lot of people. T -- Lawyer: (n.) An innocence-vending machine, the effectiveness of which depends on how much money is inserted.
Feb 07 2012
prev sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
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 - Software Engineer
Feb 09 2012