On Mon, Jul 6, 2020 at 9:47 AM <kurnia.d....@gmail.com> wrote:
>
> Hi, I don't know if this kind of idea is already discussed before.
>
> I have an idea of adding pure function marker/type on golang, it is just like 
> "constexpr" on C++ or "const fn" on Rust, whether this function is evaluated 
> at compile time if the input is known at compile time is another discussion,
> I don't think this idea is hard to implement
>
> to my understanding, a pure function is a function that doesn't have a side 
> effect, so we can limit pure function to:
> - unable to call non-pure function
> - unable to modify a variable that is not declared on current function (like 
> a global variable)
>
> for this purpose, we can think receiver as input to the function

...

> what do you guys think about this idea?

You didn't really explain what we would gain by adding this to the
language.  It's clearly already possible to write pure functions.  How
does it help to add the ability to explicitly mark a function as pure?

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXOdCc8Zz8mXAmghLm%2B6%3Dvi8S8zG_3Phrv2Hy-w%3Dm70kQ%40mail.gmail.com.

Reply via email to