archived
stringclasses
2 values
author
stringlengths
3
20
author_fullname
stringlengths
4
12
body
stringlengths
0
22.5k
comment_type
stringclasses
1 value
controversiality
stringclasses
2 values
created_utc
stringlengths
10
10
edited
stringlengths
4
12
gilded
stringclasses
7 values
id
stringlengths
1
7
link_id
stringlengths
7
10
locked
stringclasses
2 values
name
stringlengths
4
10
parent_id
stringlengths
5
10
permalink
stringlengths
41
91
retrieved_on
stringlengths
10
10
score
stringlengths
1
4
subreddit_id
stringclasses
1 value
subreddit_name_prefixed
stringclasses
1 value
subreddit_type
stringclasses
1 value
total_awards_received
stringclasses
19 values
True
[deleted]
null
So.. if we have `List<[Rectangle]>` can we downcast it to `List<[Shape]>` somehow? Assuming that rectangle is subclass of Shape. And we want compile time type checks.
null
0
1316065075
False
0
c2k03rj
t3_kfvm7
null
t1_c2k03rj
t3_kfvm7
null
1427602398
2
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1316065190
False
0
c2k045j
t3_kfirl
null
t1_c2k045j
t1_c2jxu2a
null
1427602403
0
t5_2fwo
null
null
null
True
tinou
null
You can do that in ocaml too, and it is strict : let rec xs = 1::2::3::xs;;
null
0
1316065279
False
0
c2k04g6
t3_kfvm7
null
t1_c2k04g6
t1_c2jz3ti
null
1427602407
5
t5_2fwo
null
null
null
True
splicerslicer
null
March 3, 2012 I believe. I simply cannot believe you did not fully read the terms before agreeing to them. ;) edit: wrong year, I'm an idiot
null
0
1316065350
True
0
c2k04nw
t3_kewkd
null
t1_c2k04nw
t1_c2juge8
null
1427602410
2
t5_2fwo
null
null
null
True
howardRoark36
null
only for basic types. everything else is a reference. in the example, it'd be better to pass a StringBuilder
null
0
1316065433
False
0
c2k04x1
t3_kg7nl
null
t1_c2k04x1
t3_kg7nl
null
1427602414
4
t5_2fwo
null
null
null
True
splicerslicer
null
Why did they hide WMP? Their start screen should really contain all of the available programs.
null
0
1316065441
False
0
c2k04xq
t3_kewkd
null
t1_c2k04xq
t1_c2juluk
null
1427602414
1
t5_2fwo
null
null
null
True
splicerslicer
null
Link?
null
0
1316065499
False
0
c2k0551
t3_kewkd
null
t1_c2k0551
t1_c2jv282
null
1427602417
1
t5_2fwo
null
null
null
True
munificent
null
> The bigger the game, the more wasteful ineffective code becomes. The State Pattern allows us to have the same behaviour without all of that unnecessary checking. The code is still doing that checking, it's just doing it with polymorphic dispatch instead of an `if`. There's indirection (and likely a cache miss) either way. Just doing an `if` is likely faster. Certainly allocating a new object on each state change isn't going to be fun unless you've got a smart allocation system. If you really care about performance, what you'd do is eliminate the state pattern entirely and just set a damage multiplier on the player when shields are enabled and disabled: one multiply and no branching. Also, you'll note here that the states being presented don't have any actual... state... (i.e. fields) beyond their own identity. In that case, there's no need for classes, pointers, dynamic allocation, etc. All you need is function pointers: typedef void(*DamageFn)(int); class Player { public: Player() { state = normal; } void takeDamage(int i) { state(damage); } void setStateNormal() { state = normal; } void setStateShielded() { state = shielded; } private: DamageFn state; static void normal(int damage) { printf("You have taken %d damage", damage); } static void shielded(int damage) { printf("You have taken %d damage", damage / 2); } } The AI for Henry Hatsworth is all state machine based and it uses raw function pointers like this instead of allocating state objects. (For what it's worth, that was probably the wrong choice. In a real game, you often do need additional data to store with the states, and it was a real pain in the ass to not have that with Hatsworth. This was my first and only DS game and I was overly paranoid about memory use. I should have just used a memory pool and allowed stateful state objects.)
null
0
1316065567
True
0
c2k05ch
t3_kfuqy
null
t1_c2k05ch
t3_kfuqy
null
1427602419
8
t5_2fwo
null
null
null
True
splicerslicer
null
I did this. I was really surprised it worked. I just had a Win7 partition I wasn't using so I mounted it using Daemon started it up, took a shower, came back and I had Windows 8.
null
0
1316065595
False
0
c2k05ff
t3_kewkd
null
t1_c2k05ff
t1_c2juh5s
null
1427602420
1
t5_2fwo
null
null
null
True
newbill123
null
Gotcha. I thought it was an incestuous "inside Redmond campus" always knows what's right for 3rd party developers or something. Thanks for the clarification.
null
0
1316065620
False
0
c2k05ic
t3_hq4zm
null
t1_c2k05ic
t1_c2k034n
null
1427602422
1
t5_2fwo
null
null
null
True
Negitivefrags
null
In terms of ease of use, I think that there is there is value to be had in composing two simple primitives in a natural way. In terms of boost as a dependency, one thing we have found in our code base is that >90% of the boost we used before were the smart pointers and things like ptr_vector that we can now avoid. Having that stuff in the standard now means that we mostly just use boost in specific source files rather than all over the place in headers. As to the compiler dependency, time should fix that problem.
null
0
1316065728
False
0
c2k05u8
t3_kf43e
null
t1_c2k05u8
t1_c2jxld7
null
1427602426
2
t5_2fwo
null
null
null
True
timbowen
null
Reclaimer: I have been a professional iOS developer for 3 years and these are all valid criticisms. I can take them uno by uno. * JSONKit is good but if the built in interpreter is better or even just good enough it is almost always better to prevent code bloat by using built in resource. I was also diving into JSONKit today to debug a response that wasn't parsing, and it took longer than I think it should have. * I also used to swear by ASIHTTPRequest, but see comment above. Apple has finally gotten their act together with the built in request library. * Forego control of cache on a mobile app? Wrap your brain around two different HTTP libraries? Why? * Code bloat is the devil, see above. It actually matters when your users are downloding your app over a metered data connection. Steipete's comment seems to be basically a recap of the ponts above. I would also like to add that using this package would a terrible mistake for the novice user. They would be learning old conventions that I myself am having some difficulty unlearning after having several years in the game. Don't do that to yourself. Get the bleeding edge tech and use it. If it sucks, make the next bleeding edge tech. If you use this you are starting your project backwards in time.
null
0
1316065769
False
0
c2k05yi
t3_kfirl
null
t1_c2k05yi
t1_c2jy770
null
1428194055
5
t5_2fwo
null
null
null
True
munificent
null
Sum types wouldn't eliminate the pattern, since matching on the constructors is no different than doing a switch on an enum in this case, where the arms of the sum don't have different data. Function values would work here since the states are stateless, and you can indeed do that in C++.
null
0
1316065818
False
0
c2k0643
t3_kfuqy
null
t1_c2k0643
t1_c2jyspz
null
1427602429
2
t5_2fwo
null
null
null
True
munificent
null
> Think about structures like circularly linked lists. Those aren't too bad if you're willing to sacrifice immutability for the relatively few cases where this turns up. Just initialize to a sentinel value (or make its type nullable and initialize to null) then wire it back up later.
null
0
1316065949
False
0
c2k06ke
t3_kfvm7
null
t1_c2k06ke
t1_c2jz3ti
null
1427602435
2
t5_2fwo
null
null
null
True
munificent
null
It's a perfectly good reason to *make* one. Everyone is free to re-invent, and it's a profitable exercise for the re-inventor. It may not be a good reason for *someone else* to *use* that language, but that's a different question entirely.
null
0
1316066057
False
0
c2k06ww
t3_kfvm7
null
t1_c2k06ww
t1_c2jzy1n
null
1427602440
22
t5_2fwo
null
null
null
True
kirakun
null
I'm pretty sure I know how apps work. (I wrote a few of them.) Just curious, what made you say that? BTW, I was just joking on the ridiculous restrictions (or what used to be) that Apple placed on the developers. I had to mention that because I don't think you understand jokes. :)
null
0
1316066087
True
0
c2k070i
t3_kfirl
null
t1_c2k070i
t1_c2k045j
null
1427602441
2
t5_2fwo
null
null
null
True
Nok1
null
quite possibly the best thing to come out of BUILD are the new VS tools
null
0
1316066112
False
0
c2k073g
t3_kg44k
null
t1_c2k073g
t3_kg44k
null
1427602452
2
t5_2fwo
null
null
null
True
alexeyr
null
> Let's say I've got a variable named "sum". Why should I have to explicitly initialize it to 0? Because you don't want to have the default value depend on variable name?
null
0
1316066151
False
0
c2k077z
t3_kfvm7
null
t1_c2k077z
t1_c2jy18p
null
1428194055
3
t5_2fwo
null
null
null
True
chaoticprout
null
Tile Puzzle is included in the Developer Preview build of Windows 8!
null
0
1316066194
False
0
c2k07ct
t3_kewkd
null
t1_c2k07ct
t1_c2k0551
null
1427602445
1
t5_2fwo
null
null
null
True
wot-teh-phuck
null
UnknownTales3 is a "pro-haskell" troll. Please don't try to take his words seriously.
null
0
1316066419
False
0
c2k081r
t3_kful5
null
t1_c2k081r
t1_c2jyfeo
null
1427602454
5
t5_2fwo
null
null
null
True
cashto
null
class Player { std::function<void (int)> damageStrategy; int health; public: void setStateShielded() { damageStrategy = [health&](int i) { health -= i / 2; }; } void setStateNormal() { damageStrategy = [health&](int i) { health -= i; }; } void takeDamage(int i) { damageStrategy(i); } }; I don't think this actually compiles, but you get the idea.
null
0
1316066427
True
0
c2k082m
t3_kfuqy
null
t1_c2k082m
t1_c2k03mp
null
1427602455
1
t5_2fwo
null
null
null
True
eric_t
null
Decent introduction to Mathematica, but given the title I expected to see some skin renders...
null
0
1316066810
False
0
c2k097m
t3_kfc1f
null
t1_c2k097m
t3_kfc1f
null
1427602469
1
t5_2fwo
null
null
null
True
danharaj
null
Yeah, the sums are irrelevant here, I just included them for completeness sake. Function values and strong sum types are the low-hanging fruit of high level languages.
null
0
1316066824
False
0
c2k0990
t3_kfuqy
null
t1_c2k0990
t1_c2k0643
null
1427602470
2
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1316066973
False
0
c2k09ok
t3_kfms2
null
t1_c2k09ok
t1_c2jzx5m
null
1427602476
1
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1316067020
False
0
c2k09tk
t3_kfvm7
null
t1_c2k09tk
t1_c2jxl4n
null
1427602477
1
t5_2fwo
null
null
null
True
danthrax
null
I thought I read March 2012 in the ToC.
null
0
1316067046
False
0
c2k09w8
t3_kewkd
null
t1_c2k09w8
t1_c2k04nw
null
1427602478
1
t5_2fwo
null
null
null
True
splicerslicer
null
lol thanks
null
0
1316067309
False
0
c2k0ap0
t3_kewkd
null
t1_c2k0ap0
t1_c2k09w8
null
1427602489
1
t5_2fwo
null
null
null
True
aivarannamaa
null
For a new baggage-less language, having null value in all (reference) types looks like a serious mistake. Better use disjoint sum types for nullable things and provide concise syntax for it (eg. String?)
null
0
1316067340
False
0
c2k0asb
t3_kfvm7
null
t1_c2k0asb
t3_kfvm7
null
1427602490
23
t5_2fwo
null
null
null
True
splicerslicer
null
Hah! I already played it and didn't even make the connection. Congrats, it's a fun game.
null
0
1316067438
False
0
c2k0b23
t3_kewkd
null
t1_c2k0b23
t1_c2k07ct
null
1427602493
1
t5_2fwo
null
null
null
True
dauphic
null
It is! It could be re-implemented using placement new, as long as you make sure the sub-classes all have the same size.
null
0
1316067570
False
0
c2k0bex
t3_kfuqy
null
t1_c2k0bex
t1_c2jzum2
null
1428194052
3
t5_2fwo
null
null
null
True
aivarannamaa
null
There's big difference: lambdas allow writing higher level code, mutexes and possibility for instruction twiddling are low level features.
null
0
1316067641
False
0
c2k0bmr
t3_kf2xi
null
t1_c2k0bmr
t1_c2jvk7r
null
1427602502
2
t5_2fwo
null
null
null
True
deltageek
null
Um, what? Perhaps you're not aware, but Java only supports pass-by-value. References to objects are still passed by value. In order to get the functionality of pass-by-reference in which the called method can change what object the caller's reference refers to, you need to wrap the value you're passing. This way, the caller's reference to the passed object doesn't change, but the called method can change what the wrapped value is. Arrays are a cheap (and hacky) way of doing this.
null
0
1316067714
False
0
c2k0bu8
t3_kg7nl
null
t1_c2k0bu8
t1_c2k04x1
null
1427602505
5
t5_2fwo
null
null
null
True
dauphic
null
I think the real headline here is the DirectX debugging and diagnostic support. Debugging graphical applications is a gigantic pain in the ass.
null
0
1316068107
False
0
c2k0cxu
t3_kg44k
null
t1_c2k0cxu
t3_kg44k
null
1427602521
26
t5_2fwo
null
null
null
True
Cintax
null
Three words: Honeycomb closed source.
null
0
1316068148
False
0
c2k0d2e
t3_kcwx2
null
t1_c2k0d2e
t1_c2jxhcm
null
1427602522
-1
t5_2fwo
null
null
null
True
grauenwolf
null
The example was simplified for explanatory purposes. In read code the line `x ="sam"` may actually be several lines long or contain other conditional logic. The == for assignment was a typo.
null
0
1316068528
False
0
c2k0e39
t3_kfvm7
null
t1_c2k0e39
t1_c2jyvlb
null
1427602534
1
t5_2fwo
null
null
null
True
grauenwolf
null
thanks
null
0
1316068538
False
0
c2k0e4a
t3_kfuii
null
t1_c2k0e4a
t1_c2jyqc0
null
1427602534
1
t5_2fwo
null
null
null
True
andersonimes
null
Generics support in MEF will be great. Have to work around that a lot now.
null
0
1316068561
False
0
c2k0e6b
t3_kfuii
null
t1_c2k0e6b
t3_kfuii
null
1427602535
1
t5_2fwo
null
null
null
True
grauenwolf
null
I hear that most of WPF is hardware accelerated, but not from reliable sources.
null
0
1316068591
False
0
c2k0e93
t3_kfuii
null
t1_c2k0e93
t1_c2jyqb8
null
1427602536
2
t5_2fwo
null
null
null
True
grauenwolf
null
It was a simplifed example, in real code there could be a lot more logic within each if block. Had my code really been that simple I would have simply using a ternary operator as you did.
null
0
1316068675
False
0
c2k0ehb
t3_kfvm7
null
t1_c2k0ehb
t1_c2jykvd
null
1427602539
1
t5_2fwo
null
null
null
True
grauenwolf
null
Another example: class Foo int product In C# it will initialize product to 0. Why does it do this if it won't initialize a local of the same type?
null
0
1316068757
False
0
c2k0ep6
t3_kfvm7
null
t1_c2k0ep6
t1_c2jyi4d
null
1427602543
1
t5_2fwo
null
null
null
True
grauenwolf
null
Then why aren't you required to initialize fields on classes in Java or C#?
null
0
1316068787
False
0
c2k0esi
t3_kfvm7
null
t1_c2k0esi
t1_c2jy7v8
null
1427602542
-2
t5_2fwo
null
null
null
True
grauenwolf
null
That sentinel value would be semantically identical to a null.
null
0
1316069086
False
0
c2k0fk0
t3_kfvm7
null
t1_c2k0fk0
t1_c2jzvds
null
1427602553
18
t5_2fwo
null
null
null
True
MatrixFrog
null
True, but I've still found that my favorite thing about Haskell is the lack of NullPointerExceptions. Until I learned Haskell, it never occurred to me that a language without null pointers was even possible. And even if it is more complicated, you could still say x = if complicatedBooleanExpression then complicated >>= expression . returning $ some string else other $ expression returning $ another string (I may have the indentation wrong, but anyway...) and there are no null pointers anywhere, ever, and you don't have to look through all the code to make sure x actually gets set.
null
0
1316069172
False
0
c2k0fro
t3_kfvm7
null
t1_c2k0fro
t1_c2k0ehb
null
1427602555
2
t5_2fwo
null
null
null
True
DanielKeep
null
I chose it for writing a modular microsimulation system five years ago. I'd had some experience with it before and felt that the combination of a relatively clean syntax, good native performance and great metaprogramming capabilities would be an advantage. I still maintain that the project wouldn't have gotten as far as it has had I used any other language I know of. That said, the first thing on my list for next year is to rewrite it in C#. Between the compiler, linker and runtime bugs and tool issues over the last five years, I've just had enough. Gotta say, I'm gonna miss compile time code generation... *sigh*
null
0
1316069187
False
0
c2k0fsw
t3_kaxjq
null
t1_c2k0fsw
t1_c2itwzg
null
1427602556
2
t5_2fwo
null
null
null
True
Iggyhopper
null
I'm not familiar with threads. What would be a better solution?
null
0
1316069222
True
0
c2k0fvl
t3_kfiuk
null
t1_c2k0fvl
t1_c2jxb7j
null
1427602556
1
t5_2fwo
null
null
null
True
howardRoark36
null
> References to objects are still passed by value "passing by reference" has a specific technical meaning, as you noted. i just wanted to make it clear that most objects refer to the object passed; not, for example, a deep copy. and that the proposed workaround is rarely (if ever) needed - including by the example given i was being lazy. you've cured that
null
0
1316069256
False
0
c2k0fyp
t3_kg7nl
null
t1_c2k0fyp
t1_c2k0bu8
null
1427602557
2
t5_2fwo
null
null
null
True
elmuerte
null
C and C++ are different languages. Just because C++ builds upon C doesn't mean that C should be part of C++ or vice versa. Because they look so much alike ohloh's tools sometimes cannot distinguish between C and C++. But anyway, it's just lies, damned lies, and statistics. It talks about commits. Maybe Java developers need more commits to do things right. Or maybe C developers don't make small commits. etc. So, this statistic means everything and nothing. You could also look at the monthly lines of code. There you see that java is quite stable, and C and C++ are on a decline. Maybe this is because software written in C or C++ is more mature and needs less changing. Or maybe not. Lies, damned lies, and statistics.
null
0
1316069379
False
0
c2k0g9t
t3_kftz8
null
t1_c2k0g9t
t1_c2jxf33
null
1427602562
1
t5_2fwo
null
null
null
True
Iggyhopper
null
But, but... someone can see my code and steal it! Nooooo!
null
0
1316069430
False
0
c2k0gen
t3_kg2sg
null
t1_c2k0gen
t1_c2jz4ax
null
1427602563
1
t5_2fwo
null
null
null
True
Excalibor
null
It's interesting, a new way of watching things from a C++ perspective. Things I find less interesting are: let as final? let is used to introduce lexicals in most languages, including those he explicitly mentions (like Lisp, Ocaml, ...), this is a really ugly false friend for any other programmer... "As Python is to Perl"? What does this mean? Tart is to enforce semantic blanks? Or just a unique way to make something? This sounds weird to every Perl programmer, cause Python is there and we say 'hello' and keep doing our job. C++ won't do the same. Finally, even Perl which the author seems to dislike (his option, of course) has a perfectly well defined and useful 'undef' value. Unless 'null' is yet another false friend (and represents a well defined value in a well defined type) this is a huge design flaw. Countless bugs will come just from this, and thousands of innecessary code will have to be written to guard this (imo) design error. Otherwise, and despite his Perl dislike (so Moose is not cool?), the language seems to be interesting for systems programming, and using llvm is definitely going in the right direction... Good luck on this!
null
0
1316069696
False
0
c2k0h3u
t3_kfvm7
null
t1_c2k0h3u
t3_kfvm7
null
1427602572
3
t5_2fwo
null
null
null
True
munificent
null
Yeah, but those functions aren't actually *closing* over anything. Why not [just do this](http://www.reddit.com/r/programming/comments/kfuqy/design_patterns_the_state_pattern_in_c/c2k05ch)?
null
0
1316069841
False
0
c2k0hhc
t3_kfuqy
null
t1_c2k0hhc
t1_c2k082m
null
1427602576
2
t5_2fwo
null
null
null
True
[deleted]
null
Interesting to think of it as a scripting language. Cheers :)
null
0
1316069906
False
0
c2k0hms
t3_kaxjq
null
t1_c2k0hms
t1_c2jx6l5
null
1427602579
2
t5_2fwo
null
null
null
True
ehird
null
Probably because it's a bit of a pain to get the types right so that you have to assign every field in a constructor -- the object has to "exist" but not be passable to any methods expecting anything of its type, because the fields aren't assigned yet. Of course, that doesn't make it a good idea.
null
0
1316069991
False
0
c2k0hu1
t3_kfvm7
null
t1_c2k0hu1
t1_c2k0ep6
null
1427602581
2
t5_2fwo
null
null
null
True
[deleted]
null
You are, if you want them to have the right values.
null
0
1316070131
False
0
c2k0i6j
t3_kfvm7
null
t1_c2k0i6j
t1_c2k0esi
null
1427602586
3
t5_2fwo
null
null
null
True
kenshou22
null
Ohh! I get it now /facepalm. Truthfully I've had a lot of difficulty in learning design patterns but I'll revise the blog post tonight to make sure that I'm actually manipulating *states* and not just buried function implementations. Thank you for posting this, it really helped!
null
0
1316070205
False
0
c2k0icu
t3_kfuqy
null
t1_c2k0icu
t1_c2jzjuy
null
1427602588
3
t5_2fwo
null
null
null
True
Iggyhopper
null
What about a class wrapper? Do you need the bloat of a StringBuilder?
null
0
1316070236
False
0
c2k0ifl
t3_kg7nl
null
t1_c2k0ifl
t1_c2k04x1
null
1427602589
1
t5_2fwo
null
null
null
True
alexs
null
The keys change but I don't think there's any feedback from the plaintext into the keystream that's used for the values that are XORed to produce the ciphertext.
null
0
1316070443
False
0
c2k0ixu
t3_kfby2
null
t1_c2k0ixu
t1_c2jywda
null
1427602596
1
t5_2fwo
null
null
null
True
x-skeww
null
>Notch isn't a great programmer, he isn't even a good programmer. You are full of shit. Seriously.
null
0
1316070459
False
0
c2k0izb
t3_kfiuk
null
t1_c2k0izb
t1_c2jurq3
null
1427602597
-2
t5_2fwo
null
null
null
True
howardRoark36
null
i disagree that StringBuilder is bloated (StringBuffer is). of course wrappers work
null
0
1316070508
True
0
c2k0j3q
t3_kg7nl
null
t1_c2k0j3q
t1_c2k0ifl
null
1427602598
1
t5_2fwo
null
null
null
True
zeroRepent
null
Its looks really awesome, can't wait to test everything out!
null
0
1316070666
False
0
c2k0jhi
t3_kg44k
null
t1_c2k0jhi
t3_kg44k
null
1427602602
1
t5_2fwo
null
null
null
True
grauenwolf
null
Unless the the default happens to be correct. Or the field never happens to be used in that scenario. Or the class is designed to detect unitialized values and lazily populate them. At least try to make an argument that isn't completely nonsensical.
null
0
1316070760
False
0
c2k0jp0
t3_kfvm7
null
t1_c2k0jp0
t1_c2k0i6j
null
1427602607
2
t5_2fwo
null
null
null
True
pr1ntscreen
null
Just change your network settings from NAT to bridged. That way you get a "real" ip from your router/isp. Then activate remote desktop sessions in system properties (remote tab). Then just run mstsc.exe and connect to the IP given to your virtual machine. Oh and don't say you're sorry for trying to learn new things :)
null
0
1316070787
False
0
c2k0jrd
t3_kewkd
null
t1_c2k0jrd
t1_c2jzl2w
null
1427602608
2
t5_2fwo
null
null
null
True
kenshou22
null
Wow, I had no idea that *this* was how it works. I've got a lot to learn still. Thank you for your feedback! I'll be revising the post later today.
null
0
1316070811
False
0
c2k0jsw
t3_kfuqy
null
t1_c2k0jsw
t1_c2k05ch
null
1427602608
1
t5_2fwo
null
null
null
True
grauenwolf
null
Haskell has null pointers, it just happens to express them via the Option monad. As for no null pointer expections, is that really true? Or is it only kinda-sorta true like it is with F#? Or in other words, does the compiler really prevent you from trying to read an empty Option monad in all cases?
null
0
1316070910
False
0
c2k0k0l
t3_kfvm7
null
t1_c2k0k0l
t1_c2k0fro
null
1427602616
-4
t5_2fwo
null
null
null
True
bonzinip
null
You can do speculative type inference, and always fall back to the slower code when it fails.
null
0
1316071050
False
0
c2k0kb6
t3_kf4hn
null
t1_c2k0kb6
t1_c2jv3y0
null
1427602615
2
t5_2fwo
null
null
null
True
[deleted]
null
Ehird explained the case of "sum" (ie. it's rare). Your other example could be written as: string x = y ? "sam" : "bob"; The `?:` syntax for if is pretty ugly, but luckily this is a new language that does not have to inherit that ;-)
null
0
1316071072
False
0
c2k0kch
t3_kfvm7
null
t1_c2k0kch
t1_c2jy18p
null
1427602616
1
t5_2fwo
null
null
null
True
bonzinip
null
That's exactly the point.
null
0
1316071151
False
0
c2k0kjp
t3_kf4hn
null
t1_c2k0kjp
t1_c2jvoq7
null
1427602625
1
t5_2fwo
null
null
null
True
munificent
null
To be clear, what you describe is closer to the GoF state pattern than what I have here. (Actually, what you describe is closer to the strategy pattern.) My point is just that if all you need to do is switch between some behavior, and that behavior doesn't need to store any data, you can use a bare function pointer.
null
0
1316071190
False
0
c2k0kn4
t3_kfuqy
null
t1_c2k0kn4
t1_c2k0jsw
null
1427602618
2
t5_2fwo
null
null
null
True
secret_town
null
Meh - that was a /long/ time ago, I doubt that if any code needed changing, that it hasn't been.
null
0
1316071210
False
0
c2k0kot
t3_kf43e
null
t1_c2k0kot
t1_c2juuz8
null
1427602620
1
t5_2fwo
null
null
null
True
grauenwolf
null
No, but does it necessarily make it a bad idea either? I've used both C# and Visual Basic for a long time. I have never once been in a situation where I wished for C#'s restriction on initializing simple local types in VB. VB also implicitly returns the default value (0/null) if you don't use an explicit return statement. This makes VB code less verbose than C# code. If terness is a goal for language design, shouldn't we be considering these options?
null
0
1316071229
False
0
c2k0kqq
t3_kfvm7
null
t1_c2k0kqq
t1_c2k0hu1
null
1427602621
1
t5_2fwo
null
null
null
True
[deleted]
null
Here's one way to ensure all fields are initialized: class Vector(public double x, public double y) { public double magnitude = sqrt(x * x + y * y); } Vector v = new Vector(5, 7); Let the class body be the constructor, and require that all variables are initialized on declaration. Scala does this AFAIR.
null
0
1316071280
False
0
c2k0kuu
t3_kfvm7
null
t1_c2k0kuu
t1_c2k0hu1
null
1427602622
3
t5_2fwo
null
null
null
True
secret_town
null
... and double leading underscores. /from one of Herb Sutter's books.
null
0
1316071311
False
0
c2k0kxf
t3_kf43e
null
t1_c2k0kxf
t1_c2jxffs
null
1427602623
1
t5_2fwo
null
null
null
True
kibo
null
Also, me. Called many times, but it's all in code.
null
0
1316071339
False
0
c2k0kzr
t3_kfms2
null
t1_c2k0kzr
t3_kfms2
null
1427602624
4
t5_2fwo
null
null
null
True
lanzkron
null
From the PDF: > N2911 explains that the acronym **SCARY** “describes assignments and initializations that are **S**eemingly erroneous (**C**onstrained by conflicting generic parameters), but **A**ctually work with the **R**ight implementation (unconstrained b**Y** the conflict due to minimized dependencies).”
null
0
1316071362
True
0
c2k0l1v
t3_kgaop
null
t1_c2k0l1v
t3_kgaop
null
1427602625
18
t5_2fwo
null
null
null
True
grauenwolf
null
How does it handle overloading the constructor? What happens if you have a DTO with a couple dozen fields?
null
0
1316071366
False
0
c2k0l24
t3_kfvm7
null
t1_c2k0l24
t1_c2k0kuu
null
1427602625
3
t5_2fwo
null
null
null
True
artsrc
null
One of the great wins for Java developers using Spring is that it help reduce OO programming. OO is to hard for many developers, so as long as the problem is simple, preventing it is a win.
null
0
1316071402
False
0
c2k0l54
t3_kf2xi
null
t1_c2k0l54
t3_kf2xi
null
1427602626
1
t5_2fwo
null
null
null
True
ukaszg
null
being good programmer, and writing great game are two entirely different things - one does not interfere with the other.
null
0
1316071527
False
0
c2k0lfv
t3_kfiuk
null
t1_c2k0lfv
t1_c2k0izb
null
1427602630
6
t5_2fwo
null
null
null
True
ukaszg
null
single thread event/select based?
null
0
1316071562
False
0
c2k0lii
t3_kfiuk
null
t1_c2k0lii
t1_c2k0fvl
null
1427602631
7
t5_2fwo
null
null
null
True
[deleted]
null
All of those are valid use cases, *but*: - The default value is rarely correct - so rare that it's not much of a bother to explicitly initialize it. - When you detect uninitialized values, you usually do so via a getter method or similar, and thus there's no need for the field to have the "pretty" type, just use the corresponding `Option` type. Example: public Option<Int> value = Option.none(); public Int getValue() { if(value.isNone()) value = generateValue(); return value.get(); } Vs. public Int value; public Int getValue() { if(value == null) value = generateValue(); return value; } It's a little bit shorter, but definitely not worth breaking the type system to allow null for any reference.
null
0
1316071647
False
0
c2k0lpz
t3_kfvm7
null
t1_c2k0lpz
t1_c2k0jp0
null
1427602633
5
t5_2fwo
null
null
null
True
MatrixFrog
null
I don't know F# at all. In Haskell, a String is really a String. Not "either null or a String" but an actual String. In our example above, you want x to always be either "sam" or "bob" so you would use String, not Maybe String. And you would know that x could never be null, not because you looked at the code really carefully, but because its type is String, not "either String or null". You would only use a Maybe String in a case where you intentionally want to say that you either have a String or you don't (for example, when retrieving something from a Map). If you have a Maybe String and try to pull the String out of it with fromJust, then you'll get an error if your Maybe String was actually Nothing. But that's your own fault, really. Whatever function it was that gave you the Maybe String was *telling* you that it might be a Nothing, but you didn't listen. The compiler can warn you too (though GHC doesn't by default, and I think it should). Maybe is not "magic" by the way -- it's not built into the language. It's just defined as: data Maybe a = Just a | Nothing which means just what you think it means: A Maybe of some type is either "Just <some object of that type>" or "Nothing" On the other hand, if a Java function has "String" as its return type, you don't know whether you can count on it to always return a String, or if it's actually supposed to return null in some cases. Or it might return null in some cases because of a mistake way further down in the stack. I'm rambling, but you know about [/r/haskell](http://www.reddit.com/r/haskell) right?
null
0
1316071847
False
0
c2k0m59
t3_kfvm7
null
t1_c2k0m59
t1_c2k0k0l
null
1427602640
3
t5_2fwo
null
null
null
True
[deleted]
null
[deleted]
null
0
1316071873
False
0
c2k0m7i
t3_kfirl
null
t1_c2k0m7i
t1_c2jy52e
null
1427602641
3
t5_2fwo
null
null
null
True
grauenwolf
null
It is COM, but with enhancements from .NET such as constructors. And there is a new language, C++ Component Extensions, which make working with it much easier. Here is my report on the topic: http://www.infoq.com/news/2011/09/C-Component-Extensions
null
0
1316071874
False
0
c2k0m7l
t3_kewaq
null
t1_c2k0m7l
t1_c2jqbhr
null
1427602641
2
t5_2fwo
null
null
null
True
blergh-
null
For a lot of purposes, a web app is just not fast enough, especially on a mobile device. It is also much more difficult to code. The idea that you can have a single thing for Android, iOS and Windows Phone is a pipe dream. Sure, if you work hard enough, your app will work on all of these, but it'll look and feel native on none of them. The platforms are not the same.
null
0
1316071901
False
0
c2k0m9z
t3_kg2sg
null
t1_c2k0m9z
t1_c2jz4ax
null
1427602642
2
t5_2fwo
null
null
null
True
secret_town
null
Well there's a down-tech reason too; in 2 places I've been it's because they already had hand-built bespoke collections and either didn't want to bother or, didn't want to muddy up the code with 2 kinds of collection. To be fair the 2nd company started coming around. I have to say though that you'll still see ads that say, "C++, STL, .." like it's not something you can take for granted if you mention C++, some 11-12 years later.
null
0
1316071961
False
0
c2k0meb
t3_kf43e
null
t1_c2k0meb
t1_c2juwpf
null
1427602643
1
t5_2fwo
null
null
null
True
glibc
null
At the counter for revolution.
null
0
1316071979
False
0
c2k0mft
t3_ke4a9
null
t1_c2k0mft
t1_c2jk5t6
null
1427602645
1
t5_2fwo
null
null
null
True
qiwi
null
At a glance, the only feature not in D I could find is runtime multiple dispatch: http://docs.tart.googlecode.com/hg/intro/generics.html -- otherwise it seems overlap extremely with D -- they're both a saner C++ inspired by the modern dynamically typed languages.
null
0
1316071981
False
0
c2k0mg1
t3_kfvm7
null
t1_c2k0mg1
t1_c2jz7zg
null
1427602645
5
t5_2fwo
null
null
null
True
x-skeww
null
I never played Minecraft. I only tested some of the very first builds. I think he is a pretty damn good programmer based on the things he wrote on JGO (some forum) and based on his 4k entries (I "know" him for over 8 years). He is a very skilled, knowledgeable, and helpful person.
null
0
1316071983
False
0
c2k0mgc
t3_kfiuk
null
t1_c2k0mgc
t1_c2k0lfv
null
1427602645
1
t5_2fwo
null
null
null
True
Otis_Inf
null
'null' isn't a value, it means the variable hasn't been set to a value. Seeing 'null' as a value limits yourself to the situation that the variable always has a value, but there can be situations that a variable doesn't have a value, e.g. when it's optional.
null
0
1316072039
False
0
c2k0mk6
t3_kfvm7
null
t1_c2k0mk6
t1_c2jxl4n
null
1427602645
0
t5_2fwo
null
null
null
True
grauenwolf
null
Yep. Here is some info on exporting WinRT components from .NET. http://www.infoq.com/news/2011/09/DotNet-On-WinRT
null
0
1316072106
False
0
c2k0mpe
t3_kewaq
null
t1_c2k0mpe
t1_c2js58w
null
1427602647
1
t5_2fwo
null
null
null
True
Hyperian
null
alright let me try to explain, probably wrong. So this thing sits between your ex. PS3 and your HDTV. NeTV keeps track of the stream and when it sees the part of the screen that needs the overlay, it sends encrypted bits instead, and when that gets to the HDTV, the HDTV decrypts it and the overlay shows up. pretty neat. (if i'm reading it right)
null
0
1316072121
False
0
c2k0mqs
t3_kfby2
null
t1_c2k0mqs
t1_c2jx73v
null
1427602647
1
t5_2fwo
null
null
null
True
MatrixFrog
null
Terseness should probably be one goal, but only to the extent that it encourages readability. Look up APL for a language that is unquestionably terse, but (IMHO) entirely unreadable. Then again, maybe I need to spend more time with it. But in any case, there is definitely such a thing as being *too* terse.
null
0
1316072125
False
0
c2k0mr7
t3_kfvm7
null
t1_c2k0mr7
t1_c2k0kqq
null
1427602647
1
t5_2fwo
null
null
null
True
grauenwolf
null
That is not true. The entire UI stack in WinRT is 100% native code, .NET isn't involved at all.
null
0
1316072177
False
0
c2k0mvp
t3_kewaq
null
t1_c2k0mvp
t1_c2jt0sf
null
1427602658
4
t5_2fwo
null
null
null
True
[deleted]
null
Yes, complicating the type system is probably not the best way to solve this. In this case, you may use a type that can indicate "not initialized yet", such as that `Option` type: struct node { Option<node*> next; node() : next(None) {} node(node* n) : next(Some(n)) {} }; node* a = new node(); node* b = new node(a); a->next = Some(b); Slightly longer, but this is an edge case anyway. The point is that you explicitly mark the cases where this kind of error is possible, and deal with it locally instead of having to deal with potential uninitialized/null values everywhere in your program.
null
0
1316072387
False
0
c2k0ndq
t3_kfvm7
null
t1_c2k0ndq
t1_c2jz3ti
null
1427602665
5
t5_2fwo
null
null
null
True
syncsynchalt
null
I knew he grepped the usenet feed for his nick, maybe he greps reddit too.
null
0
1316072438
False
0
c2k0nht
t3_kfms2
null
t1_c2k0nht
t1_c2jwros
null
1428194047
1
t5_2fwo
null
null
null
True
FractalP
null
Wow, they *really* forced that one.
null
0
1316072455
False
0
c2k0niw
t3_kgaop
null
t1_c2k0niw
t1_c2k0l1v
null
1427602657
29
t5_2fwo
null
null
null
True
thepowerofone
null
Even so, you don't want to teach noobs bad habits, which Microsoft is guilty of many times over.
null
0
1316072498
False
0
c2k0nlr
t3_kewaq
null
t1_c2k0nlr
t1_c2jttup
null
1427602660
1
t5_2fwo
null
null
null
True
grauenwolf
null
Standard F# looks something like this: let Exists(opt : string option) = match opt with | Some _ -> true | None -> false But nothing prevents you from writing this: let x = None let y = x.Value //NPE here
null
0
1316072549
False
0
c2k0np7
t3_kfvm7
null
t1_c2k0np7
t1_c2k0m59
null
1427602661
1
t5_2fwo
null
null
null
True
[deleted]
null
It's not always possible to make a sentinel value; the constructor of the type in question may not be visible to you, or it may have undesirable side effects. Also, what grauenwolf said.
null
0
1316072557
False
0
c2k0npx
t3_kfvm7
null
t1_c2k0npx
t1_c2jzvds
null
1427602661
4
t5_2fwo
null
null
null
True
[deleted]
null
null is a value, and the meaning you ascribe to it outside of the language semantics is a matter of taste.
null
0
1316072743
True
0
c2k0o3f
t3_kfvm7
null
t1_c2k0o3f
t1_c2k0mk6
null
1427602667
3
t5_2fwo
null
null
null
True
truthHIPS
null
Fair enough. Personally, after working on web apps and fighting with so many different rendering engines, versions, differences on each of those per platform and so on I no longer find the idea elegant. Personally, my strategy is to make a minimal web app interface that has a badge somewhere to a proper native app that will make the experience nicer. The reason I don't like web apps in general is because you're putting all your layers together. Model, View, Presenter, all there in the same place. This also leads to "lowest common denominator" type interfaces. But we'll see where it ends up. Predicting the future is a good way to be wrong a lot. :)
null
0
1316072808
False
0
c2k0o8r
t3_kc9ai
null
t1_c2k0o8r
t1_c2jsis8
null
1428194046
2
t5_2fwo
null
null
null
True
MatrixFrog
null
Nothing prevents you from doing that in Haskell either, but you can *only make that mistake when you're dealing with Maybes* which is the point I was trying to emphasize. It's impossible to do something like that with raw, un-maybed values. And you can only make that mistake if you call an unsafe function like `fromJust` (many people think it should have been called `unsafeFromJust`) or when you do an incomplete pattern match. tl;dr it sounds like F# and Haskell are kind of the same in this respect. It's possible to shoot yourself in the foot with either of them, but it's much easier to avoid problems than it is in Java or C++.
null
0
1316072898
False
0
c2k0og4
t3_kfvm7
null
t1_c2k0og4
t1_c2k0np7
null
1427602674
3
t5_2fwo
null
null
null