vic
Asdf Core Team
Yep, yet another library for function decorators in Elixir. This one however, is smaller and simple
defp is_authorized(decorated, conn, params) do
if conn.assigns.user do
decorated.(conn, params)
else
conn
|> send_resp(401, "unauthorized")
|> halt()
end
end
deco {Deco.around(is_authorized)} in
def create(conn, params) do
...
end
Trending in Announcing
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Other Trending Topics
Testing Concurrency and Fault Tolerance in Elixir/Nerves - Marta Habdas | ElixirConf EU 2026
Comments welcome! View the <...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
I like this trick of linking with
inhere! I wonder how the formatter formats that though, hmm…Testing…
Aww that’s sad, and no way to fix the formatter for this either currently…
tmbb
Very cool
Not in the sense thatbI’d ever use it, but in the sence that it makes me want to use it, even though I probably shouldn’t…
I’ve written a similar thing, which I’ve named
Doktor. It’s like you regular old Doc, but younger, cooler and more radiKal. Because it had a K. It allows you to write this:Basically,
) file annotated in a special way and, extracts docstrings from that file and documents the functions with those docstrings. This kan help deKlutter your modules, because it moves the doKstrings somewhere else. I’m still not sure on how useful this is (or whether it is even a good thing at all), but it’s just so KOOL xD
Doktortakes up an Markdown (MD -The way it works is by overwriting the
@operator inside theusemacro so that it treats the@dok,@moduledokand @typedok` In a special way. Although it’s completely different, it reminded me of this somehow.vic
haha you got me, I’m always looking at what things I’m able to do with the Elixir syntax, and yeah, the formatter doesnt like it that much, maybe
incould be treated just likedoand allow a new line after it.Hey Doktor looks awesome, I’ve been using just
@moduledoc File.read!("README.md")but your tool looks nice. One thing I’ve noticed while running tests from an .md file is, I need to modify the .ex file importing it for the new tests to take place, otherwise it’s already compiled with no changes. How you’d handle that in doktor.tmbb
You can use this module attribute: Module — Elixir v1.20.2
In the case of Doktor, because I’m doing funny things in the
usemacro (like overwriting@/1) I can add the attribute automatically (I’m not doing it yet, but I can add it), but you’ll have to add it manually with your approach. Mix will recompile your module each time the external file changes. People should always use this attribute when their modules depend on an external file.In your case, it’s just a question of:
But are you serious about Doktor? Would you use this? xD
I’m not sure I like overwriting the
@/1operator that much, even though it looks nice, because it reuses the familiar pattern of documenting a function or a module. I haven’t released it now because the current implementation is very inefficient. I parse the file everytime I want to document a function. I should start an Agent when the module is compiled, gather all documentation snippets into the agent, have my modified@/1macro retrieve the docstrings from the agent and kill it after compilation. Compilation of a module is probably done by the same process (I haven’t checked), so this will not be a bottleneck.Maybe Docktor should use normal functions like
But last time I tried this there were some small problems of things not being defined before other things. I have to try again. And I do like writing
@dok…tmbb
I’ve released Doktor (not public on hex yet, or maybe ever): Doktor: extract docs from external files
It now has a much better design. It still doesn’t use the
@external_resourcething. I should add it…