There is nothing we can do unfortunately, without perhaps changing upstream
(i.e. how the Erlang shell system works). The shell reads line by line, and
therefore "a = DB.Resource" is a complete line on its own, which will
therefore evaluate successfully.

On Wed, Nov 24, 2021 at 5:34 PM thibaut...@gmail.com <
thibaut.barr...@gmail.com> wrote:

> Hello,
>
> A coworker (new to Elixir) was quite surprised today when pasting this
> code into IEx:
>
> import Ecto.Query a = DB.Resource |> where([r], not is_nil(r.datagouv_id))
> |> group_by([r], r.datagouv_id) |> having([r], count(r.datagouv_id) > 1) |>
> select([r], r.datagouv_id) |> DB.Repo.all()
>
> Evaluating "a" afterwards here gives an answer that surprised him:
> DB.Resource (yet the IEx evaluation shows the list of selected binaries,
> which is even more surprising).
>
> I realise work has been done to make pasting multilines statements in IEx
> better (
> https://hexdocs.pm/iex/1.12.2/IEx.html#module-pasting-multiline-expressions-into-iex),
> yet I feel this breaks the POLS quite a bit, and wanted to report it back.
>
> There are fixes to that (e.g. finishing lines by |>) but I feel it is very
> unnatural and far away from Elixir snippets you'll find online.
>
> Do you think it is worth opening an issue for IEx here?
>
> Cheers,
>
> -- 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-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/f216f8cf-e786-4279-9619-559ca0a00977n%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/f216f8cf-e786-4279-9619-559ca0a00977n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAGnRm4K-tB%3Dg1CFu1wbWzY%3D1iS7hU9UepWBaNbfg7ztzDTbGHA%40mail.gmail.com.

Reply via email to