[ZScript] isnot keyword?

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
kevansevans
Spotlight Team
Posts: 435
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support
Contact:

[ZScript] isnot keyword?

Post by kevansevans »

It's just some syntax sugar, because

Code: Select all

if (mo isnot "MyCoolActor")
looks better than

Code: Select all

if (!(mo is "MyCoolActor"))
Would make it compliment to == and !=
User avatar
Jay0
 
 
Posts: 73
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: She/Her
Graphics Processor: nVidia with Vulkan support
Location: Brazil
Contact:

Re: [ZScript] isnot keyword?

Post by Jay0 »

I'd be willing to implement this myself if it gets a "yes"
User avatar
phantombeta
Posts: 2180
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: [ZScript] isnot keyword?

Post by phantombeta »

I personally don't see any reason not to have this, if implemented correctly it'd just be syntactic sugar for !(x is y) anyway.
IMO x !is y or x is not y would be better, though.
User avatar
Jay0
 
 
Posts: 73
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: She/Her
Graphics Processor: nVidia with Vulkan support
Location: Brazil
Contact:

Re: [ZScript] isnot keyword?

Post by Jay0 »

phantombeta wrote: Wed Jul 05, 2023 8:26 pm x !is y or x is not y
both of those would require significant changes, due to how zscript parses operations (isnot wouldn't require them -- it follow the same rules as any other operation like is)
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: [ZScript] isnot keyword?

Post by Sir Robin »

I've wanted this also. No functional difference, just code that is slightly easier to read/write
Professor Hastig
Posts: 256
Joined: Mon Jan 09, 2023 2:02 am
Graphics Processor: nVidia (Modern GZDoom)

Re: [ZScript] isnot keyword?

Post by Professor Hastig »

RicardoLuis0 wrote: Thu Jul 06, 2023 12:26 pm
phantombeta wrote: Wed Jul 05, 2023 8:26 pm x !is y or x is not y
both of those would require significant changes, due to how zscript parses operations (isnot wouldn't require them -- it follow the same rules as any other operation like is)
Actually, they wouldn't require much of a change at all. Have you seen how ZScript does 'static const'?
All it does is combine both tokens to one before passing it to the grammar parser, so you could do the same with '!is'.
Post Reply

Return to “Feature Suggestions [GZDoom]”