[ZScript] isnot keyword?

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [ZScript] isnot keyword?

Re: [ZScript] isnot keyword?

by Professor Hastig » Wed Oct 04, 2023 12:09 am

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'.

Re: [ZScript] isnot keyword?

by Sir Robin » Tue Oct 03, 2023 8:58 pm

I've wanted this also. No functional difference, just code that is slightly easier to read/write

Re: [ZScript] isnot keyword?

by Jay0 » 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)

Re: [ZScript] isnot keyword?

by phantombeta » Wed Jul 05, 2023 8:26 pm

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.

Re: [ZScript] isnot keyword?

by Jay0 » Wed Jul 05, 2023 6:45 pm

I'd be willing to implement this myself if it gets a "yes"

[ZScript] isnot keyword?

by kevansevans » Wed Jul 05, 2023 6:43 pm

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 !=

Top