Which is better: @pemit or think pemit()?

Submitted by javelin on Sun, 2012-02-12 23:02

Which is better: @pemit or think pemit()?

@pemit foo=bar


think pemit(foo, bar)

The former case, using @pemit, is preferrable. In both cases, the parser has to find the command, and evaluate its argument(s). Using @pemit directly means there is one fewer function to evaluate in the argument than when using think pemit(), and it\'s thus more efficient.
The only times think X() is normally to be preferred over @X is when the function version returns a value and you need to do something with that value. A vendor object, for example, is more likely to use create() than @create so it can easily reference the newly created object by dbref.
Of course, there are also times where X() is the only option (Like when it\'s in an attribute being evaluated by u()). But for action list elements, remember @pemit over think pemit().

2002-May-18 12:36am shawnw