|
Jabor posted:your program had something go horribly wrong and has arbitrarily corrupted internal state, why would you try to continue instead of letting it crash and restart? BiohazrD posted:You're in the right thread my friend I write plugins for a 3D modeler. explain why letting a dumb bug crash the whole modeler and losing my user's work is preferable to emitting an error message and aborting.
|
# ? Jun 1, 2016 17:20 |
|
|
# ? May 25, 2024 22:46 |
|
HoboMan posted:i've said it before and i'll say it again, the c# TryParse methods are bad and i hate them i just realized this code don't even work you would need to do C# code:
HoboMan fucked around with this message at 17:26 on Jun 1, 2016 |
# ? Jun 1, 2016 17:23 |
|
it does make sense to USE stuff like promises in an impure language. I really don't care if you call them monads or not as long as you can see the utility in what the promise is doing. the bottom line for many programmers is: monads are very simple and you're already using them.
|
# ? Jun 1, 2016 17:33 |
|
raminasi posted:I write plugins for a 3D modeler. explain why letting a dumb bug crash the whole modeler and losing my user's work is preferable to emitting an error message and aborting. that should be the modeler's issue to deal with, i.e. not letting wacknut plugins kill the whole modeler
|
# ? Jun 1, 2016 18:00 |
|
Captain Foo posted:that should be the modeler's issue to deal with, i.e. not letting wacknut plugins kill the whole modeler 1) well sure, but it doesn't, and i'm writing software in the real world, not the one where nobody writes bugs and everybody handles their business 2) how's it gonna do that without catch (Exception) anyway? running each plugin in a separate process? hell, let's look at it from the other direction - say i'm calling into ThirdPartyLibraryThatMightHaveBugs.dll. how am i supposed to prevent wacknut libraries from killing my whole application? c# is not erlang, and removing catch (Exception) will not make it erlang
|
# ? Jun 1, 2016 18:45 |
|
HoboMan posted:i just realized this code don't even work We made a fancy functional library at work to use maybes and stuff in C#, I came up with this to handle these uggo TryParse things but decided it wasn't really nice enough C# code:
C# code:
|
# ? Jun 1, 2016 19:41 |
|
raminasi posted:1) well sure, but it doesn't, and i'm writing software in the real world, not the one where nobody writes bugs and everybody handles their business everything should be erlang
|
# ? Jun 1, 2016 19:58 |
|
fleshweasel posted:it does make sense to USE stuff like promises in an impure language. I really don't care if you call them monads or not as long as you can see the utility in what the promise is doing. the bottom line for many programmers is: monads are very simple and you're already using them. please dont hurt my feelings by using a scary word
|
# ? Jun 1, 2016 20:10 |
|
gonadic io posted:rust's try! macro works out to the same thing, as do scalas for loops and um just because you use functional composition doesn't make it a monad i mean, heck, comonads are *incredibly* popular in more mainstream languages
|
# ? Jun 1, 2016 20:17 |
|
so is anyone gonna explain what a monad is to us morons or what
|
# ? Jun 1, 2016 20:28 |
|
quiggy posted:so is anyone gonna explain what a monad is to us morons or what functional explanation: it's a monoid in the category of endofunctors, what happens when you turn a comonad inside out oo explanation: a monad is an object that stores a value which you can only access through a callback, which has rules on composition: monad = new Monad(x) monad.next( {|x| do something with x and return a monad } ) *and* the function *must* return another monad, so you can do method chaining monad.next( { ... } ).next( { ... } ) when you use a callback, the monad object itself gets to control evaluation: the trick is that you can insert logic here, like for handling empty/null values to skip the callback a monad is a building block for functional composition, using callbacks, so that the block can change evaluation order/return value. you can also add another method to the monad object, call it join: monad.join( {|m| do something with monad and return a monad } ) back to functional composition: m = monad(x) # this is called return m.next({|.... a callback that returns a monad}) # this is called bind, or (>>=) homework: why is a builder that has some wrapped values, that takes callbacks like turning code that uses normal iterators inside out
|
# ? Jun 1, 2016 20:47 |
|
haskell comes with syntax that changes do x <- foo() return x into this sorta code flow foo().next({|x| new Monad(x)}) f# has a way more interesting do-notation called "computational expressions"
|
# ? Jun 1, 2016 20:55 |
|
idk what do x <- foo() means.
|
# ? Jun 1, 2016 21:08 |
|
Shaggar posted:idk what do x <- foo() means. it's special syntax to mean "call foo and use x as the callback argument and wrap what follows into the callback"
|
# ? Jun 1, 2016 21:13 |
|
raminasi posted:hell, let's look at it from the other direction - say i'm calling into ThirdPartyLibraryThatMightHaveBugs.dll. how am i supposed to prevent wacknut libraries from killing my whole application? use a worker process per plugin that you communicate with using wcf wcf is sort of a nightmare over a network (because remote objects over a network has always been a nightmare), but for ipc on a single machine it actually does come pretty close to being totally transparent
|
# ? Jun 1, 2016 21:19 |
|
running third-party code out of process is amazing at reducing the amount of stupid bullshit you have to deal with
|
# ? Jun 1, 2016 21:21 |
monads are like gonads, only computre
|
|
# ? Jun 1, 2016 21:23 |
|
ErIog posted:So basically, no matter what you call it, I think there should be separate paths for recoverable vs. non-recoverable errors. you're coming dangerously close to advocating for php error handling.
|
# ? Jun 1, 2016 21:23 |
|
nope, ask noted smart computer man Joe Duffy about this and you'll realize that recoverable and non-recoverable errors are different enough to have different mechanisms.
|
# ? Jun 1, 2016 21:28 |
|
well turns out i'm even dumber than i thought
|
# ? Jun 1, 2016 21:32 |
|
Plorkyeran posted:running third-party code out of process is amazing at reducing the amount of stupid bullshit you have to deal with
|
# ? Jun 1, 2016 21:38 |
|
Plorkyeran posted:use a worker process per plugin that you communicate with using wcf you seriously run all library code in a separate process? that sounds like much more of a nightmare than a top-level "oh poo poo" exception handler
|
# ? Jun 1, 2016 21:44 |
|
raminasi posted:you seriously run all library code in a separate process? that sounds like much more of a nightmare than a top-level "oh poo poo" exception handler certainly not all third-party code, but i've never come to regret it in the places where i have spawned separate processes for libraries (of course, i've only done so specifically because the library was poorly behaved and did things like modify process-global settings, not support multiple instances of it on different threads, leak memory, or just generally do insane things). should i ever design another plug-in interface it'll definitely be 100% out-of-process only because in-process plugins are literally never well behaved and at the minimum you'll get a million stupid bug reports that aren't your fault and you can't do anything about
|
# ? Jun 1, 2016 21:54 |
|
jony neuemonic posted:you're coming dangerously close to advocating for php error handling. php error handling is hosed because it plows through what any normal language would consider a fatal error
|
# ? Jun 1, 2016 21:56 |
|
tef posted:functional explanation: it's a monoid in the category of endofunctors, what happens when you turn a comonad inside out ok so a monad is a thing that takes either a value or another monad, does a thing to it, and returns a monad? so in c++ terms would this virtual class meet the definition of a monad (i know monads are a thing from functional programming that arent used much in imperative programming, but this is my background so it's the context in which im gonna manage to understand these if at all) code:
code:
also what do you mean when you say |x| or |M|
|
# ? Jun 1, 2016 21:58 |
|
i think it's more likecode:
obv this is super reductive {|x| ...} is a syntax for an anonymous function that takes x as a parameter
|
# ? Jun 1, 2016 22:21 |
|
Asymmetrikon posted:i think it's more like so a monad has/is a function that takes a (function that takes a value and returns a monad) and returns a monad
|
# ? Jun 1, 2016 22:23 |
|
Asymmetrikon posted:i think it's more like Close, except andThen's type is virtual Monad<U> andThen(std::function<Monad<U>(T) func). So if I have a function that turns an int into a list of chars, then I can use it to turn a list of ints into a list of chars.
|
# ? Jun 1, 2016 22:26 |
|
kalstrams posted:monads are like gonads, only computre thinkin' this might be the best explanation itt
|
# ? Jun 1, 2016 22:28 |
|
quiggy posted:thinkin' this might be the best explanation itt this checks out with how excited people seem to get about them computer gonads i mean sexbots
|
# ? Jun 1, 2016 22:31 |
|
fsharpforfunandprofit is the best coding tutorial i have ever read, and not surprisingly Scott's http://fsharpforfunandprofit.com/posts/computation-expressions-intro/ as a result i tend to think of monads in practical terms as "define custom behaviour for basic variable-handling keywords like 'let'/'var' and 'return', and do it in a type-safe way"
|
# ? Jun 1, 2016 22:33 |
|
if you're using an apache java thing (ha, laughs! wow), is there any way to force its underlying dependencies to use the logging that they available, declared inside themselves specifically apache vfs sits on top of jsch's ssh implementation, but you only include apache vfs in your project, and i want jsch to start logging a ton, but there's no config for that which i can find
|
# ? Jun 2, 2016 00:00 |
|
the only thing i know about monads is that microsoft used it as the project name for powershell
|
# ? Jun 2, 2016 00:03 |
|
speaking of terrible programmers https://twitter.com/anblanx/status/738139381744078849
|
# ? Jun 2, 2016 00:05 |
|
Share Bear posted:if you're using an apache java thing (ha, laughs! wow), is there any way to force its underlying dependencies to use the logging that they available, declared inside themselves Most of the Java logging systems are runtime configurable by the choice of jars, i.e. there is usually an implementation or binding jar that can target J.U.L., SLF4J, Log4j1, Log4j2, or Logback. You can also do things with Apache Commons logging and I think there is another one too, way too many.
|
# ? Jun 2, 2016 00:06 |
|
Share Bear posted:if you're using an apache java thing (ha, laughs! wow), is there any way to force its underlying dependencies to use the logging that they available, declared inside themselves the problem is that jsch doesn't log to any framework so you have to roll your own http://stackoverflow.com/a/26849101/102483
|
# ? Jun 2, 2016 00:25 |
|
Plorkyeran posted:running third-party code out of process is amazing at reducing the amount of stupid bullshit you have to deal with sadly ipc is also stupid bullshit so you really don't gain much (unless you're using erlang maybe?) we have a bunch of ancient c libraries whose error handling consists of dumping poo poo directly to stdout and then calling exit(). I do run those out of process in a couple of programs, but it's bad and really I should just fix them to use proper error callbacks or something
|
# ? Jun 2, 2016 00:35 |
|
for some reason our homemade email processor spits all its exceptions into an sqlite database
|
# ? Jun 2, 2016 01:50 |
Luigi Thirty posted:for some reason our homemade email processor spits all its exceptions into an sqlite database
|
|
# ? Jun 2, 2016 02:01 |
|
|
# ? May 25, 2024 22:46 |
|
kalstrams posted:hmm i wonder why. you should roll your own crypto next, to make sure the sqlite database with email logs is unbreachable I got to listen to someone in the next cube over bitch all day about how it would make his job (remote support) easier if our application just used reversible password encryption
|
# ? Jun 2, 2016 02:11 |