> `__schema__` is only a partially-public API.

I believe it is indeed the culprit ; it is displayed as public on the 
website, but "technically" not public.

> For it to show up in documentation and iex, a PR would need to be accepted
> to Ecto that would add a `@doc` attribute to the generated `def 
__schema__(…)` code.

This is a good suggestion - I'll open an issue over there.

Thanks!

-- Thibaut

Le mercredi 6 septembre 2023 à 22:50:01 UTC+2, halos...@gmail.com a écrit :

`__schema__` is only a partially-public API. For it to show up in 
documentation and iex, a PR would need to be accepted to Ecto that would 
add a `@doc` attribute to the generated `def __schema__(…)` code.

I just did the following test, and iex acts exactly as it should:

```
defmodule TestApp do
  def __test__, do: :test
end
```

In iex, `TestApp.<tab>` does not complete.

```
defmodule TestApp do
  @doc "The secret __test__ function"
  def __test__, do: :test
end
```

In iex, `TestApp.<tab>` completes to `TestApp.__test__`.

-a

On Wed, Sep 6, 2023 at 4:02 PM thibaut...@gmail.com <thibaut...@gmail.com> 
wrote:

Hi!

Today during a session I was caught a bit off-guard by the fact that 
completion doesn't tell you about __schema__ on an Ecto module.

(although the behaviour is clearly documented in IEx 
https://github.com/elixir-lang/elixir/blob/1bc8bc5e76e20c6b0180e024e9d280ab5fc0af94/lib/iex/lib/iex.ex#L22-L26
).

I feel this is a bit sad in terms of "discoverability" for newcomers to 
Ecto in that case, since __schema__ is a public API of Ecto (
https://hexdocs.pm/ecto/Ecto.Schema.html#module-reflection).

I wonder if this is an isolated example or if there are more cases that 
could affect newcomers to a given Elixir library, and how we could make 
this more approchable for newcomers?

Let me know what you think!

-- Thibaut


-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/3fbfc0f6-a7f0-4635-b4d1-32f1417d350dn%40googlegroups.com
 
<https://groups.google.com/d/msgid/elixir-lang-core/3fbfc0f6-a7f0-4635-b4d1-32f1417d350dn%40googlegroups.com?utm_medium=email&utm_source=footer>
.



-- 
Austin Ziegler • halos...@gmail.com • aus...@halostatue.ca
http://www.halostatue.ca/http://twitter.com/halostatue

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/57301ec0-dbbe-4cf1-b1dc-65459871b566n%40googlegroups.com.

Reply via email to