http://d.puremagic.com/issues/show_bug.cgi?id=7432
--- Comment #15 from Maxim Fomin <ma...@maxim-fomin.ru> 2013-08-18 21:52:09 PDT --- (In reply to comment #11) > > In the absence of any explanation of what pure means applied to variables, I > > can only be assumed that pure cannot be applied to variables, and therefore > > any attempt to apply pure to a variable is supposed to fail with a compile > > error. > > Except that in most cases, an invalid attribute doesn't result in a > compilation > error - it's ignored. The argument for this is generally that it helps generic > code, and it makes it easier to do stuff like > > attribute: > ... > > or > > attribute > { > } > > without caring about the items that it doesn't apply to. For instance, you can > do that with attributes like @safe or @trusted, which have zero effect on > variables and yet have lots of variables declared in that code. The same goes > for pure. > > I don't know what the best way to handle this is given that sometimes it is > useful to have an attribute ignored when it doesn't apply, but it also can be > quite misleading, and the case where a symbol is explicitly marked with an > attribute and then that attribute is ignored is particularly bad. Maybe we > could petition for that particular case to always be an error (which would > cover this bug), but I don't see it changing for attribute: or attribute {}. I > don't see a good argument for > > pure foo = "hello"; > > being legal though unless the argument is that all invalid attributes are > ignored (which is not the case). Perhaps allow to apply storage classes to variables in block declarations like attribute: or attribute { } and ban them in single variable declarations? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------