Shop OBEX P1 Docs P2 Docs Learn Events
Difference between PUB and PRI — Parallax Forums

Difference between PUB and PRI

karakikokarakiko Posts: 11
edited 2010-03-25 22:33 in Propeller 1
Hello Forum ,
I am curious to know the difference between PUB and PRI , the only·difference i know that PRI methods can only be accessed from inside of the object . Is there more difference?

Thanks

Comments

  • John R.John R. Posts: 1,376
    edited 2010-03-25 21:31
    Nope, not that I know of, but this can be a significant difference. It allows you to write "Helper" functions that may make changes to variables, states, etc., of the object that you don't want directly called from the "outside world".

    An example might be an object that keeps track of the number of changes made. There might be a number of "Update Functions" that are Public, and each of these may call a separate Private funcation that updates the "Change Count". You wouldn't want the "Change Count" function to be called from "the outside world". (possibly not the best example, but I hope you get the idea)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.
    Click here to see my Nomad Build Log
  • RaymanRayman Posts: 14,877
    edited 2010-03-25 21:32
    I think that's about the only big difference...

    There are some other minor differences.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • Nick McClickNick McClick Posts: 1,003
    edited 2010-03-25 22:33
    For the top object file, program execution begins at the first PUB block - I'm pretty sure it skips any PRI's.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Forums RSS Feed!

    Gadget Gangster - Share your Electronic Projects
Sign In or Register to comment.