4 ms·
This is the sentiment many have when transitioning from OOP -> FP paradigms. That's not to say ORM's don't exist in FP, but they are not nearly as common becau
by Alupis 2y ago
This is the sentiment many have when transitioning from OOP -> FP paradigms.
That's not to say ORM's don't exist in FP, but they are not nearly as common because their concept doesn't directly translate into what you expect from a functional language.
That is to say this is not a Gleam problem, it is a FP problem, if we can even call it a problem (it's mostly just different).
- throwawaymaths 2y agoLisp and elixir, Julia are all fps with macros? Hell even Erlang has macros
- Alupis 2y agoI was speaking to the ORM situation, or lack-thereof the parent seemed to be expressing. Regarding macros - Gleam has stated they are interested in adding metaprogramming, but it's not a huge priority because of the goals of the language. Macros, and metaprogramming in general have a tendency to complicate a language, and encourages ad-hoc DSL's. One of Gleam's goals is to be dead simple to pick up, read, and contribute - metaprogramming makes that much harder. Macros are not necessary, even if their absence is a bit of a shock at first. I used to firmly think they were necessary, but now my mind has changed on this for the most part.
- written-beyond 2y agoThere are two ways to understand your reply, one is that you're talking ORMs that provide query building as an alternative to writing raw SQL. The other is you're talking just about the deserialisation into structures. If what you meant was the first one then, no I'm not expecting anything like that. I honestly like using a language that gets off of the way and let's me focus on what I want to build. I've done very little OOP and I've written a lot of Rust. There are many situations where I feel like r rusts verbosity is limiting my freedom but the grind of unmarshaling hashmaps into structures is way too much for me. Why shouldn't I want to use my languages typing support to help me write more maintainable code? I can hardly get over how dart sometimes outright refuses to cast Object types to dynamic types without some syntactical voodoo.
- Alupis 2y agoYou might be interested in looking at the Squirrel library for Gleam[1]. It kind of reverses the SQL problem in a very nice, elegant way I've found. It gets rid of some of the issues you are bringing up, which are quite valid. [1] https://hexdocs.pm/squirrel/ https://hexdocs.pm/squirrel/
- lawn 2y agoNah this is wrong. Ecto for Elixir is a big counterexample. You're focused on OO ORMs as the way to simplify working with queries, but FP approaches it slightly differently.