digitalmars.D - Cannot Instantiate Immutable or Constant Structure Variable
- Loopback (11/11) Jul 05 2011 Hello!
- Jose Armando Garcia (6/17) Jul 05 2011 First, you should always try to simplify the problem when asking for =20
- Loopback (12/16) Jul 05 2011 That's understandable indeed, though I haven't been able to distinguish
- Jens Mueller (4/11) Jul 05 2011 You may give DustMite a try. Maybe it can reduce it for you.
- Loopback (31/42) Jul 06 2011 Thank you for the link! It was very useful.
- Don (3/26) Jul 06 2011 It's a compiler CTFE bug, which has been fixed in the latest beta
- Loopback (4/6) Jul 06 2011 I am in dire need for the beta release then I guess. Is it any mature,
- Jonathan M Davis (6/13) Jul 06 2011 If you want to try out dmd beta's then sign up for the dmd-beta list. Th...
- Jason House (4/11) Jul 06 2011 Dmd and Phobos sources are on gitgub. The beta mailing list is dmd-beta@...
Hello! Since I haven't received an answer for several days at the "learn" newsgroup I was wondering if this was an error related to D or just a hard nut to crack. The unittest in this code is not compile-able, whereas the compiler complains saying that the expression cannot be evaluated at compile time (the constructor). http://pastebin.com/CBJE24h1 I'm sorry if I seem impatient about creating a thread here, but my development have come to a full halt because of this (seamlessly) small problem.
Jul 05 2011
First, you should always try to simplify the problem when asking for =20 help. Not many people want to read a lot of code to find the issue. Second, I just glanced at the code and couldn't find a constructor =20 that takes 3 arguments (floats). Em 05/07/2011, =C3=A0s 23:27, Loopback <elliott.darfink gmail.com> = escreveu:Hello! Since I haven't received an answer for several days at the "learn" newsgroup I was wondering if this was an error related to D or just a hard nut to crack. The unittest in this code is not compile-able, whereas the compiler complains saying that the expression cannot be evaluated at compile time (the constructor). http://pastebin.com/CBJE24h1 I'm sorry if I seem impatient about creating a thread here, but my development have come to a full halt because of this (seamlessly) small problem.
Jul 05 2011
On 2011-07-06 04:39, Jose Armando Garcia wrote:First, you should always try to simplify the problem when asking for help. Not many people want to read a lot of code to find the issue.That's understandable indeed, though I haven't been able to distinguish what's the exact property of the structure that is causing this error, otherwise I would have gladly used a short sample.Secondly, I just glanced at the code and couldn't find a constructor that takes 3 arguments (floats).How facile of me to forget. I've accidentally used the constructor of a nearly identic structure except that there is also an Z-axis (3d Vector). The two structures are practically the same except that one takes an additional parameter in the constructor (z-axis). The problem though, lies within both of these structures (presumably because they are so similar). None of them can be declared const or immutable. So do please ignore the last parameter.
Jul 05 2011
Loopback wrote:On 2011-07-06 04:39, Jose Armando Garcia wrote:You may give DustMite a try. Maybe it can reduce it for you. https://github.com/CyberShadow/DustMite/wiki JensFirst, you should always try to simplify the problem when asking for help. Not many people want to read a lot of code to find the issue.That's understandable indeed, though I haven't been able to distinguish what's the exact property of the structure that is causing this error, otherwise I would have gladly used a short sample.
Jul 05 2011
On 2011-07-06 08:20, Jens Mueller wrote:Loopback wrote:Thank you for the link! It was very useful. I've stripped lots of code and now, it seems too simple to not be able to figure out where the problem lies. I've always thought the error was related to templates, but as I said; it was much more simple. Perhaps the problem is obvious for those experienced in D but I am still a rookie. I've also searched for a solution but I have found none. struct DVector2 { float x, y; this(float x, float y) { this.x = x; this.y = y; } } void main(string[] args) { // Creating This Vector Fails // 'Error: cannot evaluate __ctmp3.this(0F, 1F) at compile time' static immutable DVector2 _test = DVector2(0f, 1f); // Same with variable within class C c = new C; } class C { // This code fails as well, with the same error immutable DVector2 _test = DVector2(0f, 1f); }On 2011-07-06 04:39, Jose Armando Garcia wrote:You may give DustMite a try. Maybe it can reduce it for you. https://github.com/CyberShadow/DustMite/wiki JensFirst, you should always try to simplify the problem when asking for help. Not many people want to read a lot of code to find the issue.That's understandable indeed, though I haven't been able to distinguish what's the exact property of the structure that is causing this error, otherwise I would have gladly used a short sample.
Jul 06 2011
Loopback wrote:On 2011-07-06 08:20, Jens Mueller wrote:It's a compiler CTFE bug, which has been fixed in the latest beta release (2.054).Loopback wrote:Thank you for the link! It was very useful. I've stripped lots of code and now, it seems too simple to not be able to figure out where the problem lies. I've always thought the error was related to templates, but as I said; it was much more simple. Perhaps the problem is obvious for those experienced in D but I am still a rookie. I've also searched for a solution but I have found none.On 2011-07-06 04:39, Jose Armando Garcia wrote:You may give DustMite a try. Maybe it can reduce it for you. https://github.com/CyberShadow/DustMite/wiki JensFirst, you should always try to simplify the problem when asking for help. Not many people want to read a lot of code to find the issue.That's understandable indeed, though I haven't been able to distinguish what's the exact property of the structure that is causing this error, otherwise I would have gladly used a short sample.
Jul 06 2011
On 2011-07-06 16:56, Don wrote:It's a compiler CTFE bug, which has been fixed in the latest beta release (2.054).I am in dire need for the beta release then I guess. Is it any mature, or what's even more important; where are the download mirrors/the repository?
Jul 06 2011
On 2011-07-06 08:47, Loopback wrote:On 2011-07-06 16:56, Don wrote:If you want to try out dmd beta's then sign up for the dmd-beta list. The beta for 1.069 and 2.054 just started, and the URLs for the files are http://ftp.digitalmars.com/dmd1beta.zip http://ftp.digitalmars.com/dmd2beta.zip - Jonathan M davisIt's a compiler CTFE bug, which has been fixed in the latest beta release (2.054).I am in dire need for the beta release then I guess. Is it any mature, or what's even more important; where are the download mirrors/the repository?
Jul 06 2011
Loopback Wrote:On 2011-07-06 16:56, Don wrote:Dmd and Phobos sources are on gitgub. The beta mailing list is dmd-beta puremagic.com. I don't have useful links handy, but that should be enough for you to find what you need. I think these are the work in progress beta download links: http://ftp.digitalmars.com/dmd1beta.zip http://ftp.digitalmars.com/dmd2beta.zipIt's a compiler CTFE bug, which has been fixed in the latest beta release (2.054).I am in dire need for the beta release then I guess. Is it any mature, or what's even more important; where are the download mirrors/the repository?
Jul 06 2011