News for hackers. Stuff that matters.
Re:The Missing Semester of Your CS Education by noelwelsh on Saturday February 25, 2023 @03:07AM (#34934856)
There is a world of programming where debuggers don't serve much purpose. Individual microservices are usually trivial, but push complexity into the interactions between services. Debuggers are not much use there; distributed tracing is more relevant. Functional programming, which is a growing part of the industry, really emphasizes code you can easily reason about. That's arguably the whole point of functional programming. Debuggers don't get much use there either.
Re:The Missing Semester of Your CS Education by noisenotsignal on Saturday February 25, 2023 @03:30AM (#34934955)
Agreed, when I commented earlier I was also thinking about mentioning something similar with regards to classes of bugs due to interactions between systems.

Unless you have a setup where you can easily run one system with a debugger attached while connecting it to everything else, you’re basically restricted to running a debugger for bugs that can be reproduced locally.

Re:The Missing Semester of Your CS Education by Eji1700 on Saturday February 25, 2023 @03:25AM (#34934925)
I'm not a talented developer but I did spend my day on an F# piece of code that builds a databale based on a record type using reflection (and eventually realized it was going to need to be recursive) and I probably would've just quit if I wasn't allowed to use a debugger.

Now maybe if I was better that wouldn't be the case, but even the cleanest "wish i thought of that" functional code i've seen still looks like it'd be easier to fail fast using a debugger with.

In fairness though, I will admit I use the debugger a lot less when i'm not screwing with reflection on generic types or whatever because runtime errors just happen a lot less in functional styles. Usually if it compiles, it runs, because the compiler can sanity check the code better than you can.

Re:The Missing Semester of Your CS Education by tokinonagare on Saturday February 25, 2023 @06:01AM (#34935665)
> I'm not a talented developer

> [uses F#]

That has to be humblebragging. The average .net developer is terrified of or doesn't even know about F#.

Re:The Missing Semester of Your CS Education by bmitc on Saturday February 25, 2023 @06:36AM (#34935840)
It's an interesting phenomenon because F# is far easier to learn than C#.
Re:The Missing Semester of Your CS Education by bazoom42 on Saturday February 25, 2023 @12:12PM (#34938295)
Perhaps if you already know C#, otherwise I doubt it. Of course it depends on ones prior experience, but F# is functional but still requires you to understand OO in order to interact with the framework.
Re:The Missing Semester of Your CS Education by Eji1700 on Saturday February 25, 2023 @02:59PM (#34939873)
I think it's harder if you already know C# or some other OO language. I really think it would be easier, or about the same, to teach a raw beginner the basics of F# vs C#.

The only reason F# winds up feeling harder isn't so much how F# works, but simply because the entire dotnet environment was built for C# first, so you do need to know how to handle the C# style. I do think that if you could just pick one and then suddenly have every library support it's styles, F# would probably be easier overall because it's just got a lot of nice features built in that make updating your code so much easier.

Re:The Missing Semester of Your CS Education by bazoom42 on Sunday February 26, 2023 @07:58AM (#34945167)
F# has two ways to invoke functions, ‘f a b’ and ‘f(a,b)’. You need to know when to use what. There is no way this is simpler to beginners compared to having one consistent way.

C# is not a simple language, but F# has basically all the complexity of C# with OCaml on top.

Re:The Missing Semester of Your CS Education by nequo on Sunday February 26, 2023 @03:18PM (#34948947)
I don't know F# but the reference only mentions the `f a b` syntax.[1]

`f(a, b)` looks like a call to a function that takes a single tuple as its argument. So I would expect `f` to have the type signature `A * B -> C` instead of `A -> B -> C`. Is my intuition wrong? If it is, then what does F# use the parenthetical syntax for?

[1] https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

Re:The Missing Semester of Your CS Education by bazoom42 on Sunday February 26, 2023 @05:08PM (#34950060)
Methods from the .net framework and other libraries are called with a tuple of argument, since they are not compatible with the native F# was of calling functions.
Re:The Missing Semester of Your CS Education by Eji1700 on Monday February 27, 2023 @02:28AM (#34953954)
I mean to be completely bad faith pedantic, yeah that's still f a b, but obviously not the point being discussed here.
Re:The Missing Semester of Your CS Education by Eji1700 on Monday February 27, 2023 @02:27AM (#34953949)
This to me is a pretty simple thing to explain and deal with.

F# enforcing a lot of good practice code style stuff (order matters for example pisses off long time devs who already have styles, but prevents SOOOO much stupid bs from beginners) and basically eliminates runtime/chasing variable state errors completely so long as you can stay within style. Yes it'd be nicer if there was only one way to invoke functions but if i had to take a tradeoff I think it's a pretty easy one.

It is an issue that yes, like your example, you're often stuck ALSO learning OO because "oh you want to use X library, well that's OO so...", and even then you can isolate your mutable/OO areas really well, but this is more of an issue with it being an second fiddle language. If F# got F# specific libraries for all the C# stuff out there tomorrow I think it'd take off and most people would never look back.

If we're talking basic business logic/beginner programmer stuff, yeah I think F# offers a lot of stuff that makes it flat out easier to use. And if you want to point out complex issues, I feel the biggest one is that something that's intuitively much easier to understand in OO (create a variable/object, populate it on each iteration of a loop depending on logic), can feel daunting as hell in F# (fold).

Re:The Missing Semester of Your CS Education by pyjarrett on Saturday February 25, 2023 @03:44PM (#34940271)
Knowing a good bit of Rust helped me considerably, due to the commonalities of being expression-based, pattern matching and sum-types. F# almost feels like a more functional and GC'd Rust.
Re:The Missing Semester of Your CS Education by sn9 on Saturday February 25, 2023 @07:15PM (#34941818)
F# is heavily based on OCaml and Rust was heavily inspired by the ML family of languages, and I've often heard it described as an ML without GC and with memory management and a C++ style syntax.

You're noticing a very real relationship.

Re:The Missing Semester of Your CS Education by owenm on Sunday February 26, 2023 @04:26AM (#34944232)
This was me - my first .net language was F# (although I'd dabbled a tiny bit in C#); it was hard to learn the .net standard library as well as trying to learn functional idioms...
Re:The Missing Semester of Your CS Education by tokinonagare on Sunday February 26, 2023 @08:51AM (#34945526)
I don't agree, because learning F# is essentially learning two very different languages at the same time: first OCaml from which it was initially an implementation, then C# for all the object/CLR layer.

It's easy for people with functional programming knowledge, or who had OCaml as their first programming experience like I did at university, but for people without those exposures I can understand the difficulty.

Re:The Missing Semester of Your CS Education by nickpeterson on Saturday February 25, 2023 @07:30AM (#34936162)
I’ve encountered the same thing. I’m a terrible programmer but find f# way clearer than most C#/java. But I work with tons of great developers who would rather cut off their finger than learn f#, it bothers me because it exposes some fundamental difference between us I dont like to believe exists.
Re:The Missing Semester of Your CS Education by politician on Saturday February 25, 2023 @10:45AM (#34937491)
Job vs craft. Or, maybe, they just don’t want to pollute the codebase with a new thing that breaks. Consistency is a virtue in old codebases.
Re:The Missing Semester of Your CS Education by OOPMan on Saturday February 25, 2023 @11:11AM (#34937706)
> I'm a terrible programmer

Oh? Did you win some award? I'm curious as to how you're determining this?

Re:The Missing Semester of Your CS Education by nickpeterson on Sunday February 26, 2023 @08:50AM (#34945523)
Not a humblebrag. I’ve noticed I struggle with tracking lots of variables and states compared to many fellow developers. I’ve sort of tried to turn this weakness into a strength, by making code simpler, but sometimes I make it too terse because I like code golfing.
Re:The Missing Semester of Your CS Education by ModernMech on Saturday February 25, 2023 @08:35AM (#34936539)
Is the average .net developer terrified of F# because they're not talented enough, or because it's different?
Re:The Missing Semester of Your CS Education by Eji1700 on Saturday February 25, 2023 @03:02PM (#34939891)
It's 100% the latter. I get "ok we don't want to mix codebases" and that's fine, but if you can code in C# you can probably get up and running in F# in a week, maybe a month if you struggle with some of the concepts.

One major issue I do see coming from the C# side is "well how do I do this then?!", which often the answer is "you don't, because you don't need to" or "well what if it's more performant to do it mutably!" well then thankfully F# can absolutely do that.

If you keep an open mind it's really a very clean and simple language, but in an age where half of development is importing 8 well known libraries, not being the main supported language is a major weakness.

Re:The Missing Semester of Your CS Education by pyjarrett on Saturday February 25, 2023 @03:41PM (#34940246)
I normally write C++, but I've also written in Rust, Python, Ruby and bunch of other languages. I've never had trouble with a programming language until Haskell, and had to accept that I'm just probably just not smart enough to do it.

However, I wrote my first thing a port of a small C# tool of a couple hundred lines, to F# in about an hour. It's been about a week now, and things are considerably smoothing out.

To be considered niche, the F# tooling has been great. Also, having the .NET libraries available adds a lot of built-in capability.

Re:The Missing Semester of Your CS Education by JackMorgan on Saturday February 25, 2023 @08:17PM (#34942116)
In my experience most developers remember how hard it was to learn their first language, and worry that the second will be just as hard
Re:The Missing Semester of Your CS Education by Eji1700 on Saturday February 25, 2023 @02:56PM (#34939845)
It's really not. I'm quite terrible from any industry perspective.

F# isn't hard, it's just different. Hell in many ways i'd argue it's much much easier once you get used to it. It doesn't have the support C# does so often you're stuck with a library that WILL work but doesn't have documentation for doing it in F#, and that can lead to struggles, but that's not really a sign of being a good coder.

Most dotnet developers could probably code circles around me in F# if they knew it existed/gave it a chance.

Personally I stuck with it because it had the low code look of python with strong typing. It took a bit to wrap my head around some functional stuff (basically map/iter = foreach and if you want to update something on each loop you probably want a fold, or more likely a built in function), but once I got over that hurdle it was pretty smooth sailing.

The irony is that by far the hardest part is the library thing, which your average dotnet dev would handle WAAAAY better than me.

Re:The Missing Semester of Your CS Education by sanderjd on Saturday February 25, 2023 @08:47AM (#34936619)
The distributed tracing point makes sense, but I think debuggers are still quite useful for functional code. Though maybe less commonly needed than just the repl.