Le 2010-08-12 à 4:37, dsource.org a écrit :

> phobos commit, revision 1837
> 
> 
> user: Don Clugston
> 
> msg:
> Some functions need to be public. Revealed by patch to bug 314.
> 
> http://www.dsource.org/projects/phobos/changeset/1837

>From the changelog:

---
public // These functions are accessed by mixed-in code
{
        import std.c.stdlib : calloc, realloc, free;
        import core.exception : onOutOfMemoryError;
}
---

Is it reasonable to have to import publicly everything you need for every mixin 
in every module? Won't this pollute the global namespace? And won't this break 
a selective import like this one?

---
import std.signal : Signal;
---

Perhaps import could be added directly in the template instead:

---
template Signal(T1...)
{
        import std.c.stdlib : calloc, realloc, free;
        import core.exception : onOutOfMemoryError;
        ...
}
---

This is a working but undocumented feature (perhaps it's an accident that it 
works), see:
<http://d.puremagic.com/issues/show_bug.cgi?id=2179>

>From my limited testing however, it seems that this import always import the 
>symbols publicly. :-(

-- 
Michel Fortin
[email protected]
http://michelf.com/



_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to