paseg
Hi
When I use @behaviour and @callback, the functions are defined. I guess that I do not need to use @spec for the implementation of the @impl functions as well?
Will Dialyzer sort this out as well?
Br Patrik
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 17 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
yatender-oktalk
Thank you for the discussion everyone!
it helped me really to read the different perspectives and make decisions.
Eiji
Honestly I do not remember … However what you wrote is no longer an
Elixircore part, butex_doclibrary.I have created bug report:
shahryarjb
If it works like this, we can just put an empty
@doc ""to fix the bug concerned, but this feature even is not linked on document after generating just we can see the link oniexAm I right?
Eiji
As far as I know we do not have any copy-paste documentation mechanism in
Elixirwhich is good as you may want to have it’s own custom documentation here and for further details you should see delegated documentation …shahryarjb
When I deleted
@callbackit just shows this not full document, it doesn’t show full doc?Eiji
Looks like a bug. When
@callbackis useddelegate_tooption seems to be ignored …shahryarjb
Hi, I want to use
@doc delegate_to:of a macro, but it doesn’t show me the doc I needmy macro and its doc
and my function that needs to use
delegate doc:when I run
h, it just shows me@callbacklike this, not the doc I needEiji
For sure if you have different
@specfor specific implementation than@callbackthen you should use@spec. It’s important to let other knows that you will not meet exactly all cases expected by@behaviour. Otherwise I suggest delegating to callback documentation as I have mentioned previously. Fordialyzerit’s ok probably because both arguments and return value match@callbackspecification - only small part, but matches.paseg
Hi
Wow, thanks for all comments! Did not know that this would stir up this many opinions.
A see your point @asummers, but since this is not a public library (“only” used within our company), I prefer that the implementers spend the extra time to go into the definition of the behaviour rather than using multiple specs that will effect the maintenance in the long run.
I also found that the
@specmay state less than the actual@callbackwithout Dialyzer telling me, witch gives me another argument not to use the @specs…Example given:
Dialyzer signals this is ok, and I guess it is since the actual implementation fits within the original specification. In this case, the
@specmakes sense since this implementation is not the same as the@callbackstated, but if they are expected to be the same then adding an extra@specjust creates more maintenance burden.Eiji
GenServeris not good example here is it’s most probably intended to not add@docand@specto those functions. Anyway I can see what you are talking about. For sure adding@doc falsewhen you really expect documentation is really bad, but@doc delegate_tois still ok hereMore … for this use case when most of projects don’t even document those functions it could be nice to properly link them to
GenServerdocumentation page. I believe that core team does not wanted to add extra documentation for every module which uses GenServer as reading documentation could be a bit harder due to more documentation.I have similar feeling to
HTTPoison. Omitting that you are linking to deprecated function we can still use@doc delegate_toin such case without any problem.ok, so for me it’s even not an option to consider
Personally I don’t like be forced to something. I’m like
Erlang/Elixir- I can fail as much as I need. No matter how much times - sooner or later I would be better. If I would be limited in order to protect myself then I’m not going to make fails and learn on them. Look thatElixiris written to be as much extensible as possible.The goal here is to introduce well known standards (just like adding optional
@specsupport), but not force them. Imagine what would happen if suddenly allhexlibraries would fail, because@specwould be required for all functions. Look that@speceverywhere would be like a dream for readers, but also huge pain for maintainers.Sooner or later you would get an edge-case. There is no rule in world to cover all cases, so forcing anything is never a good idea. It’s why
phoenixis not called aframework, butlibrary.You have lots of cases when you need to take a look at other modules to understand code properly especially in cases like
GenServer. You just need to remind from time to timehandle_call,handle_castandhandle_info.Personally I think that delegating documentation is much better, because same documentation and spec does not need to be written multiple times. Of course we do not see it in such simple examples.
Simply compare:
which is never going to change with copy-paste long specifications especially with map (optional and required keys).
There is no even need to imagine long map specification. Just look at really simple
init/1specification:https://github.com/elixir-lang/elixir/blob/0a81b278619324e088641abe9d486dca8a6510b5/lib/elixir/lib/gen_server.ex#L447
You would have few extra lines for each implementation’s function just to not make one click on
HTMLpage and it’s not even middle size of typical real world specification..