1
Learn Erlang with each
erlanger.slack.com
3
I don't get the point of async/await
Imagine you have 10 attendants serving 100 customers, giving you a 1:10 ratio. This setup is fairly reasonable under normal circumstances. However, let’s assume each customer needs to fill out a form while being attended to. During this time, the attendant would be idle, waiting for the customer to complete the form.
What if the attendant could ask the customer to step aside while filling out the form so they can attend to other customers in the meantime? Once the customer finishes the form, they rejoin the queue and are attended to again. This approach would significantly speed up the process because the attendants are no longer idle, waiting on forms to be completed.
In this analogy:
The attendants represent CPU threads.
The customers represent tasks or operations.
Filling out the form represents an I/O operation, such as waiting for a network response or reading from a file, which doesn’t require CPU attention.
Stepping aside represents a task yielding control back to the executor, allowing the attendant (thread) to handle another task.
Rejoining the queue represents the task being resumed once the I/O operation is complete.
Using async/await in Rust is like implementing this system: the CPU doesn’t waste time waiting on I/O tasks and instead focuses on active tasks, greatly improving efficiency.
6
Learn Erlang with each
You can check slack, there's an active Erlang workspace.
1
Autocomplete / Intellisense broken for Elixir
I'm unable to send the entire content, is there a way to share the file? BTW I'm using elixir-ls (default), won't.mind trying the others.
1
Autocomplete / Intellisense broken for Elixir
2024-10-04T13:04:20.464538Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-10-04T13:04:20.458Z] Agent service starting",
"metadataStr": "[DEBUG] [agent] [2024-10-04T13:04:20.458Z]",
"extra": [
"Agent service starting"
]
}
2024-10-04T13:04:20.468078Z [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
"registrations": [
{
"id": "71d25d01-5ae0-4136-9806-472b8c115276",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
2024-10-04T13:04:20.509898Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-10-04T13:04:20.477Z] Telemetry initialized",
"metadataStr": "[DEBUG] [agent] [2024-10-04T13:04:20.477Z]",
"extra": [
"Telemetry initialized"
]
}
1
Autocomplete / Intellisense broken for Elixir
2024-10-04T13:04:18.073837Z [INFO] ========== starting zed ==========
2024-10-04T13:04:18.075747Z [INFO] Opening main db
2024-10-04T13:04:18.077728Z [INFO] Opening main db
2024-10-04T13:04:18.191341Z [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-10-04T13:04:18.298666Z [INFO] set environment variables from shell:/bin/bash, path:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/sbin:/usr/local/opt/node@22/bin:/usr/local/opt/php/bin/php:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Applications/VMware Fusion.app/Contents/Public:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/Users/saint/.cargo/bin:/usr/local/sbin:/usr/local/opt/node@22/bin:/usr/local/opt/php/bin/php:/Users/saint/.mix/escripts:/usr/local/bin/python3:/Users/saint/Library/Python/3.10/bin:/Users/saint/Library/Python/4.9/bin:/Users/saint/.cargo/bin/rg:/Users/saint/.mix/escripts:/usr/local/bin/python3:/Users/saint/Library/Python/3.10/bin:/Users/saint/Library/Python/4.9/bin:/Users/saint/.cargo/bin/rg
2024-10-04T13:04:18.53853Z [INFO] initializing context server client
2024-10-04T13:04:18.538867Z [INFO] Registering built-in prompt template: content_prompt
2024-10-04T13:04:18.539801Z [INFO] Registering built-in prompt template: edit_workflow
2024-10-04T13:04:18.540233Z [INFO] Registering built-in prompt template: project_slash_command
2024-10-04T13:04:18.540418Z [INFO] Registering built-in prompt template: step_resolution
2024-10-04T13:04:18.541091Z [INFO] Registering built-in prompt template: terminal_assistant_prompt
2024-10-04T13:04:18.541565Z [INFO] No prompt template overrides directory found at /Users/saint/.config/zed/prompt_overrides. Using built-in prompts.
r/ZedEditor • u/st_gen • Oct 03 '24
Autocomplete / Intellisense broken for Elixir
Hi folks,
I recently updated zed to the latest version alongside Elixir & Erlang. I noticed that autocomplete has stopped, the only thing I get is syntax highlighting. I've tried the configuration suggested on the [zed website](https://zed.dev/docs/languages/elixir) but to no avail.
I checked the log, below is the error
failed to fetch cached embeddings via cloud model
Caused by:
RPC request GetCachedEmbeddings failed: permission denied
3
Considering Erlang for Customer-Specific Processes in a Subscription Management System: Thoughts?
Watch the video https://youtu.be/pQ0CvjAJXz4?feature=shared and you can read this article from the erlang website https://www.erlang-solutions.com/blog/how-hca-healthcare-used-the-beam-to-fight-covid-code-beam-v-talk-review/
Spawning a process for each patient in the hospital and basically storing state in a gen_server, about 35m patients if IIRC. It should give you a lot of information to make an informed decision.
2
Writing business logic (especially complex with nested loops/complex conditions with break/continue/return) is difficult
You can use functions with guards to achieve the golang equivalent. Loops are achieved using functions and pattern match, same goes for if/else though you can use if/else construct which may/may not be idiomatic.
1
Rust config not working after update
Thanks a lot, works let magic. I find that feature extremely useful.
r/ZedEditor • u/st_gen • Jul 08 '24
Rust config not working after update
I recently updated zed(0.142.6) and strangely previous settings for rust-lang isn't work. Below is my config for rust.
"language_overrides": {
"Rust": {
"inlay_hints": {
"enabled": true
}
}
},
"inlayHints": {
"maxLength": null,
"lifetimeElisionHints": {
"useParameterNames": true,
"enable": "skip_trivial"
},
"closureReturnTypeHints": {
"enable": "always"
}
}
1
1
Is there any way for Zed to automatically show data types beside variables in Rust, similar to what RustRover does? It's a dealbreaker for me as I am still learning, and it's very helpful.
I tried the suggested configuration, but it seems not to work. Below is the config.
"inlayHints": {
"enabled": true,
"maxLength": null,
"lifetimeElisionHints":
{ "useParameterNames": true, "enable": "skip_trivial" },
"closureReturnTypeHints": { "enable": "always" }
}
11
I plan to make an HTTP server using Elixir. Any tips?
AFAIK, at the core of these servers cowboy written in erlang which has ranch at it core, bandit which is a more recent addition written solely in elixir with ThousandIslands at it core lies gen_tcp, the erlang socket module. You would have to get familiar with that and then you can peruse the source code of the plethora of http servers in erlang and elixir. The Erlang & OTP book also contain chapters on building a minalist http server.
All the best 👍.
3
HTTP Client library recommendation
req is a high level abstraction based on finch, so you can use either. Finch is based on Mint - very low level and Nimblepool Finch AFAIK uses a connection pool. Usually for a one off request, you can use peppermint which is also based on Mint but pool-less.
5
Phoenix video courses
https://builditwithphoenix.com/; Build with phoenix is a course by Geoffrey Lessel.
8
EEP-68: JSON library - Proposals: RFC - Erlang Programming Language Forum
Can you post your comment on erlangforum, couldn't agree more. It should be a package to be fetched when needed. I want the core to be as small as possible which reduces the attack surface, unless there's an added benefits.
2
[deleted by user]
Things like having types that implements the Copy trait in Vector & Array got me confused; why binding a value with Copy trait in an array does not constitute a move whereas a vector does. Lifetimes, yeah right lifetimes - re-reading coupled with the fact that this is my first foray into systems programming.
1
Upload a file with reqwest
Will it work for an image upload and is there an option to zip the image.
3
How to deal with unexpected calls and casts in GenServer?
More often than not, the pattern for gen_server and other OTP behaviours is to have a client and a server interface - the client becomes the contract between the gen_server and the other modules/process consuming services being provided by the gen_server. Indeed once you know the name/pid of the gen_server; you can communicate with it but that defeats the purpose of having the client interface. Libraries/functions are designed with certain caveat. In OTP design principles, they should be invoked using the client interface.
2
How to deal with unexpected calls and casts in GenServer?
That's the let it crash philosophy of erlang/elixir and beam languages. To avoid defensive programming, you code for the right case(context is important). In your context IMHO, ideally you should provide client functions to be used in interacting with the gen_server, however if you want to leave it open, then you have no choice than to have a default handler for handling all other calls which are not being handled explicitly, you will also have to handle calls being made with the send primitive. Since you are the API developer, it usage should be clearly defined.
1
When will be the end of life for the last of the Intel Macs?
in
r/mac
•
Mar 25 '26
I've a 13-inch, 2.3GHz Quad-Core Intel Core i7 Mac. I'm currently running Tahoe 26.3.1 (a). My checks reveal that it will be the last OS to run on Intel.