For me, it breaks the semantic of a sigil. I think of a sigil as a text 
representation of data, and your proposal is a text representation of a 
function call. In the end, every sigil triggers a function. But I think 
this should be a pure function.

Aleksei Matiushkin schrieb am Dienstag, 30. März 2021 um 08:54:30 UTC+2:

> Hello,
>
> I often find myself writing `DateTime.truncate(DateTime.utc_now(), 
> :second)` or similar stuff to get to the ‘instance’ of now.
>
> What if we have sigils `~U`, `~D`, and `~T` extended to:
>
> ~U[now] → DateTime.utc_now()
> ~T[now] → Time.utc_now()
> ~D[today] → Date.utc_today() 
>
> with possible modifiers `s` and `m` to truncate times to seconds and 
> milliseconds respectively?
>
> ~U[now]s → DateTime.truncate(DateTime.utc_now(), :second)
>
> Here is the PR with the code for the reference 
> https://github.com/elixir-lang/elixir/pull/10840 (it uses empty sigils 
> instead of ~U[now])
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/42a4b61b-4bae-475f-885b-974881ea0ebbn%40googlegroups.com.

Reply via email to