ID:2845904
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Let's suppose I have this type.

/weapon
var/flags = HEAVY | LOUD
// other stuff


Now I want to make a subtype. I want to add an additional flag, "METAL". Right now, I have to do this:

/weapon/crowbar
flags = HEAVY | LOUD | METAL


This is very fragile, as if the base flags change, then the rest won't. You can make it a macro, but now you have to worry about compilation order, and you split up the code just to satisfy the language.

Instead, I think it would be cool if this was supported:

/weapon/crowbar
flags |= METAL // Will get the parent and, at compile time, append the new results


This could work with `|=`, `&=`, `+=`, `-=`, etc, and could support both numbers (bitfields), lists, and text.
Should be noted this exists in 515 with:

flags = parent_type::flags | METAL


...but is much noisier.
You can do this in 515. flags = parent_type::flags | METAL

EDIT: Damn, I got beaten to the punch
I changed the title to make it more clear :-)