Yes, but there is a limitation because the anonymous function have to be defined before its invocation, being less readable that scoped functions, in my view :)
On Wednesday, August 2, 2017 at 11:23:40 AM UTC+2, Andrea Leopardi wrote: > > You can achieve this today by using anonymous functions and calling them > if you do not want to use a defp. > > On Wed, 2 Aug 2017 at 09:03, <[email protected] <javascript:>> wrote: > >> I don't know what would be the cost of it during compilation time or how >> difficult would be to implement it, but at first sight I think it could be >> a nice idea to allow defining functions inside other function bodies. Just >> like in Scala (https://www.scala-lang.org/old/node/116.html), nested >> functions would be in scope only for parent functions. >> >> I think it would improve readability to be able to encapsulate those "def >> do_work" functions within its related "def work" function. Maybe, to avoid >> crazy things, we could limit the allowed nesting deep to just 2. >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/5c89cded-89a6-4ea5-befd-039d391c879b%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/5c89cded-89a6-4ea5-befd-039d391c879b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > > Andrea Leopardi > [email protected] <javascript:> > -- 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/04011c6a-60ba-4691-902a-5a75ead755cc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
