[Issue 8752] Unsafe use of T.init should be allowed in @system function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 16 17:35:38 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8752


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-12-16 17:35:37 PST ---
Given that using init is _almost_ always safe and that functions are @system by
default, I don't know how good an idea this is. It will be _really_ easy for
someone to use T.init with @disable, not realizing what they're doing. If @safe
were the default, then maybe, but this just seems too dangerous to me. I could
see an argument for always being able to use T.init in template constraints and
the like, but it seems to me like it's going too far to allow @disabled init's
to work in @system code. And depending, allowing T.init in template constraints
and other metaprogramming poses its own risk, because while T.init often used
to determine stuff about a type without actually using T.init in the code,
there's no way to know whether the purpose of the test is to test something
about T by using T.init or if the purpose is to test whether T.init itself
actually works in they way that the constraint is testing for. So, I'm inclined
to think that we need another solution for this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list