ID:2383112
 
BYOND Version:512.1427
Operating System:Linux
Web Browser:Chrome 67.0.3396.99
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
The following two snippets are, as far as I am aware, equivalent:
/proc/test()
do_thing(1)
sub:
do_thing(2)

/proc/test()
do_thing(1)
/proc/test/sub:
do_thing(2)

I'm not completely sure this is intentional, but it has some quirks that make it useful in some very specific cases, and (other than some weird stuff with execution order) doesn't seem to cause any problems. However, this also compiles:
/proc/test()
do_thing(1)
/proc/test/sub()
do_thing(2)

In this exact case, it's functionally equivalent to the above examples, but has a number of problems with things I didn't include. It does not work with goto, but does work with call(), and can also be called like a normal proc, but only when absolutely pathed, for some reason. Also it just utterly ruins variable scope. (Attempting to use a variable from the "parent" proc causes a runtime, and declaring a new variable with the same name as one in the "parent" causes it to not compile.)

Expected Results:
Compile failure

Actual Results:
The above nonsense

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Not tested, but I haven't seen any recent relevant changes.
The provided code examples are incomplete. I need code that also does the gotos and calls you mentioned (i.e., the code that actually fails).
/proc/thing()
world.log << "This is proc/thing() talking"
/proc/thing/sub()
world.log << "This is proc/thing/sub() talking"

/proc/stuff()
goto sub
world.log << "This will not get printed because we're jumping to the label/proc abomination"
/proc/stuff/sub()
world.log << "This is proc/stuff/sub() talking"
/proc/stuff/sub/moresub()
world.log << and_now_for_my_next_number

/proc/stuff/sub/moresub/var/and_now_for_my_next_number = "This is proc/stuff/sub/moresub() talking"

world/New()
/proc/thing()
call("/proc/thing/sub")()

/proc/stuff()
/proc/stuff/sub/()


This results in:
This is proc/thing() talking
This is proc/thing/sub() talking
This is proc/thing/sub() talking
This is proc/stuff/sub() talking
This is proc/stuff/sub/moresub() talking
This is proc/stuff/sub() talking
This is proc/stuff/sub/moresub() talking


With the compiler complaining:
test2.dm:17:warning: /proc/thing: use call() to call a proc by reference
test2.dm:20:warning: /proc/stuff: use call() to call a proc by reference
test2.dm:21:warning: /proc/stuff/sub/: use call() to call a proc by reference
test2.dm:3:warning: sub: unused label
test2.dm:11:warning: moresub: unused label
Additionally:
/proc/thing()
world.log << "This is proc/thing() talking"
var/a = 1
/proc/thing/sub()
var/a = 2
world.log << a

world/New()
/proc/thing()

will result in:
test2.dm:5:error: a: duplicate definition
test2.dm:3:error: a: previous definition
test2.dm:9:warning: /proc/thing: use call() to call a proc by reference
test2.dm:4:warning: sub: unused label


and

/proc/thing()
world.log << "This is proc/thing() talking"
var/a = 1
/proc/thing/sub()
world.log << a

world/New()
/proc/thing()


will result in
This is proc/thing() talking
runtime error: Cannot read null.a
proc name: thing (/proc/thing)
source file: test2.dm,5
usr: (src)
src: null
call stack:
thing()
world: New()
In response to DamianQ
Doesn't the first one result in a compile failure?
Yep.
Edited my earlier post.
I must have made a mistake testing it.