Thread overview | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 03, 2012 [Issue 7432] New: dmd allows pure variables and treats pure like auto | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7432 Summary: dmd allows pure variables and treats pure like auto Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: jmdavisProg@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-02-03 14:58:27 PST --- This compiles: void main() { pure foo = "hello"; } It should be illegal. Variables can't be pure. Even worse, pure here is treated as if it were auto. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 12, 2012 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 Stewart Gordon <smjg@iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |smjg@iname.com Summary|dmd allows pure variables |DMD allows variables to be |and treats pure like auto |declared as pure --- Comment #1 from Stewart Gordon <smjg@iname.com> 2012-02-12 11:42:21 PST --- It isn't pure that is treated as auto. What's treated as auto is the presence of any attribute (to turn it from an ExpressionStatement into a DeclarationStatement) combined with the absence of a type. But otherwise yes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 27, 2012 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-26 17:22:02 PDT --- The problem is there can be a pure block such as this one in object.di: class TypeInfo_Struct : TypeInfo { @safe pure nothrow { uint function(in void*) xtoHash; bool function(in void*, in void*) xopEquals; int function(in void*, in void*) xopCmp; string function(in void*) xtoString; uint m_flags; // << problem } } I don't know whether the front-end makes any difference between declarations in attribute blocks and those who have a direct attribute in one statement. If not, it's probably not fixable without breaking code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 27, 2012 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #3 from bearophile_hugs@eml.cc 2012-10-26 17:42:12 PDT --- (In reply to comment #2) > I don't know whether the front-end makes any difference between declarations in attribute blocks and those who have a direct attribute in one statement. If not, it's probably not fixable without breaking code. Moving the variable out of that block should be harmless :-) Automatic testing is there for similar purposes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 27, 2012 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 --- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-26 17:43:00 PDT --- (In reply to comment #3) > (In reply to comment #2) > > > I don't know whether the front-end makes any difference between declarations in attribute blocks and those who have a direct attribute in one statement. If not, it's probably not fixable without breaking code. > > Moving the variable out of that block should be harmless :-) Automatic testing is there for similar purposes. Yes but there's no telling how much more code it would break. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 27, 2012 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 --- Comment #5 from Stewart Gordon <smjg@iname.com> 2012-10-27 08:56:07 PDT --- (In reply to comment #2) > The problem is there can be a pure block such as this one in object.di: <snip> > I don't know whether the front-end makes any difference between declarations in attribute blocks and those who have a direct attribute in one statement. If not, it's probably not fixable without breaking code. Of course it's fixable - by changing it so that the front-end does make this difference. See the long-debated issue 3118. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 17, 2013 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 Maxim Fomin <maxim@maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim@maxim-fomin.ru --- Comment #6 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-08-17 10:44:23 PDT --- This is a feature of D - in general case any attribute is legal (except those for which there are arbitrary checks and rejections) and auto can be replaced by other attributes to launch type inference. Since pure is harmless here I think this is resolved-wontfix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 17, 2013 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 Temtaime <temtaime@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |temtaime@gmail.com --- Comment #7 from Temtaime <temtaime@gmail.com> 2013-08-17 12:36:11 PDT --- Pure variables it's strange. D is young lang so i think it's welcome to fix the bugs and change behavior even with breaking the code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 18, 2013 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 --- Comment #8 from Stewart Gordon <smjg@iname.com> 2013-08-18 09:24:53 PDT --- (In reply to comment #6) > This is a feature of D According to which bit of the spec? > - in general case any attribute is legal (except those for which there are arbitrary checks and rejections) and auto can be replaced by other attributes to launch type inference. Since pure is harmless here I think this is resolved-wontfix. Maybe, but it doesn't seem to me to make much sense. If it's intended behaviour, this needs to be stated in the spec. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 18, 2013 [Issue 7432] DMD allows variables to be declared as pure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7432 --- Comment #9 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-08-18 09:35:09 PDT --- (In reply to comment #8) > (In reply to comment #6) > > This is a feature of D > > According to which bit of the spec? > > > - in general case any attribute is legal (except those for which there are arbitrary checks and rejections) and auto can be replaced by other attributes to launch type inference. Since pure is harmless here I think this is resolved-wontfix. > > Maybe, but it doesn't seem to me to make much sense. If it's intended behaviour, this needs to be stated in the spec. Decl: StorageClasses Decl StorageClasses: StorageClass StorageClass StorageClasses StorageClass: abstract auto TypeCtor deprecated enum extern final nothrow override pure __gshared Property scope static synchronized from Declaration page. Am not telling that pure variables make much sense (I tried to clarity relation between auto and type inference), the problem is follows: 1) pure int foo; is legal by spec and grammar 2) Despite of 1) dmd arbitrary rejects some wired combinations, sometimes not. 3) There are other issues in Bugzilla like "storage class X is accepted in context Y" (but don't ask which numbers, I don't remember them now). So, situation is totally sporadic right now and it needs comprehensive solution. Adding one check to ban pure in variable declaration is not a solution to the problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation