[Issue 3943] New: "in" function argument is redundant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 12 14:47:12 PST 2010


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

           Summary: "in" function argument is redundant
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-03-12 14:47:11 PST ---
This program seems to show that "in" function arguments are the same as
"const", and "immutable in" are immutable:


import std.stdio: writeln;
void foo1(const int x) {
    writeln(typeid(typeof(x))); // const(int)
}
void foo2(in int x) {
    writeln(typeid(typeof(x))); // const(int)
}
void foo3(immutable in int x) {
    writeln(typeid(typeof(x))); // immutable(int)
}
void main() {
    foo1(1);
    foo2(1);
    foo3(1);
}


So the "in" attribute for function arguments can be removed from the language,
so programmers can use "const", "immutable", etc in a more explicit way.

According to Python Zen: "There should be one-- and preferably only one
--obvious way to do it."

-- 
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