ID:1299428
 
Applies to:
Status: Open

Issue hasn't been assigned a status value.
Currently, we have ..() which can execute parent defined block of code for same defined function. super() would provide a way to call the built in code but ignore the parent defined block of code.

Here are some interesting situations that would require a super() that ..() alone can't do.

atom/movable/Del()
if(loc)
if(target)
target = null
if(targeted_by)
targeted_by.target = null
targeted_by = null
return
..()
obj/spell_particle
New()
..()
spawn(3) del src
Del()
..()//we'd like this to just delete without checking targets, but we have no way to accomplish that


In the above example, spell particles will have to do what atom/movable has defined them to do in Del(), which is to clear references so that garbage collection can remove these atoms at a better time. Unfortunately, spell_particles don't have targets and can't be targeted, so we can't get a performance increase by overriding the Del() functionality (it is a built in function).

One would have to adopt a weird code convention by creating their own "Delete()" proc and using it instead of Del, and then handling it in a complex manner adding additional overhead.

This could be solved with a super()

obj/spell_particle
Del()
super()//overrides atom/movable, calls built-in functionality
Only other work around I can think of is to create a top level datum that does a garbage collector friendly delete.
What this implies, is the target code is too far up the hierarchy, and you need to introduce another layer somewhere. If a spell particle cannot target or be targetted, why is it inheriting code which provides that?
In response to Stephen001
Yeah, good point. But there is still no way to un-override a built-in function that has a default code block.
In response to FIREking
The simplest solution to this I believe would be to use a parameter, so that all your over ride code is only executed in certain cases.
In response to FIREking
FIREking wrote:
Yeah, good point. But there is still no way to un-override a built-in function that has a default code block.

That's quite normal, not just for DM, too. Needing to do that kind of suggests iffy use of inheritance.