This seems like a nice cleanup of a minor blemish. On Wed, Jun 19, 2019 at 3:44 AM Andrea Leopardi <an.leopa...@gmail.com> wrote:
> Well, it's documented, and if the non-bang variant returns the offset I > think users would expect that? > > Tbh to me the benefits (better error, mirroring all other functions) > outweigh the downsides (returning a tuple instead of a datetime like other > functions). > > Andrea Leopardi > an.leopa...@gmail.com > > > On Wed, Jun 19, 2019 at 10:43 AM Fernando Tapia Rico <fertap...@gmail.com> > wrote: > >> Oh! Sorry, I replied too soon, the example contains the offset. >> >> I’m not sure if users would expect just the datetime in the bang version >> :( >> >> >> On Wednesday, June 19, 2019 at 10:40:31 AM UTC+2, Fernando Tapia Rico >> wrote: >> > This has been suggested in the past. For example >> https://github.com/elixir-lang/elixir/pull/6514 >> > >> > The main reason why there is not a bang variant is because the `offset` >> information would be dropped. >> > >> > On Wednesday, June 19, 2019 at 10:13:39 AM UTC+2, Andrea Leopardi wrote: >> > > I can't see a reason why not to add this. I think a PR would be >> welcome! >> > > >> > > >> > > >> > > >> > > >> > > Andrea Leopardi >> > > an.le...@gmail.com >> > > >> > > >> > > >> > > On Mon, Jun 17, 2019 at 4:31 PM Mário Guimarães < >> mario.lui...@gmail.com> wrote: >> > > >> > > The proposed function could be implemented like this >> > > >> > > >> > > >> > > >> > > def from_iso8601!(string, calendar \\ Calendar.ISO) do >> > > case DateTime.from_iso8601(string, calendar) do >> > > {:ok, datetime, offset} -> >> > > {datetime, offset} >> > > >> > > {:error, reason} -> >> > > raise ArgumentError, >> > > "cannot convert #{string} to datetime, reason: >> #{inspect(reason)}" >> > > end >> > > end >> > > >> > > >> > > >> > > >> > > segunda-feira, 17 de Junho de 2019 às 15:18:29 UTC+1, Mário Guimarães >> escreveu: >> > > Hello, >> > > >> > > >> > > all "from_x" functions in DateTime support their throw exception >> version, but the function "from_iso8601/2" which returns an error tuple. >> > > >> > > >> > > Doesn't it make sense, because of convenience and completeness, to >> provide a bang version of this function? >> > > >> > > >> > > See https://hexdocs.pm/elixir/DateTime.html#from_iso8601/2 >> > > >> > > >> > > Thanks >> > > Mário >> > > >> > > >> > > >> > > >> > > -- >> > > >> > > 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-l...@googlegroups.com. >> > > >> > > To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/1b2ea98e-24b0-4829-8943-82ca3add955c%40googlegroups.com >> . >> > > >> > > For more options, visit https://groups.google.com/d/optout. >> >> -- >> 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/dab80e48-9121-41dd-8d19-dc9658096af1%40googlegroups.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAM9Rf%2BJDNy3PztCikgbXnNs_pcecRBKamN-%2Bm8xoPZ_CoFEYwQ%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAM9Rf%2BJDNy3PztCikgbXnNs_pcecRBKamN-%2Bm8xoPZ_CoFEYwQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKwTqE%3DLMpoY9yk8LGMowj7AfAiUnCfW76D-Gu0ABdsH9b8VTw%40mail.gmail.com.