|
Soricidus posted:if you need a tail-recursive map in ocaml, get extlib, which includes a drop-in tail-recursive replacement with no performance penalty. literally less type safety than java
|
# ? May 27, 2014 15:23 |
|
|
# ? May 25, 2024 15:04 |
|
Kevin Mitnick P.E. posted:literally less type safety than java it's pretty common for libraries to cheat type systems for performance benefits. i mean literally the entire purpose of ST in haskell is to formalise this
|
# ? May 27, 2014 15:28 |
|
ocaml trusts the programmer. its type system is a tool, not a cage. (yes, this may be a reason to prefer java, which has more realistic expectations ...)
|
# ? May 27, 2014 16:09 |
|
Symbolic Butt posted:Raymond Hettinger is a huge proponent of for-else, I was thinking about it and there's this example in his slides: code:
code:
Zombywuf posted:I like for else, it makes perfect sense to me. the prosecution rests, no further questions.
|
# ? May 27, 2014 16:37 |
|
Soricidus posted:ocaml trusts the programmer. its type system is a tool, not a cage. the type cast you're talking about takes place outside the ocaml type system. it can only be done by calling an external C function and claiming that it has the type you need. that's not safe, but neither is any other C FFI that i know of... surely java has an equivalent construct in JNI?
|
# ? May 27, 2014 17:24 |
|
JewKiller 3000 posted:surely java has an equivalent construct in JNI? not that I know of, but I am more familiar with C#. in C#'s FFI, you "marshal" data i.e. copy it onto the managed heap w/ strong type data attached at marshal-time, with the permissible marshal-ings defined by the language authors you definitely don't just point at random unmanaged memory
|
# ? May 27, 2014 18:41 |
|
tef posted:in many cases where you can use break, you can use a function, and return. ignore the weirdos who bang on about 'multiple points of return' as if it is a gospel truth. is this just a joke, or real advice? genuinely curious, as i tend to have multiple points of return and real programmers don't seem to do that
|
# ? May 27, 2014 18:50 |
|
Notorious b.s.d. posted:not that I know of, but I am more familiar with C#. in C#'s FFI, you "marshal" data i.e. copy it onto the managed heap w/ strong type data attached at marshal-time, with the permissible marshal-ings defined by the language authors iirc you can abuse c# into passing pointers around but you really shouldnt at it gets upset easily. like if you wanna pass a managed array into a c function that expects a pointer to an unmanaged array you can do that if you really really want to using fixed(){}
|
# ? May 27, 2014 19:00 |
|
prefect posted:is this just a joke, or real advice? genuinely curious, as i tend to have multiple points of return and real programmers don't seem to do that it depends. just be consistent and don't mix styles in the same chunk of code.
|
# ? May 27, 2014 19:13 |
|
JewKiller 3000 posted:the type cast you're talking about takes place outside the ocaml type system. it can only be done by calling an external C function and claiming that it has the type you need. that's not safe, but neither is any other C FFI that i know of... surely java has an equivalent construct in JNI? the jvm knows about classes. you could maybe alloc an object on the jvm heap and munge it to change its class, serialization and clone kinda do this. it would be really fragile though and also pointless
|
# ? May 27, 2014 20:09 |
|
suffice to say, jni and marshalling are both designed to stop you from doing anything stupid, particularly by accident
|
# ? May 27, 2014 20:13 |
|
it's not really the done thing in java to jump through hoops to preserve immutability. plus if you really care just make sure to expose only an immutable interface to clients
|
# ? May 27, 2014 20:31 |
|
Notorious b.s.d. posted:suffice to say, jni and marshalling are both designed to stop you from doing anything stupid, particularly by accident jni was "designed" to make it as annoying as possible to bridge into the jvm from native code to avoid dealing with subverting the safety guarantees it succeeded wildly, with jni being entirely terrible now there's rumbings of having a proper p/invoke style replacement
|
# ? May 27, 2014 21:26 |
|
tef posted:
|
# ? May 28, 2014 00:23 |
|
hmm yes a well-reasoned point
|
# ? May 28, 2014 02:05 |
|
i still hate for-else, mostly because of the name.
|
# ? May 28, 2014 13:26 |
|
prefect posted:is this just a joke, or real advice? genuinely curious, as i tend to have multiple points of return and real programmers don't seem to do that real programmers also have laborious trace macros at the entry and exit points from every function. multiple points of return make it harder to mentally blot them out as boilerplate, and easier to accidentally omit them
|
# ? May 28, 2014 14:17 |
|
qntm posted:real programmers also have laborious trace macros at the entry and exit points from every function. multiple points of return make it harder to mentally blot them out as boilerplate, and easier to accidentally omit them man if you're gonna do that then go ahead with the AOP
|
# ? May 28, 2014 14:49 |
|
qntm posted:real programmers also have laborious trace macros at the entry and exit points from every function. multiple points of return make it harder to mentally blot them out as boilerplate, and easier to accidentally omit them If you have multiple points of return then your exit traces should have different messages.
|
# ? May 28, 2014 16:27 |
|
i should probably learn to read stack traces and run debuggers instead of just using print statements
|
# ? May 29, 2014 17:28 |
|
prefect posted:i should probably learn to read stack traces and run debuggers instead of just using print statements debuggers are mostly a much, much faster version of your print statements reading stack traces is loving essential, though. how the gently caress have you got this far w/out them
|
# ? May 29, 2014 17:57 |
|
Notorious b.s.d. posted:debuggers are mostly a much, much faster version of your print statements i can actually read them, up to a point. after the first few lines, it turns into white noise for my eyes code:
|
# ? May 29, 2014 18:06 |
|
when reading stack traces, first look to see if the message at the top of the stack makes sense. ex: couldn't read a file. if its something else like a runtime exception (ex: nullpointer) then find the first place in the stack trace that has your code in it and look at that line and find what you didn't check for null.
|
# ? May 29, 2014 18:10 |
|
Shaggar posted:when reading stack traces, first look to see if the message at the top of the stack makes sense. ex: couldn't read a file. if its something else like a runtime exception (ex: nullpointer) then find the first place in the stack trace that has your code in it and look at that line and find what you didn't check for null. yeah, gradle stack traces generally seem to be three or four stack traces piled up in a row. so far, the first and the last ones have been most useful (the last one in this particular case, because i was trying to figure out why a third-party plugin was blowing up. they were trying to import a directory, thinking that it was an xml file)
|
# ? May 29, 2014 18:13 |
|
yeah for hosting environments like tomcat or w/e gradle is theres gonna be a lot of stuff between the main thread and ur code. I wonder if theres a way to have logback ignore everything below a certain point in a stack trace for common frameworks/hosts. ex: ignore everything under the servlet on tomcat.
|
# ? May 29, 2014 18:17 |
|
prefect posted:i can actually read them, up to a point. after the first few lines, it turns into white noise for my eyes You are not at fault. Java is at fault. Sensible languages that encourage sensible practices have readable stack traces. Although I'm now having flashbacks to the first time I saw a Gnome 2 stack trace.
|
# ? May 29, 2014 18:30 |
|
Java stack traces are fine, Javascript traces are useless Javascript useless
|
# ? May 29, 2014 18:32 |
|
juiceless
|
# ? May 29, 2014 18:40 |
|
raise your hand if you love it when Eclipse hangs for several minutes when you ask it to refactor the name of a private static field!
|
# ? May 29, 2014 20:32 |
|
CPColin posted:raise your hand if you love it when Eclipse hangs for several minutes when you ask it to refactor the name of a private static field! get intellij and never look back
|
# ? May 29, 2014 20:50 |
|
my only issue with intellij is it doesnt have eclim i like eclim
|
# ? May 29, 2014 20:54 |
|
Uncomfortable Gaze posted:get intellij and never look back i think this was with the previous version of intellij, but when i would try to load the source for gradle as a project, it would practically hang my work computer for an extended period
|
# ? May 29, 2014 20:55 |
|
prefect posted:i think this was with the previous version of intellij, but when i would try to load the source for gradle as a project, it would practically hang my work computer for an extended period was the gradle project a gradle project? i know gradle support wasn't very good until they improved it for android support
|
# ? May 29, 2014 21:01 |
|
Uncomfortable Gaze posted:was the gradle project a gradle project? i know gradle support wasn't very good until they improved it for android support yes, the gradle source was a gradle project. their gradle support has gotten better, but it still doesn't hold a candle to their maven support (which makes sense, since maven's all xml, et cetera)
|
# ? May 29, 2014 21:02 |
|
also maven is used by grownups who've graduated from college so maven support is more relevant to jetbrains' customer base
|
# ? May 29, 2014 21:47 |
|
i used sbt and liked it. its probably a bad tool but writing scala code is more fun than editing poms
|
# ? May 29, 2014 21:49 |
|
nuget is pisstrash and is v slow ;_; i used f# 2day and it wasn't all that much better than c# for dicking with azure blobs
|
# ? May 29, 2014 22:05 |
|
Kevin Mitnick P.E. posted:also maven is used by grownups who've graduated from college so maven support is more relevant to jetbrains' customer base we used maven in one of our lovely classes this year!!!
|
# ? May 29, 2014 22:11 |
|
Malcolm XML posted:nuget is pisstrash and is v slow ;_; nuget is crippled by corporate firewalls/proxies lol
|
# ? May 29, 2014 22:23 |
|
|
# ? May 25, 2024 15:04 |
|
Kevin Mitnick P.E. posted:its probably a bad tool but writing scala code is more fun than editing poms when asked why the bridge collapsed killing hundreds, the structural engineer explained that while it was probably a bad tool, playing pontifex was more fun than analysing nonlinear stress.
|
# ? May 29, 2014 22:30 |