MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: How do I protect a wiz-owned :enterfunc?



Gevan Dutton wrote: 

>	On Wed, 27 Nov 1996, Francis Litterio wrote:
>
>	I must protect the verb so that it can only be called by the
>	server and never by a programmer or another verb.  But when the
>	1.8.0p5 server calls :enterfunc, caller and player are both set to
>	something _other_ than #-1. 
>	What check can I do to enforce that the :enterfunc is only
>	called from the server? 

> Well, if you want to be really sure (and probably there's a better way):
>  last_activ = callers()[$];
>  if (last_activ[4]!=#-1 && last_activ[3]!=#-1 && last_activ[2]==""))
>    "caller was not a builtin function";
>    raise(E_PERM);
>  endif
>  ...	  

Well, a good source here is the Programmers' Manual, which under
callers(), sez:

[...] 

| The result of `callers()' is a list, each element of which gives
| information about one pending verb or function in the following
| format:
|
|    {<this>, <verb-name>, <programmer>, <verb-loc>, <player>, <line-number>}

[...]

| For functions, <this>, <programmer>, and <verb-loc> are all `#-1',
| <verb-name> is the name of the function, and <line-number> is an index
| used internally to determine the current state of the built-in
| function.  The simplest correct test for a built-in function entry is
|
|    (VERB-LOC == #-1  &&  PROGRAMMER == #-1  &&  VERB-NAME != "")

Showing people where the answers are is better than just giving the
answer.  

<RANT REL=META>

In particular, I think that members of this list should categorically
refuse to answer things listed in the moo-cows FAQ with anything other
than "The answer to your question is in the FAQ". (Well, unless the
person answering is adding significant new information of their
own---hi, Rog!)

There's no sense rewarding people for ignoring easy-to-digest sources
before creating another interminable thread of partial answers, half
of them significantly incorrect, and worse, often not corrected.  Let
alone the two line responses prepended to an unedited quote of an
original article that was 60 lines long.  Of course, the 10 line
signatures don't help.

Gevan, I'm not directing this at you---you at least followed up with a
correction, and trimmed the quoted article.  I'm just getting
frustrated that the signal to noise ratio has dropped so low.  Maybe
I'm being a fuddy-duddy, but I really did like it when each non-issue
question got answered by at most one person, who had spent a fair
amount of time carefully presenting a nice, well-formatted message
that if necessary could be just dropped into the FAQ.

</RANT>

Well, here in the US it's now officially Thanksgiving Day, and I think
I'll be in a much better mood after eating too much.  Please excuse my
flaming.

Jay Carlson
nop@nop.com    nop@ccs.neu.edu    nop@kagoona.mitre.org

Flat text is just *never* what you want.   ---stephen p spackman


References:

Home | Subject Index | Thread Index