digitalmars.D.bugs - [Issue 5715] New: Contradiction in spec: meaning of variable.init
- d-bugmail puremagic.com (43/43) Mar 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5715
- d-bugmail puremagic.com (14/14) Jan 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5715
http://d.puremagic.com/issues/show_bug.cgi?id=5715 Summary: Contradiction in spec: meaning of variable.init Product: D Version: D1 & D2 Platform: All URL: http://www.digitalmars.com/d/1.0/property.html#init OS/Version: All Status: NEW Keywords: spec Severity: normal Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: smjg iname.com Blocks: 677 --- Comment #0 from Stewart Gordon <smjg iname.com> 2011-03-07 06:58:04 PST --- "If applied to a variable or field, it is the default initializer for that variable or field. For example: int a; int b = 1; typedef int t = 2; t c; t d = cast(t)3; int.init // is 0 a.init // is 0 b.init // is 0 t.init // is 2 c.init // is 2 d.init // is 2" According to the prose, b.init == 1. But this claims it is 0. Similarly with d. I recall the semantics being changed at some point from the initial value of the variable to that of its type. This matches the examples, but not what the statement actually says. Possible rewrite of that paragraph: ".init produces a constant expression that is the default initializer. If applied to a type, it is the default initializer for that type. If applied to a variable, it is the default initializer for the variable's type. If applied to a field, it is the default initializer for that field. For example:" Moreover, is the meaning for a field meant to apply only to type.field constructions, or to object.field constructions as well? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5715 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-01-19 11:08:33 PST --- Changed to: If applied to a variable or field, it is the default initializer for that variable or field's type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 19 2012