digitalmars.D - Repairing BigInt const
- Matthias Walter (9/9) Nov 20 2010 Hi all,
- Don (6/18) Nov 21 2010 It's been prevented by some compiler bugs. The changes to pure in 2.050
- Matthias Walter (9/23) Nov 21 2010 You mean by "making BigInt pure" that all the computation-methods (like
- Simen kjaeraas (5/24) Nov 21 2010 "Making BigInt pure" means making it usable in pure functions. That is,
Hi all, as it seems, the current version of BigInt is not capable of const, i.e. BigInt(1) + const(BigInt)(1) does not work. Is there already an effort to fix this or would it make sense if I had taken some time to create a fix for it? I have no idea of all the asm in the x86 specialization but as const is an interface thing, I should be able to figure out everything without that knowledge. Or are there general design problems, such that this would be a waste of time? Matthias
Nov 20 2010
Matthias Walter wrote:Hi all, as it seems, the current version of BigInt is not capable of const, i.e. BigInt(1) + const(BigInt)(1) does not work. Is there already an effort to fix this or would it make sense if I had taken some time to create a fix for it? I have no idea of all the asm in the x86 specialization but as const is an interface thing, I should be able to figure out everything without that knowledge. Or are there general design problems, such that this would be a waste of time? MatthiasIt's been prevented by some compiler bugs. The changes to pure in 2.050 were triggered by attempts to make BigInt pure. 2.051 will include several fixes to nothrow. Note that const is transitive (unlike C++), so it isn't just an interface thing.
Nov 21 2010
On 11/21/2010 04:33 PM, Don wrote:Matthias Walter wrote:You mean by "making BigInt pure" that all the computation-methods (like opBinary, etc.) will be pure, right? Or can D structs be pure as well? (Whatever this would mean...)as it seems, the current version of BigInt is not capable of const, i.e. BigInt(1) + const(BigInt)(1) does not work. Is there already an effort to fix this or would it make sense if I had taken some time to create a fix for it? I have no idea of all the asm in the x86 specialization but as const is an interface thing, I should be able to figure out everything without that knowledge. Or are there general design problems, such that this would be a waste of time?It's been prevented by some compiler bugs. The changes to pure in 2.050 were triggered by attempts to make BigInt pure. 2.051 will include several fixes to nothrow.Note that const is transitive (unlike C++), so it isn't just an interface thing.That's clear. For "+", I succeeded in making it const, but of course I had to modify the biguintcore module, too. So I guess that you will work on BigInt when 2.051 is out and patch it to work with const and immutable, right? So I have a good chance to have a fixed version in the next month(s)?!
Nov 21 2010
Matthias Walter <xammy xammy.homelinux.net> wrote:On 11/21/2010 04:33 PM, Don wrote:"Making BigInt pure" means making it usable in pure functions. That is, make all member functions pure that can be pure. -- SimenMatthias Walter wrote:You mean by "making BigInt pure" that all the computation-methods (like opBinary, etc.) will be pure, right? Or can D structs be pure as well? (Whatever this would mean...)as it seems, the current version of BigInt is not capable of const, i.e. BigInt(1) + const(BigInt)(1) does not work. Is there already an effort to fix this or would it make sense if I had taken some time to create a fix for it? I have no idea of all the asm in the x86 specialization but as const is an interface thing, I should be able to figure out everything without that knowledge. Or are there general design problems, such that this would be a waste of time?It's been prevented by some compiler bugs. The changes to pure in 2.050 were triggered by attempts to make BigInt pure. 2.051 will include several fixes to nothrow.
Nov 21 2010