|
BattleMaster posted:i've never programmed anything serious in a language with exceptions
|
# ? Mar 25, 2016 14:36 |
|
|
# ? May 25, 2024 13:54 |
|
lol mistakes happen, why even try am i rite
|
# ? Mar 25, 2016 14:38 |
|
in a more ideal world move semantics + return value optimization + references as output parameters should mean a lot fewer cases of returning pointers from functions
|
# ? Mar 25, 2016 14:55 |
|
if it was easy to tell whether a function will return null or not, the ide would do it for you and warn you if you forgot to check for some reason, even ides with sophisticated static analysis features and advanced null inference turn out to rely on humans annotating functions to tell whether they can return null or not
|
# ? Mar 25, 2016 15:03 |
|
BattleMaster posted:well if the function doesn't ever return null then the problem being discussed wouldn't happen so there's no reason to check it in that case Kotlin has this. If the type isnt marked as nullable, the compiler prevents null references from being returned. If it IS a nullable type, it wont compile if you try to use it before checking if its null.
|
# ? Mar 25, 2016 15:09 |
|
Java code:
i mean i guess i have to after it bites me, but what is the level of due diligence here when implementing a TurdConsumer for the first time?
|
# ? Mar 25, 2016 15:10 |
|
Wheany posted:
intellij will yell at you that a implementor of the interface doesnt also have the @NotNull annotation. the IDE will yell at you. findbugs will also. the compiler will not.
|
# ? Mar 25, 2016 15:13 |
|
i feel like this is more a philosophical argument over whether you can trust docs. like... are docs really real, maaaan?
|
# ? Mar 25, 2016 15:13 |
|
ok i have a bug in my dev build that is not in the test build even if i push it into test and i don't have the slightest loving clue what the gently caress is going on and aggggggggggggg
|
# ? Mar 25, 2016 15:16 |
|
CRIP EATIN BREAD posted:intellij will yell at you that a implementor of the interface doesnt also have the @NotNull annotation. i know, but i was kind of implying that the non-compliant butt comes from some external source, even though i just implemented and instantiated one myself in the example. i really didn't feel like creating a di framework just for another yospos turd joke.
|
# ? Mar 25, 2016 15:28 |
|
^^^ If you defensively check for null anyway, Eclipse will complain about unnecessary code. CRIP EATIN BREAD posted:intellij will yell at you that a implementor of the interface doesnt also have the @NotNull annotation. I'll never understand why Oracle went, "Yes, these annotations are a good idea. We'll write up a spec for them." then did not add them to the standard library or tools.
|
# ? Mar 25, 2016 15:31 |
|
kotlin sorta owns since you ge tthings likecode:
code:
code:
|
# ? Mar 25, 2016 15:48 |
|
BattleMaster posted:i feel like this is more a philosophical argument over whether you can trust docs. like... are docs really real, maaaan? its really got nothing to do with that. the fundamental issue is that if something can go wrong, given enough time it will. the problem boils down to the fact that you actually want to return one of two values: a valid reference, or a null reference, but the language doesn't encode this information. a similar thing happens in oldschool c functions that return an int but where say "-1" means an error of some sort. they really wanted two types of return values: an integer, or an error code. in both cases the type system doesn't distinguish between the two return types and this can produce difficult to track bugs because these "exceptional" cases don't necessarily come up very often. compare this with languages that have option types and tagged unions where the language forces you to check the result in order to do anything with it.
|
# ? Mar 25, 2016 15:50 |
|
oh yeah and you get cool type cast checkscode:
|
# ? Mar 25, 2016 15:51 |
|
CPColin posted:^^^ If you defensively check for null anyway, Eclipse will complain about unnecessary code. so does idea which you can then suppress with //noinspection ConstantConditions
|
# ? Mar 25, 2016 15:53 |
|
CRIP EATIN BREAD posted:its useful in case you have something like this: dont do that
|
# ? Mar 25, 2016 15:53 |
|
c#s ? operator is nice
|
# ? Mar 25, 2016 16:08 |
|
type systems are really good
|
# ? Mar 25, 2016 16:16 |
|
Awia posted:never return anything and just make everything happen through side effects oh hey i think you work at my company, whats up
|
# ? Mar 25, 2016 16:24 |
|
BattleMaster posted:i feel like this is more a philosophical argument over whether you can trust docs. like... are docs really real, maaaan? docs are not real. they aren't required to match the code or even be self-consistent. I'd rather have a test suite
|
# ? Mar 25, 2016 16:24 |
|
Wheany posted:are you saying that your code has never had a nullpointerexception? you treat the solution as fixing whatever emitted the null as opposed to checking for null and letting that infest every bit of your code base.
|
# ? Mar 25, 2016 16:25 |
|
Bloody posted:type systems are really good i agree with this poster.
|
# ? Mar 25, 2016 16:26 |
|
in mumps the empty string "" is null. your basically hosed if you need to return an empty string that doesnt mean null because its all by convention and your caller will almost always just assume "" means something hosed up. at least 0 as null has historical reasoning behind it. outside of some exceptional architectures the page starting at 0x0 is off-limits typically so if you dereference a pointer with a value of 0 it's likely you've messed up. that this has downstream effects for situations where you have null values that aren't pointers or need to be handled outside the context of dereferencing the pointer is frustrating but at least understandable. in mumps, "",an uninitialized variable, and global subscript with no value are all equal: code:
The MUMPSorceress fucked around with this message at 16:31 on Mar 25, 2016 |
# ? Mar 25, 2016 16:27 |
|
fart simpson posted:oh hey i think you work at my company, whats up lol if you ever error check or ensure that what you said would happen does happen
|
# ? Mar 25, 2016 16:29 |
|
hackbunny posted:docs are not real. they aren't required to match the code or even be self-consistent. I'd rather have a test suite the kind of code that has bad or no docs is unlikely to have great tests
|
# ? Mar 25, 2016 16:30 |
|
i sawcode:
id never seen it before
|
# ? Mar 25, 2016 16:31 |
|
0x0000 is cpu register r0 or reserved or the head of data memory or the head of flash memory (this is all on one architecture)
|
# ? Mar 25, 2016 16:36 |
|
Awia posted:i saw what the gently caress
|
# ? Mar 25, 2016 16:38 |
|
Bloody posted:what the gently caress you can exit the do-block early using break code:
|
# ? Mar 25, 2016 16:40 |
|
well, more properly it was:code:
|
# ? Mar 25, 2016 16:40 |
|
Wheany posted:you can exit the do-block early using break what he said
|
# ? Mar 25, 2016 16:41 |
|
Wheany posted:you can exit the do-block early using break if(!somethingIsFucked) actuallyDoTheThing();
|
# ? Mar 25, 2016 16:43 |
|
thats a pretty common pattern when you dont have goto. then again i really only use goto when writing kernel device drivers.
|
# ? Mar 25, 2016 16:44 |
|
Bloody posted:if(!somethingIsFucked) actuallyDoTheThing(); what if you dont want the thing to happen if it doesn't happen first time?
|
# ? Mar 25, 2016 16:45 |
|
CRIP EATIN BREAD posted:thats a pretty common pattern when you dont have goto. also if you have goto, but have heard the phrase "Go To Statement Considered Harmful" from the year 1968
|
# ? Mar 25, 2016 17:11 |
|
Awia posted:i saw It could also be an expanded macro. In C, if a macro has to do more than one thing at once, it generally goes code:
code:
|
# ? Mar 25, 2016 17:13 |
|
people who write X Considered Harmful blog posts should be shot into space
|
# ? Mar 25, 2016 17:13 |
|
Awia posted:what if you dont want the thing to happen if it doesn't happen first time? what?
|
# ? Mar 25, 2016 17:16 |
|
Bloody posted:what? what if it doesnt' work and you dont want to try again?
|
# ? Mar 25, 2016 17:17 |
|
|
# ? May 25, 2024 13:54 |
|
Wheany posted:also if you have goto, but have heard the phrase "Go To Statement Considered Harmful" from the year 1968 id probably not use a goto just because at least with break you know it goes to the end of the block instead of somewhere else in the file ignoring the fact that ctrl+f exists
|
# ? Mar 25, 2016 17:18 |