October 13, 2017
On 10/13/17 3:47 AM, Daniel Kozak wrote:
> but it works ok with immutable, so until you really need to change bar you can use
> 
> immutable bar = 9;
> foo!byte(bar + 1);

Right, the reason why your original didn't work is the compiler "forgets" that bar is 9 by the time it gets to the foo call. However, it doesn't forget the value of an immutable.

> 
> On Fri, Oct 13, 2017 at 9:46 AM, Daniel Kozak <kozzi11@gmail.com <mailto:kozzi11@gmail.com>> wrote:
> 
>     Not sure :), I have forgoten byte+byte=int.

One place where the compiler doesn't care is +=:

bar += 400; // OK
int y = 400;
bar += y; // OK

-Steve
1 2
Next ›   Last »