blue-nebula / base

Main repository of Blue Nebula, a fast-paced shooter with a unique parkour system. It is a fork of Red Eclipse and is free software.
https://blue-nebula.org
15 stars 6 forks source link

Add +s, +=s and -s and -=s operators to concatenate strings #174

Open MoonPadUSer opened 3 years ago

MoonPadUSer commented 3 years ago

I know, it's syntactic sugar but still.

+s and +=s are way shorter than concatword or format. and since it's become a common thing to concatenate strings using + anyways, I don't see an disadvantage

-s and -=s could be used to remove n number of chars from the end of a string e.g. (-s "Hello World!" 6) would result in "Hello "

TheAssassin commented 3 years ago

-s makes no sense at all. I don't see any useful use case for it.

Assignment operators in prefix notation seem a bit awkward in this context. But +s might be added as a wrapper for concatword.

Doesn't format do format string stuff? Hiding something like that behind operators is a bad idea in general.

MoonPadUSer commented 3 years ago

@TheAssassin, I'm fine with not adding -s and -=s also, indeed, +s could basically become a wrapper for concatword. But I think it's very important to slowly introduce some common syntax practices like adding strings together to it.