|
i assume default of a decimal? is 0?
|
# ? Mar 23, 2016 20:41 |
|
|
# ? May 25, 2024 02:48 |
|
HoboMan posted:i understand the concept of nullables. i still just get a kick out the idea that you add a question mark to a type that may or may not have a value. also i don't check for hasvalue and and just cast it into a proper decimal immediately, i'm sure the behavior of this is exactly what i want it to be (lol). do i really need to put in an if to check hasvalue and set it to 0 if it don't? because i don't want to. edit: just saw that you said like half of the entries in the db have a null yeah you need to be checking that poo poo in some way son 30 TO 50 FERAL HOG fucked around with this message at 20:53 on Mar 23, 2016 |
# ? Mar 23, 2016 20:43 |
|
unrelated, but gently caress css
|
# ? Mar 23, 2016 20:46 |
|
http://www.drinchev.com/blog/alert-npm-modules-hijacked/ so someone has been going through all the unpublished npm modules and claiming them for himself. npm's managers say that the guy is perfectly friendly and won't be using the hijacked modules for illicit code tho https://twitter.com/seldo/status/712673227630313472 i'm not really sure what the npm managers think they're loving doing but this is really retarded
|
# ? Mar 23, 2016 20:56 |
|
If npm goes away then so does bower. gently caress bower
|
# ? Mar 23, 2016 20:59 |
|
|
# ? Mar 23, 2016 21:03 |
|
Condiv posted:i'm not really sure what the npm managers think they're loving doing but this is really retarded welcome to the future of programming
|
# ? Mar 23, 2016 21:04 |
|
https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d#.co2maojvr lol just lol
|
# ? Mar 23, 2016 21:06 |
|
HoboMan posted:sounds reasonable but i'm a idiot who is not qualified for this job and asking to get things purchased puts me under scrutiny so then it needs to be nullable and you need to check for values.
|
# ? Mar 23, 2016 21:19 |
|
i thought i was done, but then i opened the page in chrome instead of ie and gently caress
|
# ? Mar 23, 2016 21:23 |
|
triple sulk posted:https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d#.co2maojvr i wish i could say this was the dumbest thing ive read on medium
|
# ? Mar 23, 2016 21:31 |
|
Shaggar posted:so then it needs to be nullable and you need to check for values. So do you know the under-the-hood reason why this works? Seriously curious. code:
|
# ? Mar 23, 2016 21:35 |
|
CRIP EATIN BREAD posted:i wish i could say this was the dumbest thing ive read on 👊🍆
|
# ? Mar 23, 2016 21:37 |
|
Lone_Strider posted:Also even though Sum<int?>() returns an int?, if every item in the array is null, sum is not null, and the value is 0. this is the behavior i was getting and why i thought it was fine to just cast it after
|
# ? Mar 23, 2016 21:37 |
|
Lone_Strider posted:So do you know the under-the-hood reason why this works? Seriously curious. interestingly this is counter to the expected behavior of normal operators. According to this: https://msdn.microsoft.com/en-us/library/2cf62fcy.aspx#Anchor_4 any operation that involves a null nullable should return null. but in the source code for sum you can see there are explicit handlings for nullable types so that null values are ignored.
|
# ? Mar 23, 2016 21:51 |
|
ok that's weird and counterintuitive behavior but I assume it's because they wanted empty sequences to sum to zero
|
# ? Mar 23, 2016 21:53 |
|
if you look at the documentation for Sum<decimal?> it says in the notes it ignores nulls.
|
# ? Mar 23, 2016 21:54 |
|
quote:The result does not included values that are null.
|
# ? Mar 23, 2016 21:55 |
|
hah! guess i'm not so terrible after all! cya l8ter shitlords i'm off to the good programmers thread
|
# ? Mar 23, 2016 21:56 |
|
God, it would suck to be a node developer right now (or really anytime) *opens Visual Studio*
|
# ? Mar 23, 2016 22:03 |
|
visual studio is pretty good but the auto complete sucks and resharper's autocomplete sucks too but is also slow. why cant anyone just replicated eclipse autocomplete??
|
# ? Mar 23, 2016 22:05 |
|
triple sulk posted:https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d#.co2maojvr pro-click
|
# ? Mar 23, 2016 22:17 |
|
triple sulk posted:https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d#.co2maojvr threatening to sic lawyers on someone: a "polite" request
|
# ? Mar 23, 2016 22:19 |
|
GrumpyDoctor posted:ok that's weird and counterintuitive behavior but I assume it's because they wanted empty sequences to sum to zero it makes sense: you start with zero and add all the non-nulls to it. the only question is why does it return a nullable?
|
# ? Mar 23, 2016 22:19 |
|
HappyHippo posted:it makes sense: you start with zero and add all the non-nulls to it. the only question is why does it return a nullable? empty list?
|
# ? Mar 23, 2016 22:20 |
|
Condiv posted:threatening to sic lawyers on someone: a "polite" request ya everyone involved in this was an idiot about it
|
# ? Mar 23, 2016 22:24 |
|
gonadic io posted:empty list?
|
# ? Mar 23, 2016 22:25 |
|
Finster Dexter posted:God, it would suck to be a node developer right now (or really anytime) I work at a node heavy place and nobody here even noticed this happened.
|
# ? Mar 23, 2016 22:33 |
|
GrumpyDoctor posted:ok that's weird and counterintuitive behavior but I assume it's because they wanted empty sequences to sum to zero it's only counterintuitive because just sum does that
|
# ? Mar 23, 2016 22:35 |
|
HappyHippo posted:it makes sense: you start with zero and add all the non-nulls to it. the only question is why does it return a nullable? it kind of makes sense, but its counter to the functionality of the + operator so the method signature having a nullable return makes sense in a world where sum works like +, but in a world where sum works differently then theres no reason for it to be a nullable return. its inconsistent either way and since the current sum implementation would have to change in a breaking way to be consistent with the operator, it would make more sense to change the return to a non-nullable
|
# ? Mar 23, 2016 22:40 |
|
triple sulk posted:https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d#.co2maojvr reminder about what kik messanger is: https://goo.gl/RHSVZZ
|
# ? Mar 23, 2016 22:42 |
|
GrumpyDoctor posted:ok that's weird and counterintuitive behavior but I assume it's because they wanted empty sequences to sum to zero Yeah even knowing this, I think I'd still rather see col.Where(n => n.HasValue).Sum(n => n.Value) than col.Sum() when it came to nullable types thx shaggar edit: or col.Sum(n => n.GetValueOrDefault(0)), I'll have to keep that in mind
|
# ? Mar 23, 2016 23:15 |
|
it's because otherwise it would then return null if any value in the list was null and that's loving useless e: but yeah it should just return a non-nullable type HoboMan fucked around with this message at 23:44 on Mar 23, 2016 |
# ? Mar 23, 2016 23:41 |
|
akadajet posted:reminder about what kik messanger is: either you messed up the link or this is the first completely unsolicited LMGTFY ive ever seen
|
# ? Mar 24, 2016 00:14 |
|
Flat Daddy posted:either you messed up the link or this is the first completely unsolicited LMGTFY ive ever seen it's a link to news articles about kik yes. mostly pedophiles using it to target children.
|
# ? Mar 24, 2016 00:47 |
|
akadajet posted:it's a link to news articles about kik yes. mostly pedophiles using it to target children. of course it's used for that. it was made by people who willingly use nodejs and probably talk about ephebobobilia
|
# ? Mar 24, 2016 02:13 |
|
HoboMan posted:it's because otherwise it would then return null if any value in the list was null and that's loving useless But that's kind of the behavior I expect from my option types... If you take null as analogous to ⊥, i.e. "I don't know what this value is", then you can't really say that you know the value of the sum when you don't know all the individual values. If you knew that the value was 0, it would be 0 instead of null.
|
# ? Mar 24, 2016 02:47 |
|
fritz posted:i gotta say i was hoping that the thing exported was something like "abcdefghijklmnoqrstuvwxyz" or "abcdefghjiklmnopqrstuvwxyz" maybe that's what they fixed in 1.0.1 Progressive JPEG fucked around with this message at 03:21 on Mar 24, 2016 |
# ? Mar 24, 2016 03:12 |
|
in c#, 0 + null is null. it's weird for sum to not just be addition reduced over the sequence. I can see why they did it, but it's weird.
|
# ? Mar 24, 2016 03:13 |
|
|
# ? May 25, 2024 02:48 |
|
GrumpyDoctor posted:in c#, 0 + null is null. it's weird for sum to not just be addition reduced over the sequence. I can see why they did it, but it's weird. how does 0 + null = null make any sense at all? null + null rightfully doesn't compile, so 0 cannot be being cast to null fake edit: i just tried 0 + null in ideone and it comes back as 0, which is the sane result (though lovely cause it's implicitly casting null to int)
|
# ? Mar 24, 2016 03:25 |