On Oct 10, 2013, at 11:21 AM, Joseph Rushton Wakeling 
<[email protected]> wrote:

> On 10/10/13 19:46, Sean Kelly wrote:
>> As for const / immutable, I guess I don't see this as such an issue because 
>> I've been dealing with it in C++ for so long.  You either have to commit 
>> 100% to using const attributes or not use them at all.  Anything in between 
>> is fraught with problems.
> 
> Well, the problem is essentially that you can have a function like:
> 
>    void foo(int i) { ... }
> 
> ... and if you pass it an immutable or const int, this is not a problem, 
> because you're passing by value.
> 
> But now try
> 
>    void foo(BigInt i) { ... }
> 
> ... and it won't work when passed a const/immutable variable, even though 
> again you're passing by value.  That's not nice, not intuitive, and generally 
> speaking makes working with complex data types annoying.
> 
> It's why, for example, std.math.abs currently works with BigInt but not with 
> const or immutable BigInt -- which is very irritating indeed.


Isn't BigInt a struct?  I'd expect it to work via copying just like concrete 
types.

Reply via email to