Shop OBEX P1 Docs P2 Docs Learn Events
ctra[1] := x compiles, but ... — Parallax Forums

ctra[1] := x compiles, but ...

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2012-08-01 20:56 in Propeller 1
... it doesn't set ctrb or seem to do anything else for that matter. Bummer. I was hoping to write a universal counter setup method that would work for both counters.

(I wonder why it even compiles.)

-Phil

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-08-01 17:52
    (I wonder why it even compiles.)
    For the same reason that outa[1] := x does? You could use spr[8 + a_b] := x though.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-08-01 18:41
    kuroneko wrote:
    For the same reason that outa[1] := x does?

    Ugh, yeah, I suppose. I never really liked the idea of overloading subscript notation for selecting bits in the first place. It would have been better to come up with a unique syntax that works equally on hub variables and sprs alike.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-08-01 20:56
    Of course, the spr thing works. But, for bit access, would it have been so terribly wrong to require something like:
    <register or variable>.bit(<bitrange>)

    Or, better:
    <register or variable>.(<bitrange>) or
    <register or variable>.<bit>

    I love Spin, but sometimes the logic of its syntax escapes me. I've got half a mind to write a Spin++ compiler...

    -Phil
Sign In or Register to comment.