PennMUSH Community

Ticket #7401 (closed documentation: fixed)

Opened 1 year ago

Last modified 1 year ago

eval() changes %# to caller

Reported by: Talvo Assigned to:
Priority: minor Milestone: 1.8.2p7
Keywords: Cc:
Visibility: Public

Description

Not sure if it's deliberate or not, but when you eval() - or get_eval(), by the looks of it - %# is changed to be the dbref of the caller:

&foo #0=%# [u(me/foo2)] [eval(me,foo2)]
&foo2 #0=%#

think u(#0/foo)
#1 #1 #0

Change History

07/10/07 11:28:41 changed by raevnos

MUX does the same thing. It's either deliberate or a bug that's been around for over a decade.

07/10/07 11:34:28 changed by Alan Schwartz

Quoting Penndev (pennmush-bugs@pennmush.org):
> #7401: eval() changes %# to caller
> ---------------------+------------------------------------------------------
>   Reporter:  Talvo   |       Owner:     
>       Type:  bug     |      Status:  new
>   Priority:  minor   |   Milestone:     
> Resolution:          |    Keywords:     
> Visibility:  Public  |  
> ---------------------+------------------------------------------------------
> Comment (by raevnos):
> 
>  MUX does the same thing. It's either deliberate or a bug that's been
>  around for over a decade.

Or a little of neither. It's a historical artifact that's
been lost from Penn's help file. The TM 2.2.4 help for
GET_EVAL() notes this venerable behavior:

  The get_eval function returns the specified attribute from the named object
  (just like the get function), except that function references and
  %-substitutions have already been performed.  In function references,
  'me' refers to the object being looked at, and %-substitutions that refer
  to the enactor (such as %n, %#, etc) refer to the object making the get_eval
  call.  If the attribute is not present on <object>, its parent is searched
  for the attribute.

People using get_eval/eval relied on this behavior in some cases. But
people soon wanted the other behavior in many cases. As a result, U()
was born -- in part, to have an eval-like function that maintained %#
as the original enactor.

I recommend updating Penn's help file to provide better documentation.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Javelin@M*U*S*H, once Paul@DuneMUSH | Alan Schwartz <dunemush@pennmush.org>
   (mush.pennmush.org 4201)         |     
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

07/10/07 13:30:46 changed by raevnos

  • status changed from new to closed.
  • type changed from bug to documentation.
  • resolution set to fixed.
  • milestone set to 1.8.2p7.

I'm not sure if I should be scared or impressed that you have Tiny 2.2 sitting around.

Help files mention %# change now.