[Issue 7724] 'final:' causes error if any variable declarations are placed between it and the end of its scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 24 13:50:21 PDT 2012


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



--- Comment #17 from Stewart Gordon <smjg at iname.com> 2012-04-24 13:51:22 PDT ---
(In reply to comment #15)
> 'final' in Java for a variable means it is assigned once in the constructor,
> and never again. The equivalent is achieved in D using 'const' and not
> supplying an initializer.
> 
> 'final' in D1 has similar semantics to Java.

I can't see it anywhere in the D1 docs as anything other than an attribute
applied to methods to prevent them being overridden.  I had made out that
Java's meaning of final on fields just didn't exist in D, what with D having
const for things like that.

Moreover, given that "final" was overloaded to denote two very different
attributes, it would seem silly that a single use of the word could apply both
these attributes.  But if people actually did 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