<span style="font-family: Arial; font-size: 13px;"><div>Thanks!  That definitely also works!<br></div><div><br></div><div>Cheers,</div><div>Alex<br></div><br>On 4/18/2018 at 7:25 AM, "Joe Armstrong" <erlang@gmail.com> wrote:<blockquote style="border-left:solid 1px #ccc;margin-left:10px;padding-left:10px;">On Wed, Apr 18, 2018 at 12:18 AM, Alex Alvarez <alex@xbasics.com> wrote:<br>> Thanks Joe!  LOL!!!  Might sound silly, but it's very useful to be able to<br>> load/reload modules manually.  At the very least, it'd be great to at least<br>> get something like {error, module_loaded}, instead of the current "error<br>> report" message<br>><br>> Ok, so, why don't I just enter a <module name>:<function name> and allow the<br>> module to autoload.  That's great for source code, but not that great in the<br>> command line.  The problem is that I, as I suppose most folks, don't know<br>> the function names (or even a function name) in every module, which is why I<br>> tend to manually load them when I'm in Erlang's REPL.<br><br>I have the same problem - so I say<br><br>   > m('modname').<br><br>Which autoloads the module if it's not loaded and prints a list of the<br>functions in the module. After this <TAB> expansion works.<br><br>This has non of the problems you've see with load :-)<br><br>/Joe<br><br><br><br>>  As we know, once a<br>> module is loaded, you can type the module name, press the <TAB> key and get<br>> a list of the function names + arity.  This is very powerful. If you don't<br>> know the exact name of a function, but do know the name of a few modules<br>> where it might be, you can try loading them, pressing <TAB> and see if you<br>> can find it before having to consult the documentation.<br>><br>> Thanks,<br>> Alex<br>><br>><br>><br>> On 4/16/2018 at 9:55 AM, "Joe Armstrong" <erlang@gmail.com> wrote:<br>><br>> I see :-)<br>><br>> But why I ask do you do "l(math)" ?<br>><br>> This loads or reloads a module - but modules are autoloaded on demand<br>> the first time the module<br>> is called, so really there is almost [1] no need to do ever do this.<br>><br>> Cheers<br>><br>> /Joe<br>><br>> [1] there is actually but the use cases are rather obscure<br>><br>><br>><br>><br>> On Mon, Apr 16, 2018 at 4:24 AM, Alex Alvarez <alex@xbasics.com> wrote:<br>>> Thanks for your reply! I can certainly understand that and appreciate the<br>>> system would be letting me know if I was trying to do that. But the issue<br>>> is that I was not trying to load any code of mine with the same module<br>>> name,<br>>> I just tried reloading the same (e.g., math) module.<br>>><br>>> Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:2:2] [ds:2:2:10]<br>>> [async-threads:10] [hipe] [kernel-poll:false]<br>>><br>>> Eshell V9.3 (abort with ^G)<br>>> 1> l(math).<br>>> {module,math}<br>>> 2> l(math).<br>>> {error,sticky_directory}<br>>> 3><br>>> =ERROR REPORT==== 15-Apr-2018::22:09:00 ===<br>>> Can't load module 'math' that resides in sticky dir<br>>><br>>> As mentioned in my last email, the issue seems to be with the fact that<br>>> the<br>>> module was not marked old...<br>>><br>>> 3> code:purge(math).<br>>> false<br>>><br>>> Now, I just thought that c:l() would load and reload any module<br>>> regardless,<br>>> but that doesn't seem to be the case.<br>>><br>>> <a href="http://erlang.org/doc/man/c.html#l-1">http://erlang.org/doc/man/c.html#l-1</a><br>>> <a href="http://erlang.org/doc/man/code.html#purge-1">http://erlang.org/doc/man/code.html#purge-1</a><br>>><br>>> Thanks,<br>>> Alex<br>>><br>>><br>>><br>>> On 4/13/2018 at 4:26 PM, "Joe Armstrong" <erlang@gmail.com> wrote:<br>>><br>>> The module called 'math' is a pre-defined system module, and<br>>> redefining it might have<br>>> unpleasant and unpredictable consequences - so you really should not<br>>> do this unless you<br>>> know exactly what you are doing. Best is to just change the name.<br>>><br>>> If you know what you're doing you can call unstick_dir on the<br>>> directory where math.beam was loaded from<br>>> and then you will be able to change the code - again this is not a<br>>> good idea if you don't<br>>> really understand the consequences of doing this.<br>>><br>>> System modules are 'sticky' by default to stop you from accidentally<br>>> shooting yourself in the foot.<br>>><br>>> If you get this warning just change the module name.<br>>><br>>> Cheers<br>>><br>>> /Joe<br>>><br>>> On Fri, Apr 13, 2018 at 7:13 PM, Alex Alvarez <alex@xbasics.com> wrote:<br>>>> Sorry if this was already asked and I missed it... While using v20.3.2,<br>>>> after I load a module...<br>>>><br>>>> 11> l(math).<br>>>> {module,math}<br>>>><br>>>> ...if I try to reload it again with the same command...<br>>>><br>>>> 12> l(math).<br>>>><br>>>> =ERROR REPORT==== 13-Apr-2018::13:09:15 ===<br>>>> Can't load module 'math' that resides in sticky dir<br>>>> {error,sticky_directory}<br>>>><br>>>> ...I get this error message. It's not particular to any module. From the<br>>>> error, there seems to be a problem with a stcky bit somewhere. Although I<br>>>> don't remember having this problem before, who knows, maybe it's just my<br>>>> install. Has anyone run into this issue recently?<br>>>><br>>>> Thanks,<br>>>> Alex<br>>>><br>>>> _______________________________________________<br>>>> erlang-questions mailing list<br>>>> erlang-questions@erlang.org<br>>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>>>><br>><br>><br>> _______________________________________________<br>> erlang-questions mailing list<br>> erlang-questions@erlang.org<br>> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>></blockquote></span>