ID:1055366
 
Keywords: bug, odd
BYOND Version:496
Operating System:Windows Vista Home Premium 64-bit
Web Browser:Chrome 23.0.1271.64
Applies to:DM Language
Status: Verified

A member of our crack team of bug testers has verified that this issue is reproducible, and has handed it off to the development team for investigation.
Descriptive Problem Summary:

I made a stupid little mistake, but the outcome was weird.

I have a proc called roll_sep(n,d). Let's just say it does a noop.

I also have a mob/verb/roll_sep(n,c). To remove ambiguity, I tried these things:

call("roll_sep")(n,d)
call("roll-sep")(n,d)
call("roll sep")(n,d)


Now, ignoring that all 3 of these are wrong (you can't use a string without a second argument), the outcome was terrible. In all 3 cases it ran the first user-made proc under mob.

At the moment, that proc is just outputting "You're a superuser", but in the real world, it might have accidentally made me one.

Low priority, but extremely unpredictable result.

Numbered Steps to Reproduce Problem:

1. Create a mob/proc/make_admin() that does nothing
2. Create a mob/proc/roll_sep(n,d) that does nothing
3. Create a mob/verb/roll_sep(n,d) with the body:

call("roll sep")(n,d)


4. Call the verb.

Expected Results:

Some sort of reasonable error code. Calling with a string and no scope is not in the specifications. Anything *except* trying to guess what proc to run.


Actual Results:

My first (file-order, top to bottom) proc was called. I added a proc above it: mob/proc/make_admin that did nothing but: world << "you're a admin"...

I then tried the roll_sep verb again. You betcha, it told me I'm a superuser!

Does the problem occur:
Every time!

When does the problem NOT occur?
When I use correct syntax.

Workarounds:

Correct the syntax.
Verified running BYOND 497.1146 on Windows 7 Pro 64-bit.

There are two separate issues here, I think.

First, the reference doesn't mention that the Object argument is optional. However, this syntax error (from if you put just call("test") without the parenthesis for the arguments) seems to suggest that it is:
error: expected syntax: call([Object,]Proc)(Args)

Leaving the Object argument out seems to allow you to call global procedures. So far so good.

However, if you try to call a global procedure that doesn't exist, it calls the first defined procedure/verb. It does this regardless of whether its global or defined under a type, such as /mob (src will be null as you would expect). Instead, it should probably throw: "runtime error: undefined proc or verb /[name]().".

Here's the test code I used:
#if 1
proc/globalCall(n as null|num, d as null|num)
world<<"globalCall: [n], [d], [src]"
#endif

mob
proc
doNotCall(n as null|num, d as null|num)
world<<"doNotCall: [n], [d], [src]"

doCall()
world<<"doCall"
verb
test()
call("notFound")(1,2)
DarkCampainger changed status to 'Verified'