I would like to avoid the maybe_ prefixes. In my mind, I would use "maybe_
" for returning {:ok, ...} | {:error, _} or similar.

Furthermore, although we may use maybe_ internally, we don't use the maybe_
prefix in any of the public functions. So I would be very careful before
setting a new naming convention, as establishing the wrong convention can
be harmful in the long term. The other suggestions, run_if/update_if sound
more plausible in my opinion.

On Mon, Jun 8, 2020 at 1:29 PM Bruce Tate <br...@grox.io> wrote:

> Map.maybe_put then... that works well for me.
>
> I love the way maybe_ style functions compose. It makes a
> tremendous difference to the end product.
>
> -bt
>
> On Mon, Jun 8, 2020 at 5:20 AM Riccardo Binetti <rb...@gmx.com> wrote:
>
>> If we also want to have a function in the Map module I think that the
>> verb should be put, not update (since the operation described in my
>> first post is effectively a put operation), so eitherx put_if or
>> maybe_put.
>>
>> Regarding the proposed Kernel macro, it seems to me that it can be used
>> in a more general sense and not only for updating collections (the first
>> argument can effectively be anything), so I like the run verb. It could
>> also be apply_if.
>>
>> In both cases I personally I find the _if suffix more expressive than
>> the maybe_ prefix, in my opinion this
>>
>> |> run_if(x == 1, some_fun)
>>
>> reads more naturally and better conveys the role of the arguments than
>>
>> |> maybe_run(x == 1, some_fun)
>>
>> --
>> Riccardo
>>
>> On Monday, June 8, 2020 at 2:57:32 AM UTC+2, Bruce Tate wrote:
>>
>>> I like the idea as well. And I like the name maybe_update.
>>>
>>> -bt
>>>
>> --
>> 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/12633886-f5ce-4b9f-b27c-b0871b472554o%40googlegroups.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/12633886-f5ce-4b9f-b27c-b0871b472554o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
> Regards,
> Bruce Tate
> CEO
>
>
> <https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>
>
> Groxio, LLC.
> 512.799.9366
> br...@grox.io
> grox.io
>
> --
> 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/CAFXvW-6MeEPPFKGG6%2B%3DuJryEESik3oWNBEGZ8E%2BYwjkUvhtVkw%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6MeEPPFKGG6%2B%3DuJryEESik3oWNBEGZ8E%2BYwjkUvhtVkw%40mail.gmail.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%2Bvuj5pp5gRQHara-SJ7peZRnA_3T6qaM32O4CWbnqRg%40mail.gmail.com.

Reply via email to