> > The module attribute option uses an imperative, global state approach that > feels like the equivalent of this > Imperative but not global. It can be persisted later on and made global as read-only but during definition it can only be effectively changed by the current module or entities called in the same process by the current module using the module name as reference.
To make things more precise, the code example you pasted: > String.split_options(parts: 3)String.split("1,2,3,4", ",") > > As a module attribute would be written rather as: > String.split_options(__MODULE__, parts: 3) > String.split(__MODULE__, "1,2,3,4", ",") > > I.e. you cannot change it globally, you can only change it for the current module in the process that is defining the module itself. It is imperative though as it relies on side-effects. Although almost everything we do at the module body is a side-effect: defining functions, defining attributes, the module definition itself, etc. -- 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/CAGnRm4KR6pehD3dcaBQZeY%2BwS5AiQiqa79%2B25r6VY9ZFm%3DfRZQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.