From: ptkwt@... (Phil Tomson) Date: 2004-07-16T14:07:15+09:00 Subject: Re: Do you want ":=" operator? In article <1089951984.479476.20160.nullmailer@picachu.netlab.jp>, Yukihiro Matsumoto wrote: >Hi, > >In message "Re: Do you want ":=" operator?" > on 04/07/16, "Xiangyu Yang" writes: > >|> you can define "attribute assignment method" such as "x.foo=val". >|> Can you accept method call like "R.x=..." instead of "Rx := ..."? > >|No, I can't. Each Rx is a RegisterClass *object* in my CPU, which hold >|some states. When I code "R0=R0&R1", I only want to change 1 of the >|R0's attributs and don't touch others. > >Then how about changing R0 to R[0]? > > R[0]=R[0]&R[1] > >would work fine, if you can accept the appearance. > > matz. I suspect that the problem with doing this would be that R0 and R1 are registers (arrays of bits). He probably already uses R[0] to access bit 0 of the register and R[1] to access bit 1 and so on. What he's doing with 'R0=R0&R1' is logically ANDing the two registers, so that: R0="1111" R1="0100" R0=R0&R1 #R0 is now "0100" for example. and: puts R0[0] #=> 0 Phil