ID:1997887
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
This is probably very pipe-dreamy, but would it be possible to implement inner functions? Something like,
proc/Foo()
var/x = 0

proc/Bar()
x ++

Bar()
world << x // Would print "1".
I support anonymous functions 100%, so if this could be implemented, that's be neat. However, I'm not sure if it could ever happen...
Also 100% support. This would be soooooo handy.
To be honest I'm not sure I could figure something like that out. If I could it'd be pretty cool, but I suspect it's more trouble than it's worth. Also, it definitely couldn't work in the way your example showed, because that's a closure; closures would be a whole other level of difficulty, as they'd be an entirely new concept to DM.

Proc calls come with a certain amount of unavoidable overhead anyway, so I think this wouldn't be all that useful after all unless it was implemented in a way where it only acted like a proc.
In response to Lummox JR
Lummox JR wrote:
Proc calls come with a certain amount of unavoidable overhead anyway, so I think this wouldn't be all that useful after all unless it was implemented in a way where it only acted like a proc.

It's not the avoiding proc overhead why I'd love this feature, rather the fact that I can create mini-snippet-procs on the fly without having to worry about them interfering with other code by making them global. If I have two procs which do similar things, but end at different values, I don't want to define two global procs or defines for this. It'll end up creating spaghetti code, whereas if I can inline them like this, I can keep it nicely encapsulated and logical, easier to read and it won't interfere with anything else. It doesn't even have to be a 'proc' in the traditional sense, I'd personally define a new keyword 'inline' to handle this.

proc/aproc()
inline/anotherproc()