[erlang-questions] Installing a module from code?
Tue Mar 24 17:52:37 CET 2009
Well it's good to know it isn't my imagination, at least, though it's rather
concerning that this has been known since 2003.
There's actually another looming problem. Package names aren't resolved
correctly during conflict after a boot. My current assumption is that the
only reason they work correctly before a boot is because they're loaded
after compiling into the runtime.
shared() -> "I am a.foo".
unique_a() -> "I am a.foo's unique.".
shared() -> "I am b.foo".
unique_b() -> "I am b.foo's unique.".
shared() -> "I am c.foo".
unique_c() -> "I am c.foo's unique.".
If you compile each of those, they will all work as expected until you
reboot the VM.
"I am a.foo"
"I am b.foo"
"I am c.foo"
After you reboot the VM, you will no longer be able to call any of them
** exception error: undefined function 'a.foo':shared/0
** exception error: undefined function 'b.foo':shared/0
** exception error: undefined function 'c.foo':shared/0
If you pretend there's no namespace, Erlang will clearly expose that the
binary is the last one compiled.
** exception error: undefined function foo:shared/0
=ERROR REPORT==== 24-Mar-2009::10:42:03 ===
beam/beam_load.c(1035): Error loading module foo:
module name in object code is c.foo
I suspect that the problem is that the .beam naming structure doesn't
indicate package structure; x.y.z.quux is stored on disk as quux.beam, which
is ambiguous. The two natural solutions seem to me to be either to make the
/lib directory structure reflect the package structure (which is sensible
given that source is required to do the same) or to make the filenames
something like x.y.z.quux.beam. In both cases, backwards compatability is
slightly broken, in that someone will have to recompile their stuff or
suffer lots of missing errors, but if they're in the middle of upgrading the
VM they probably have to do that anyway (I don't know the toolchain very
well, so for all I know .beams are migrated or something.)
That packages/namespaces can collide in naming kind of defeats the purpose
of packages/namespaces, and makes them relatively dangerous in that they can
apparently take out the standard library.
This really should, IMO, be fixed before r13 stable.
On Tue, Mar 24, 2009 at 1:43 AM, Ulf Wiger
> John Haugeland wrote:
>> My gut instinct is that my namespaced module sc.file is somehow
> > conflicting with the real module file.
> A loong time ago, when I played around with packages, I noticed
> that dotted file names didn't go well with embedded boot code
> loading. It was the erl_prim_loader module, I think.
> Even if you're not using embedded code loading, the kernel
> and stdlib modules are always pre-loaded. I have no idea
> if this issue was ever addressed.
> Ulf W
> Ulf Wiger
> CTO, Erlang Training & Consulting Ltd
GuaranteedVPS.com - bandwidth commitments and root starting from $12.98/mo
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions