ID:1138963
 
(See the best response by Kozuma3.)
Code:
mob
verb
pm(mob/m in world)
worldPM(usr,m,"Hello Friend")
usr.userPM(m,"Hello Friend")
proc
worldPM(mob/sender,mob/recipient,msg)

sender << "[sender] : [msg]"
recipient << "[sender] : [msg]"
mob
proc
userPM(mob/recipient, msg)

src << "[src] : [msg]"
recipient << "[src] : [msg]"


I was just wondering what was the better coding practice, in this case using the global pm or the mob defined pm, and when should i make the distinction of favoring one over the other.

thanks ahead...


Best response
For practice , Use src instead of usr in your verb since it's the mobs.
In an object oriented language, it'd make more sense to have that PM procedure defined under a mob.