|
LARD LORD posted:what is the advantage of Haskell, if any?? efb by meram
|
# ? Jul 14, 2014 06:51 |
|
|
# ? May 28, 2024 16:11 |
|
AlsoD posted:perhaps one reason why people struggle with Haskell's error messages* is that they're so used to VS or javac that actually reading them seems like a really weird concept I struggled a lot with sml errors at first because I guess I was way too used to dynamic typing.
|
# ? Jul 14, 2014 08:06 |
|
terrible programmer question: if im dicking about in C++/CLI and i create an unmanaged std::thread to do some work in the background, will it block when the garbage collector runs my intuition says "no" because the gc thread won't know about the unmanaged thread, but i dont know enough about .net/OSes/GC/anything to be sure there's not some process-wide magic going on e: and two minutes later i find an answer by giving up on keywords and googling "how does the .net garbage collector interrupt threads" quote:This has the same property as the CLR's garbage collector. A GC won't stop threads that are not running managed code. Since those threads can't be touching the GC's heap anyways, there's no need for the GC to coordinate with them. coffeetable fucked around with this message at 18:49 on Jul 14, 2014 |
# ? Jul 14, 2014 18:45 |
|
LARD LORD posted:what is the advantage of Haskell, if any?? if you are simon petyon jones it helps you prototype new features for use in a real language. for everyone else there is no reason to use Haskell
|
# ? Jul 14, 2014 18:47 |
|
coffeetable posted:terrible programmer question: if im dicking about in C++/CLI and i create an unmanaged std::thread to do some work in the background, will it block when the garbage collector runs iirc in c# if you have unmanaged code and the managed references to the unmanaged code get dereferenced, it will gc the managed bits but leave the unmanaged ones around forever. so you need to be very careful to make sure you include cleanup of the unmanaged code inside your managed code. IDisposable makes this pretty easy. idk how managed c++ does it but I bet its similar.
|
# ? Jul 14, 2014 18:53 |
|
wish you implemented IDisposable
|
# ? Jul 14, 2014 18:56 |
|
AlsoD posted:then there's the typeclass related ones which mostly just take the form of "no instance of <typeclass> arising from the literal <literal>". typeclasses are essentially OO's interfaces i've had terrible problems decoding XMonad type errors. afaict its because some XMonad contribs require language extensions. some inscrutable poo poo about typeclass instances related to type variables in the instance declaration iirc. w/e i copied the extension directives from the example config and it worked
|
# ? Jul 14, 2014 19:16 |
|
I need to hurry up and learn a lambda and a LINQ in .NET. I just stackoverflow everything or write a loop. Nothing wrong with loops but I want to belt out these fancy pants oneliners for interviews and sense of satisfaction. Is there a good writeup or how-to-do guide somewhere? Conceptually speaking I know what I want to do, that is, "remove elements from list that do/not match this condition" or "return new list which reflects changes you want to be made to elements matching/notmatching". My actual case here is "remove whitespace/empty strings from list" and "if a string has -'s remove them, that is, turn "1-2" into "12" ". Feh.
|
# ? Jul 14, 2014 20:56 |
|
so in linq u have certain query operations that are kind of similar to sql. it has 2 syntaxes, query and method. for your example query syntax would look something like this C# code:
C# code:
there are loads of other query operations like lets say you had a list of Boners and you wanted to get a list of all their sizes C# code:
theres way way way more and you can have a lot of fun abusing the hell out of linq to make what would otherwise be easy to read loops almost incomprehensible. try it out on your teammates today!
|
# ? Jul 14, 2014 21:29 |
|
lol more like ienumerable<short> sizes!!! (rly more actually like var sizes)
|
# ? Jul 14, 2014 21:50 |
|
so a lil bit about lambdas. lambda syntax in c# is basically just shorthand for writing a function. in the case of x=>!String.IsNullOrWhitespace(x) that is the equivalent of writing C# code:
so what is a delegate? Delegates are what separates c# from the uncivilized heathens of dynamic garbolangs. delegates are sort of like function pointers but way better because they are type safe. So lets go back to select. What the heck are we actually doing inside those parenthesis?? Well its like all other methods. we are passing an argument to Select, but it just so happens to be a function instead of an object!!! what the gently caress? that is weird! if you look closer in vs you will see the type parameter in intellesense for the previous select example is Select(Func<string,bool> predicate) . Func is a generic delegate in c# and u'll see it all the time. Func represents a pointer to a method that takes in a parameter of type String and returns a value of type bool. So something like this: C# code:
Would match that signature. We could pass NotNullOrWhitespace directly into the select like this C# code:
Since linq is expecting a method that matches the signature Func<string,bool> it accepts this and compiles because we are being type safe!!! if you were to add or remove parameters to NotNullOrWhitespace it would not compile because it does match the signature of func<string,bool> and the compiler would not have any idea what u are doing! We can also do something like this C# code:
Now we have a reusable function for NotIsNullOrWhiteSpace!!! This is really stupid and you will never find anyone who actually does that tho. Its just to demonstrate that u can assign delegates to variables or fields (as in this example) and then pass them off to methods like they were just regular old parameters. Shaggar fucked around with this message at 21:57 on Jul 14, 2014 |
# ? Jul 14, 2014 21:50 |
|
you use delegates in c# for the same reasons you use function pointers in bad languages. they let you hide complex and unmaintainable implementations behind deceivingly simple facades! the difference is in c# the compiler makes sure you didn't gently caress up too bad.
|
# ? Jul 14, 2014 21:52 |
|
function pointers own and c is not a bad lang
|
# ? Jul 14, 2014 21:56 |
|
yes it is
|
# ? Jul 14, 2014 21:58 |
|
talked to them on the phone and they seemed legit, the guy on the other end knew what he was talking about, he said there's so few developers around here that they'll take anyone with any OOP experience and that the majority of the responses to his ads are people in india.
|
# ? Jul 14, 2014 21:58 |
|
C is a good lang
|
# ? Jul 14, 2014 22:01 |
|
Shaggar posted:iirc in c# if you have unmanaged code and the managed references to the unmanaged code get dereferenced, it will gc the managed bits but leave the unmanaged ones around forever. so you need to be very careful to make sure you include cleanup of the unmanaged code inside your managed code. IDisposable makes this pretty easy. how i had it in my head was that there were managed and unmanaged threads, with the managed threads checking in w/ the GC periodically to see whether they should suspend while it collected the garbage. now i realize all it is is that if a thread tries to access managed memory while the garbage is being collected, it blocks until the GC is done. gently caress them posted:I need to hurry up and learn a lambda and a LINQ in .NET. I just stackoverflow everything or write a loop. coffeetable fucked around with this message at 22:15 on Jul 14, 2014 |
# ? Jul 14, 2014 22:12 |
|
Bloody posted:C is a good lang
|
# ? Jul 14, 2014 22:14 |
|
also if you cant figure out linq in like five minutes of intellisensing and googling then smdh its the most straightforward intuitive programming feature i think ive ever used
|
# ? Jul 14, 2014 22:16 |
|
Shaggar posted:so a lil bit about lambdas. lambda syntax in c# is basically just shorthand for writing a function. in the case of x=>!String.IsNullOrWhitespace(x) that is the equivalent of writing function pointers are type safe to the extent that anything is type safe in C. the big honkin difference is that delegates can have state and the compiler leverages this to provide simple syntax for poo poo thats a huge pita in C. ofc every language feature can be emulated by a sufficiently determined C programmer which is why callbacks almost always have an extra void* for passing state
|
# ? Jul 14, 2014 22:20 |
|
gently caress them posted:Nothing wrong with loops see this is what happens when your education is based entirely on homework assignments and 500-word articles
|
# ? Jul 14, 2014 22:30 |
|
C is an easily abusable lang
|
# ? Jul 14, 2014 22:49 |
|
coffeetable posted:terrible programmer question: if im dicking about in C++/CLI and i create an unmanaged std::thread to do some work in the background, will it block when the garbage collector runs the party line on c++/cx is that you should not use c++/cx for anything but a shim for data binding and poo poo to link to your xaml u can pin poo poo using gc handles, useful for p/invoke and native interop so that u can have a fixed ptr that the gc won't molest remember to clean it up using c#'s bastardized cousin of RAII, idisposable
|
# ? Jul 14, 2014 22:55 |
|
MeruFM posted:C is an easily abusable lang
|
# ? Jul 14, 2014 23:23 |
|
YOSPOS I have tried to "not learn" Javascript like 4 times now using various x-to-javascript translators and they're all inadequate and now I'm learning Javascript from scratch and all the tutorials act like I want to learn baby's first programming language
|
# ? Jul 14, 2014 23:25 |
|
the most JavaScript you need to know is how to import knockout into your project and how to google for the jquery library that does what you want
|
# ? Jul 14, 2014 23:28 |
|
ShadowHawk posted:YOSPOS I have tried to "not learn" Javascript like 4 times now using various x-to-javascript translators and they're all inadequate and now I'm learning Javascript from scratch and all the tutorials act like I want to learn baby's first programming language read javascript the good parts I guess
|
# ? Jul 14, 2014 23:42 |
|
Symbolic Butt posted:read javascript the good parts I guess
|
# ? Jul 14, 2014 23:49 |
|
ShadowHawk posted:YOSPOS I have tried to "not learn" Javascript like 4 times now using various x-to-javascript translators and they're all inadequate and now I'm learning Javascript from scratch and all the tutorials act like I want to learn baby's first programming language it's like C except everything is shittier except it has anonymous functions and lexical scope
|
# ? Jul 14, 2014 23:52 |
|
Malcolm XML posted:the party line on c++/cx is that you should not use c++/cx for anything but a shim for data binding and poo poo to link to your xaml but this is all exploratory so watch me change my mind in a month's time Symbolic Butt posted:read javascript the good parts I guess then, if you're able to pick the language rather than having it proscribed to you, go read TypeScript Revealed. TS is a superset of JS (so retains all the functionality) that feels remarkably like C#. now that isn't exactly high praise but its a step up from "feels remarkably like JS" coffeetable fucked around with this message at 00:06 on Jul 15, 2014 |
# ? Jul 14, 2014 23:57 |
|
coffeetable posted:yeah when i was googling around i found plenty about managed vs unmanaged memory, and like you say the GC ignores the latter. what i was having trouble finding was about how the GC interacts with managed vs unmanaged execution. Two, and it's vb.net. And it's web poo poo. I literally never actually needed much linq at all. It's the most boring of cruds. Edit: Sometimes I'll actually do-a-logic, but it's largely just filter a thing, which databases are quite good at, or plug-in-a-thing from an existing library. I've ONCE had to actually do something more complicated than a one liner while webdevving, unless you count debugging as nontrivial. Just how lazy web poo poo can make you is hard to appreciate until you actually get stuck doing it. Fuck them fucked around with this message at 00:18 on Jul 15, 2014 |
# ? Jul 15, 2014 00:12 |
|
coffeetable posted:also lol Care to explain the pithy wisdom here? I'm really not sure how explicit loops are 'bad'.
|
# ? Jul 15, 2014 00:16 |
|
gently caress them posted:Care to explain the pithy wisdom here? I'm really not sure how explicit loops are 'bad'.
|
# ? Jul 15, 2014 00:22 |
|
welp, fair enough.
|
# ? Jul 15, 2014 00:34 |
|
literally the topic of one of my papers also important are imap, ifilter and ifold i.e. the indexed versions
|
# ? Jul 15, 2014 00:51 |
|
I'm starting to wonder is this is a part of the webdev growth experience. Do you take side projects, change direction, or just embrace the lazy? Because holy poo poo is there some lazy where I work.
|
# ? Jul 15, 2014 01:05 |
|
i only program with recursion loops make me feel dirty
|
# ? Jul 15, 2014 01:09 |
|
gently caress them posted:I'm starting to wonder is this is a part of the webdev growth experience. Do you take side projects, change direction, or just embrace the lazy? idk my job is web and i've been really amazed by how hard everyone is working all the time. either that or they're all much smarter than me and do things 20x faster (also possible)
|
# ? Jul 15, 2014 01:10 |
|
ugh... was forced to switch bosses a few weeks ago and things feel like they are at the beginning of plunging into unpleasantness. I was told I was 'pillaged' because some guy up the food chain needed me to pump out more PoC code... post your criteria for looking for another job, tia
|
# ? Jul 15, 2014 01:14 |
|
|
# ? May 28, 2024 16:11 |
|
gently caress them posted:I'm starting to wonder is this is a part of the webdev growth experience. Do you take side projects, change direction, or just embrace the lazy? find another job because your current one isn't going to make you any better. or suck forever, that's doable I guess
|
# ? Jul 15, 2014 01:17 |