Hacker News new | past | comments | ask | show | jobs | submit | Parazitull's comments login

For anyone looking for an Elm like experience but without the limitation imposed by its creator, take a look at Elmish, a port of the Elm architecture in F#.

Advantages: You can use F# on the front and backend. Pretty good js interop with a lot of opportunities to shoot yourself in the foot.

Disadvantages: You will probably need to use the Elm docs/tutorials to learn about Elmish.


This seems similar to the joke where after Brexit, the Germans are angry that english is still the official EU language and they change the english language until it sounds a lot like german.

In a few years, C# 20.0 will have only one release note: Changed the name from C# to F#


C# is Microsoft Research's 20-year-long con to turn Java programmers into OCaml programmers so slowly that they don't notice.


This made me chuckle.

I think it's broader than C# -> F# though. Java also has closures and higher-order functions, and in many debates on this forum it seems like OOP proponents aren't aware that these features are grafts from functional programming. OOP programmers also seem to have (finally) come around to the consensus that composition is preferable to inheritance.

So if there is a long con, I think it is about turning OOP programmers into ML or functional programmers. :p


> these features are grafts from functional programming

Except that Smalltalk -for which the term "object oriented" was invented - had them.

https://www.infoq.com/presentations/functional-pros-cons/


yeah for composition - I ALWAYS liked it much better!


Some languages even have syntax sugar for it built-in, coughKotlincough

    class Foo(b: Bar) : Bar by b


This is the most controversial feature of Kotlin.

The delegation is better than inheritance because you don't get all the methods from the base class if you don't need them.

At my company, we have banned it, because if you add a method to Bar the method is automatically added to Foo which makes the delegation as fragile as the inheritance.


> At my company, we have banned it, because if you add a method to Bar the method is automatically added to Foo which makes the delegation as fragile as the inheritance.

Delegation does not remove the need for interfaces.


Go has a similar feature, and while I don't know that I would say it's especially controversial or frowned upon, it's good form to only use it sparingly if at all. I still wouldn't say that it is anywhere near as fragile as inheritance; however--I think inheritance's fragility comes from its polymorphism (not sure about Kotlin, but in Go, the wrapper class/struct can't be passed into a function that expects the component's type).


With Kotlin and Scala in existence, that ain’t going to happen. C# is as verbose as it was years ago. After years of Scala collections, eithers, options, why would anybody consider C#.

Just look at plumbing with init, data records and with. That is what a case class with val properties in Scala gives.

But congratulations to the team on shipping v9.


Because Scala takes mind-boggingly long to compile. Because Scala has so many features that anything has at least 3 different ways to implement it. Because it’s very easy to write unreadable code in scala, not so much in C#. Because Scala uses JVM, while C# has access to .NET (yes this is an advantage for many developers).


> Because Scala has so many features that anything has at least 3 different ways to implement it.

Thankfully that problem doesn't exist with C# /s


What are the last Scala/sbt versions you’ve used? Scala compilation times (and sbt startup times) have improved dramatically over time, it’s reasonably fast now. In the past 3 years, the Scala compiler has gotten literally twice as fast. I don’t have hard numbers for sbt, but it feels like it has improved by much more than that.

For a mid-sized web service (tens of thousands of LOC), a clean compile might take ~30-40 seconds, but you rarely do those. Incremental compiles take more like single-digit seconds, and for most projects you can have a solid “compile on save” type setup that makes it pretty unnoticeable. And sbt itself, which used to be very slow to startup (sometimes 10-20 seconds), now starts up in a couple seconds.

It’s not lightning fast like Go, but it’s way faster than it used to be. Not much of a pain point anymore unless you’re dealing with truly huge projects.


All your points except the last one do not apply to Kotlin


is kotlin slow to compile


It's certainly slower than javac (which is pretty freaking fast - maybe not in comparison to go, but it's no slouch), but it certainly mops the floor with scalac.


> C# is as verbose as it was years ago.

It isn't. Pretty much every release (including C# 9.0) adds some features that make your code more concise.


TL,DR: Try F# or other "impure" ML languages if you want the security of types but you don't like actually typing the types.

