Child modules draft feedback wanted
Mats Cronqvist
mats.cronqvist@REDACTED
Wed Apr 5 10:08:46 CEST 2006
Richard A. O'Keefe wrote:
> [...]
> This is one of the things that the -export_to(Module, Functions)
> directive I proposed, oh, must have been in 1997, was to have
> accomplished.
this is a nice idea. how would it be enforced?
> "Ulf Wiger \(AL/EAB\)" <ulf.wiger@REDACTED> wrote:
> [...]
> exporting the pseudo function record_info/2 would
> mean that some helper code could be written a lot
> more cleanly.
> [...]
> I see very few disadvantages with doing this,
> as the preprocessor has reserved both the name
> and semantics of the record_info/2 function.
>
> To me it certainly violates the principle of least surprise.
> Here I am writing mod2, and want to use #fred from mod1. And I
> am now allowed to import it from mod1, and I'm allowed to ask
> about it at run time, but I'm not allowed to use it in my source
> code. Is that weird or is that really REALLY confusing or what?
this paragraph is confusing me.
the function mod1:record_info(fred) tells you what mod1 thinks fred looks
like. how is that confusing?
btw, the "helper code" ulf refers to is a tool i wanted to write for the AXD.
the tool would query all modules in the system about what they think various
records looks like, and warn about discrepancies. (in our build system it's
entirely possible that mod1 and mod2 both use #fred, but disagree on its
definition.)
mats
More information about the erlang-questions
mailing list