[chuck-users] Fresh bug

Stefan Blixt stefan.blixt at gmail.com
Tue Feb 10 01:46:44 EST 2009


Hailstone:~ stefanblixt$ cat test.java
public class test {
  int f(int i) {
    int c =3;
    ++c %= 6;
  }
}

Hailstone:~ stefanblixt$ javac test.java
test.java:4: unexpected type
required: variable
found   : value
    ++c %= 6;
    ^
1 error

/Stefan

On Mon, Feb 9, 2009 at 10:51 PM, Kassen <signal.automatique at gmail.com>wrote:

> Stefan;
>
> > In fact, I think you can remove the % and it still blows - a pause and
> then
> > Bus error here.
>
> Thanks.
>
> I thought I'd investigate some more and even this catches fire;
>
> int count;
> 3 %=> (++count);
>
> I tried that because admittedly the intended calculation order in
> these expressions is a bit vague.
>
> I'm not sure what proper behaviour would be here; "++count" is a bit
> like a function that should return "count + 1" and clearly functions
> aren't mutable but it's also a lot like a integer and that clearly is
> mutable.
>
>
> "++count%3 => count;" is fine but is that really more readable than "3
> %=> ++count;"? I'm not very happy with having to reference "count"
> twice. Some might argue I should simply use two lines but this kind of
> thing is such a basic operation that I'd really like to have it on one
> line and in a readable form.
>
> WWJD? (What Would Java Do?)
>
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
Release me, insect, or I will destroy the Cosmos!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090210/7ad64cf6/attachment.html>


More information about the chuck-users mailing list