Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
September 30, 2013 [Issue 11148] New: Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=11148 Summary: Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: joseph.wakeling@webdrake.net --- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-09-30 10:45:06 PDT --- Created an attachment (id=1253) Can't pass const(BigInt) to a function taking a BigInt argument. const(BigInt) or immutable(BigInt) objects can't be assigned/implicitly converted to mutable BigInt values. The attached code gives examples where a const or immutable BigInt is passed to a function taking a (mutable) BigInt argument. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 30, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 --- Comment #1 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-09-30 10:45:39 PDT --- Created an attachment (id=1254) Can't pass immutable(BigInt) to function taking a BigInt argument. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 08, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 --- Comment #2 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-10-08 09:04:03 PDT --- Created an attachment (id=1260) Third example, which tests implicit, explicit and cast-based conversion In fact, there is no reliable way to convert from a qualified BigInt type to an unqualified one. The 3rd code example attached shows attempted conversion through both implicit conversion (simple assignment) and explicit (trying both std.conv.to and cast). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh@quickfur.ath.cx --- Comment #3 from hsteoh@quickfur.ath.cx 2013-10-10 11:15:45 PDT --- Is this really a bug? BigInt is implemented as a reference type, so allowing a cast from const(BigInt) to BigInt would be a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 --- Comment #4 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-10-10 11:27:44 PDT --- I think it's an issue that you can't pass an immutable(BigInt) to a function that accepts a BigInt as input. This makes it difficult to e.g. write generic functions that work with any integer type. I'm not sure what the appropriate way to deal with that is, though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 --- Comment #5 from hsteoh@quickfur.ath.cx 2013-10-10 11:39:18 PDT --- You can't pass an immutable(BigInt) to a function that takes unqual BigInt, because that breaks the type system (and risks breaking immutability). The function needs to take const(BigInt) if it doesn't need to propagate qualifiers to its return type, or inout(BigInt) if it does. If the function needs to modify the BigInt, then it should rightly reject any attempt to pass in an immutable BigInt. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 --- Comment #6 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-10-10 11:55:30 PDT --- (In reply to comment #5) > If the function needs to modify the BigInt, then it should rightly reject any attempt to pass in an immutable BigInt. Well, suppose you have some function of the form, T foo(T)(T n) { Unqual!T a = n; // ... do mutable stuff with a return a; } That still won't work if T is an immutable(BigInt), because the first line will fail: you can't copy from the immutable to mutable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 10, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |braddr@puremagic.com --- Comment #7 from Brad Roberts <braddr@puremagic.com> 2013-10-10 16:28:11 PDT --- BigInt must behave essentially exactly like every other integral type (except for having a larger range of possible values), which includes being a value type. Any internal COW implementation must be invisible to users. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 02, 2013 [Issue 11148] Can't implicitly convert const(BigInt) or immutable(BigInt) to BigInt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | http://d.puremagic.com/issues/show_bug.cgi?id=11148 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |simen.kjaras@gmail.com --- Comment #8 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-11-01 18:29:34 PDT --- https://github.com/D-Programming-Language/phobos/pull/1679 -- 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