ID:2611454
 
Redundant
Applies to:DM Language
Status: Redundant

This feature has already been implemented, or is already achievable with existing methods.
The addition of "is" type checking and casting would be a fairly simple and useful addition, something like:

/mob/verb/Check(obj/myObj)
/*
Equivalent to:

if(istype(myObj, /obj/vehicle/car))
var/obj/vehicle/car/myCar = myObj
...
*/

if(myObj is /obj/vehicle/car/myCar)
myCar.name = "[usr]'s car"
usr << "You claimed the car"
// Or
if(myObj is var/obj/item/candy/myCandy)
usr << "This is candy"

(I don't believe this has been suggested before, searching gives a bunch of false positives)
Lummox JR resolved issue (Redundant)
We have istype() for this.
Yes I know, I reference it in the post. It's a helper. Similar to isobj().
I don't see that the syntax change would really help anything.
It is a cleaner method, similar to what C# has. It checks type, creates a variable, and casts it all in one line.

https://docs.microsoft.com/en-us/dotnet/csharp/ language-reference/keywords/is
I actually got a bit spoiled on it when I was using C# too, but I can live without it in DM =P
I just thought it would be a cool simple addition, I can def live without it but would be nice syntactic sugar