I also used to love js / php because because I thought types make the code unnecessarily verbose. After some pet projects with a strongly typed lang (c#) I realized the peace of mind that using types gives. But I still maintain my opinion that types make the code too verbose.

But then I saw the "light" that is F# and I'm here to preach:

F# has types BUT you don't need to type them (most of the time) because it has type inference. F# can be used in the .net ecosystem and most of the time it can replace C#. F# can be compiled to js (although the interop is a bit messy). F# is a better typed javascript than typescript. F# is predominantly functional but you can also write code in the non-functional(ha!) style of your choice. F# discourages you from coding mutable spaghetti F# has decent tooling: VSCode + Ionide + dotnet + paket F# has pipes |>

The bad parts:

F# is not a hard-core functional language like Haskell, but for me this is a positive F# is a functional language which requires a change about how you think about a program. F# doesn't have a huge community F# doesn't give you a lot of job prospects F# doesn't have a lot of 3rd party libraries (but you can use c# libraries in .net or js libraries with fable. You can also mostly port libraries from other functional languages) F# requires you to think about the order of your declaration. Cyclic dependencies are harder to accomplish although this might be a good thing.


For the good parts, I would add the effortless type declarations to overcome “Primitive Obsession”, the immensely useful pattern matching to ensure you cover all edge cases and what I really found to be the killer feature: Type Providers to enable typed data wrangling in just a few lines.


The content seems pretty vetted.

When I used it to learn .net mvc, the course was pretty well produced and structured.

Also, if I remember correctly, Troy Hunt had a web security course on the site.


If you're interested in .net and the clr, you could replace c# with f#.

It's the most practical functional language that I've tried. Great for domain modeling and it can used in C# projects.

I also think that c# is too verbose so what I normally do: asp.net core mvc for routing, templating, authentication / authorization, data access etc and then reference an f# project that contains the domain logic. The best of both worlds.


As a complete newbie to .net, I’ve tinkered around with f# for a web app and quickly got frustrated. I like the sound of your approach. Do you have any links / resources for the best way to get started with your approach?


Don't try to start with a web app. I'd recommend looking into Fable (the F# to js compiler). Write f# and run it in the browser, I found it to be a better and faster feedback loop when compared to a .net project.

Play around with the f# language (don't touch the js inter-op) until you can figure out if you actually like f#. Take it slow, it's not just a new language, it's a different paradigm. If you get frustrated, take a break for a few days, watch some f# videos and let the knowledge settle. You'll eventually start having evrika moments.

Look into other functional languages. Maybe you'll like others more. Accumulate knowledge and experience until you start thinking "I could do this a lot simpler in f# (or other lang)".

Then, if you want to use f# in a c# project you just need to learn how to reference a project in another project.

If you want some resources: https://fsharpforfunandprofit.com/video/ some of these videos can get you "hyped up" for functional languages

https://www.youtube.com/watch?v=4YO4XmtPFQw

https://www.youtube.com/watch?v=EPfpO_6uFAA

the entire https://fsharpforfunandprofit.com/ site is a good resource to learn everything from the basics to the wizard level stuff.

As an editor you can use Visual Studio but I'd recommend Visual Studio Code with the Ionide extension.


If your writing a web app I've heard good things about Giraffe (https://github.com/giraffe-fsharp/Giraffe). It seems to even have a project template via the "dotnet" command to get a quick web app running. With F# I personally find Rider or VsCode better IDE's than VS as well. The workflow in F# is more like my experience with scripting languages than something heavy like Java/C#; you don't lose much by going to a more lightweight IDE and a lot can be done via CLI commands and text editing in .NET Core.


so don't sell to people, sell to robots


it says ARROw down > cARRot See the resemblance?


Good point!

It also says vegetable, which starts the same way cabbage ends. That may account for so many people thinking cabbage.


People might be lying and also 3 people is not "many" ;)


i'm wondering if it's possible that after you enter your email, a window will pop that points at the email provider ( gmail in my case ), for convenience's sake.

Or maybe, with support from the email provider the pop up will contain just the link

Or maybe you could redirect to the link automatically

it's starting to look like 3rd party auth, only that you need to enter your email


A link to a recognized email provider would be a nice touch, thanks.


i read an article by pg saying he thinks email is practically an impractical to-do list and it would be nice for someone to create a replacement ( for emails ) under the guise of a share-able todo list;

i think


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: