AstonJ

AstonJ

Cool things you've seen in other languages/frameworks

Inspired by @dogweather’s thread about Active Record Doctor, have you seen any impressive or cool things in other non-BEAM languages or frameworks? If so please share!

When taking part please note…

  • This is not a “I’d like to see X in Elixir or Phoenix" type thread.
  • It is not even a thread about things that may or may not be a good fit for functional programming.
  • It is just a thread to share cool things you’ve seen in other languages or frameworks :icon_biggrin:

Why?

Who knows, it might spark someone’s imagination to do something cool in Elixir themselves :003:

Please do not use this thread to criticise other languages or frameworks - let’s keep it focused on the positives.

Most Liked

dogweather

dogweather

Rust has a relational db library that connects to the db while you’re coding and uses the metadata to verify your code at compile-time.

13
Post #3
matt-savvy

matt-savvy

Elm’s time traveling debugger.

Step backwards or forwards through the state of your program.

12
Post #8
TwistingTwists

TwistingTwists

Perfect spot to come to get nerd sniped.

Watching this space :laughing:

AstonJ

AstonJ

Ruby has something similar, keyword arguments - which allows you to name parameters:

def add_values(first:, second:)
  first + second
end
add_values(first: 5, second: 3)

Can be called in any order:

add_values(second: 3, first: 5)

Can be used with positional arguments:

def add_values(first, second:)
  first + second
end
add_values(1, second: 2)

And you can supply default values:

def add_values(first: 0, second:)
  first + second
end

I like how Rails generally has a lot of things built in that almost all apps/sites might use.

Recently I noticed Rails now also have a built in rate-limiter, super handy!

And something I have used in almost every Rails site is caching, which can really help make a site feel fast and responsive.

As an example:

This is cached and the cache is busted when the updated_at field changes. It might not look like much but there are a lot of things that need to be calculated and pulled in - the category names and hover colours need to be worked out, the icon and colour in the top right needs to be worked out, the domain name is stripped from the full url, the tags need to be classified and displayed as portals or tags etc. That’s a lot of CPU per page without caching.

On top of that you can cache queries and set them to expire from as little as a minute to a day or more. I do this for even relatively simple queries as it can give you some protection against DDOS attacks.

    def latest_spotlight
      Rails.cache.fetch("latest_spotlight", expires_in: 1.hour) do
        Topic.where(category_id: Category.in_the_spotlight).includes(:image_upload).last
      end
    end

Without caching a Rails page load can show more than 20% CPU usage, with caching, as little as 1%.

acrolink

acrolink

Nothing. All cool things I have found in Elixir.

Where Next?

Popular in Discussions Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
rump13
Hi everyone, I’ve been following Elixir since around 2016 and tinkering with it on and off, but I haven’t had the opportunity to use it ...
New
dimitarvp
Hello, I am looking to more closely understand the advantages of the Repo.transact pattern and the quoted disadvantages of Ecto.Multi. ...
New
jdumont
I could write forever about this, but I’ll do my best to keep it succinct. For anyone familiar with event sourcing, what is your opinion...
New
neilberkman
Carson Katri from DockYard posted today about swift-erlang-actor-system, which enables Swift programs to join Erlang clusters as distribu...
New
marciol
Thinking about how Contexts on Phoenix 1.3 are beautiful in the simplicity, elegance and minimalism, coalesced in the smallest unity of E...
New
hauleth
With OTP 21 and the creation of logger Elixir Logger application became quite limiting (no structured logging). I would like to discuss w...
New
bartblast
I recently started a discussion about reactive patterns in Hologram, but I realized I need to step back and design the composability arch...
New
darkmarmot
At HCA Healthcare (500k employees and contractors), we’re currently experimenting with Elixir for both data integration (to handle parsin...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement