Shop OBEX P1 Docs P2 Docs Learn Events
Use of # to "pass" a value and/or convert hex???? — Parallax Forums

Use of # to "pass" a value and/or convert hex????

ElectricAyeElectricAye Posts: 4,561
edited 2008-08-16 14:19 in Propeller 1
Hi all,

I'm looking at SpinOneWire-test.spin from the Object Exchange (Thank you Micah Dowty!) and I'm baffled by the use of an operator(?) in the program, an operator that looks like #.

An object nicknamed ow is called up, and to that object is "passed" a value that is actually named in ow's list of constants.

The call looks like this

ow.writeByte(ow#MATCH_ROM)

In ow's own list of constants, we see this:
MATCH_ROM = $55

I'm guessing the # simply grabs the value of the constant MATCH_ROM from the ow program and uses it inside of its own ow program. But is # also converting the hex $55 to bits first or inserting the raw hex value... or what? I can't find documentation on # anywhere. It's not an operator listed in the manual, nor in Spin's assembly code.
What's # called and does anybody know where it's documented?

thanks,
Mark

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-16 14:10
    This works the same for named constants in an object as "." works for methods. The form <object name>#<constant name> refers to a constant in that object just like <object name>.<method name> refers to a method in that object.

    This is briefly documented on page 199 of the Propeller Manual.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-16 14:19
    Thanks, Mike. I see it now. That makes me feel a lot better about using it in the future.

    cheers,
    Mark
Sign In or Register to comment.