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
16 stars 7 forks source link

Add multiline comments to cubescript #213

Closed robalni closed 4 years ago

robalni commented 4 years ago

This pull request adds /* this type of comment */ to cubescript, requested by @MoonPadUSer.

MoonPadUSer commented 4 years ago

It'd be great if you could add some comments if possible, since you seem to understand the compiler quite a bit

MoonPadUSer commented 4 years ago

running this:

echo "testacle" /*
echo "test"
*/ echo "lala"

results in testacle echo lala which is theoretically not a big deal but I think it'd be nice if the */ is on another line than /* if it'd act like a ;, that way you don't combine parts that aren't meant to be combined

robalni commented 4 years ago

Logically the behaviour you see there should be the correct one because you commented out the statement terminator (newline) and therefore the statements should become the same statement. I can also see why it should not be the correct behaviour because in a line-based language, statements on different lines should be different statements. This makes me feel like multiline comments might not be a good idea in line-based languages because it's not obvious what the correct behaviour should be. The main problem is that newline characters are invisible and that you can't put the comment-start in the end of the line after the newline character, otherwise it would be obvious what should happen. I don't know what the best thing to do here is.

MoonPadUSer commented 4 years ago

I mean, it wouldn't be that big of a deal to leave it as-is tbh