Blog and Conversation of FP/OCaml/Elixir/Scala

In other words, you agree with me but you disagree with me? :lol: That’s almost exactly what I said a little below the quote in the same post! I realize we need the sharp knives but I think we all agree that we really do need them only in 5% of the cases (or less). I am fully aware that if Erlang / Elixir were “pure” functional languages then they would be useless.

What I argue against is using the sharp knives more often than they are needed. And programmers fall into the trap of “I am smart, I will not mess it up” thinking way too easily. That was my argument, and still is:

The sharp knives must be used at the absolute viable minimum.

To me, Go is just another Google’s product, that means, if Google creates another shiny thing, Go would die irremediably. Let’s imagine for a moment that Go isn’t designed by Google’s engineers, would it be the same? I don’t think so. Go is nothing without Google backing it IMO (I’m not blaming the creators of Go, they are very smart guys).

People says: “Go is very productive”. But why? I won’t be productive just because it omits semicolons and some parentheses. I only appreciate the fact that it’s portable between different platforms, and that’s pretty good for CLI tooling! But not enough for me to reinvent things in that language.

I know nothing about OCaml, Haskell… Elixir is my first functional programming language, and I really enjoying it! At some point I might learn F#, because I come from .NET world.

2 Likes

I really like the Actix library, I’ve played with it a bit and it is nice and FAST. :slight_smile:

Sad to say, I do agree… Go as a language is horrible and without that backing it would not be where it is now…

Now it’s runtime is pretty cool, but then again there are similar ones in C and such now too. ^.^

5 Likes

I just want to add that i’ve really enjoyed this thread so far. Elixir was my first functional programming language and has changed the way I think about programming altogether. I love the language but I’m only still using it because of Phoenix.

If I had to sum up my experience it would be…

Being one of the rare people to go from Ruby to C# it was an eye opening experience going from a dynamically typed to statically typed language. Compile time safety was a total game changer for me. What I didn’t like was all the ceremony and object oriented design patterns going way too far. I wanted to go back to the simplicity of Ruby.

After hearing about Elixir and taking a look I was immediately interested. Sure, it is dynamically typed but it’s immutable, has typespecs and has supervisors to take care of pesky runtime errors. It turns out that those features are nothing compared to even basic Java/C# style static types. It almost feels like the BEAM/OTP was solely designed to make using a dynamically typed language feasible in production (I’m only half joking :stuck_out_tongue_closed_eyes:).

I’ve been reading a lot of @OvermindDL1’s posts in this forum and he has had me interested in learning an ML style language for a while now but I still don’t know where to go. I do web work for a living and no other functional language has anything like Phoenix. F# sounds like a natural fit for me but integration into the ASP.NET stack is surprisingly poor. OCaml has me most interested as a language but server side web seems dead.

The reason I’m still here is that I’m pragmatic. I don’t want to spend everyday reinventing the wheel. If you want a functional language to do server side web development in then right now there is nothing better than Elixir with Phoenix.

5 Likes

I think the idea to be dynamic was caused to be able to reload / update code on production without any down time.
Now days you have micro service architecture, what is easy to update.
But I guess in old days it was magic …
Little history
https://softwareengineeringdaily.com/2015/11/02/erlang-with-joe-armstrong/

PS
Can you program WEB in F# without ASP.NET for example with https://suave.io/ or https://github.com/giraffe-fsharp/Giraffe?

Another problem was typing actors and their interactions.

I’m pretty sure that this is the way people do web programming with F#. There’s also WebSharper.

2 Likes

Not really? It has a multitude of web servers built in it: GitHub - ocaml-community/awesome-ocaml: A curated collection of awesome OCaml tools, frameworks, libraries and articles.
And this one is new but growing fast I hear too: GitHub - inhabitedtype/httpaf: A high performance, memory efficient, and scalable web server written in OCaml

Eliom is the ‘big’ one overall, but some of the others can be faster, all are rather blazing fast though. :slight_smile:

Just not as…distributable as the BEAM, but can do that too. ^.^;

Which is exactly why I keep saying everywhere, Don’t Type Actors/Processes/PIDs/Messages! Black-box them. :wink:

1 Like

Now akka has typed actors
https://dzone.com/articles/akka-typed-first-steps-with-typed-actors-in-scala

Akka is not a free-form messaging system like the BEAM is, you can type things there (same with Rust) but it also means that you can’t just send messages around willy-nilly, which is both good and bad. :slight_smile:

2 Likes

Had a chat on Twitter with one of the authors. It’s mostly stable, but they are concentrating on useability now. I’m skeptical. For me personally it’s not worth it, but I’m sure a lot of people will like it.

1 Like

Very interesting conversation.

In my job we do TDD (and we are quite strict about this) with Java, Scala, Javascript and Python (and a little bit of Elixir, because of me :wink:

TDD with a dynamic language is like heaven, while Java and Scala are a PIA. With TDD I don’t need types, and I have much better tests about my system. In fact, it is harder to do TDD with static typing, every change needs more work.

IMHO, the best explanation about this is: http://blog.cleancoder.com/uncle-bob/2016/05/01/TypeWars.html

I fully agree with Uncle Bob conclusion :slight_smile:

1 Like

I remember in clojure function that takes map of map of map of maps … So if you are looking on such function without any test data, good luck.
I know that there is now https://clojure.org/guides/spec.
But you can’t force to use it.

In modern functional languages creating types is cheap.

1 Like

Well, Bob seems to forget about two things:

DDD in languages like F#, OCaml, Haskell and Elchemy.
Testing is build in to a large extend there. :slight_smile:

And the second thing is of course property based testing.
I am really wondering, that someone who loved TDD so much, praises unit tests over property based testing.

As always is it a pure joy to receive his view on the history of computing. He is such a fluent, exiting story teller to me :smiley:

Thanks for posting :slight_smile:

4 Likes

I am quite active in the fsharp community.
For simple webpages, I recommend Elmish, which is a simple Elm implementation. To do more sophisticated things, put an eye on Saturn

Its quite new, while it’s creator is well known in the community since he develops the defacto standard fsharp implementation in the defacto standard cross plattform IDE, Ionide on VSCode (and Atom)

The thing is, that the other frameworks are quite low level, if you are fine with this, can they help you probably also.

Plus, there is a super helpful Slack chat going on, while the access to it is currently a little unnecessarily cluttered, since you get the invitation just through an account here

You are welcome :slight_smile:

1 Like

Do you see Elchemy still as too young, as a project?

1 Like

I see author is Krzysztof Cieslak. He is from my country - Poland :slight_smile: and he is also author of F# visual studio code plugin.

Sonehing from best FP conference in Poland

1 Like

Learn Haskell, get static type checking for literally every part of web dev. It’s an excellent and very enjoyable language. It has flaws but I’m pretty sure learning it would change your life and that’s a great thing for a programming language to do.

1 Like

Very far away from the truth. It highly depends on the project. It just so happens that many startups need single-page apps (or so they think). There are many scenarios where a good fast server-side rendering (SSR) process with a sprinkle of some JS (Vue, TurboLinks and a lot more) is blazing fast and efficient as well – especially if you use Phoenix which barely even needs cache.

I got my interest in OCaml piqued as well but I have yet to find the time for that.

3 Likes

So far, it’s still developing a lot and has more things to flesh out, but it’s going well.

1 Like

I think its great due its ability to change types dynamically throught Elixir, so its a realization of the already discussed idea about combining static types with dynamic types :smile:

I read in your OCaml-Tea README, that

Converting code back and forth between Elm and OCaml should be made as easy as possible

So its possible to compile from your implementation to Elchemy.

1 Like