Jump to content

Will KSP 2 have better file/data formats?


kfsone

Recommended Posts

18 minutes ago, Incarnation of Chaos said:

Where did he use "=" instead of "=="?

I know "=" assigns a value to a variable, and "==" compares two variables. iv'e been writing conditional statements and loops most of the evening actually, so i guess my brain may be a bit fried and i'm not seeing something right in front of me.

He didn’t - but the fact that you're still asking me is proves the point of how easy a typo it is to overlook, and it's one that you will make if you type enough comparisions.  This is a good way to prevent it from being a headache later.

I'll admit it does depend on language - but the only language I've had major experience with which wasn't subject to this was COBOL, and that's because it's long-winded enough that it's not using the same operators.

(And @kfsone - I've worked in some of the languages you're using as examples against - and they allowed it.  Heck, I originally learned this in best practices for one of them.  I'd have to analyse a bit to figure out what's going on in your examples - but this digression has gone on plenty long enough.  Suffice I think it's common enough to think about, but that you do have to be aware of what you're comparing.  This is really only relevant for simple constants/comparisons - anything else and it doesn't work anyway.)

Link to comment
Share on other sites

5 minutes ago, DStaal said:

He didn’t - but the fact that you're still asking me is proves the point of how easy a typo it is to overlook, and it's one that you will make if you type enough comparisions.  This is a good way to prevent it from being a headache later.

I'll admit it does depend on language - but the only language I've had major experience with which wasn't subject to this was COBOL, and that's because it's long-winded enough that it's not using the same operators.

(And @kfsone - I've worked in some of the languages you're using as examples against - and they allowed it.  Heck, I originally learned this in best practices for one of them.  I'd have to analyse a bit to figure out what's going on in your examples - but this digression has gone on plenty long enough.  Suffice I think it's common enough to think about, but that you do have to be aware of what you're comparing.  This is really only relevant for simple constants/comparisons - anything else and it doesn't work anyway.)

Well yeah; though i seem to misplace brackets or semi-colons more than flub on a comparison xD

Link to comment
Share on other sites

21 minutes ago, DStaal said:

He didn’t - but the fact that you're still asking me is proves the point of how easy a typo it is to overlook, and it's one that you will make if you type enough comparisions.  This is a good way to prevent it from being a headache later.

I'll admit it does depend on language - but the only language I've had major experience with which wasn't subject to this was COBOL, and that's because it's long-winded enough that it's not using the same operators.

(And @kfsone - I've worked in some of the languages you're using as examples against - and they allowed it.  Heck, I originally learned this in best practices for one of them.  I'd have to analyse a bit to figure out what's going on in your examples - but this digression has gone on plenty long enough.  Suffice I think it's common enough to think about, but that you do have to be aware of what you're comparing.  This is really only relevant for simple constants/comparisons - anything else and it doesn't work anyway.)

It caught me by surprise early on, when I moved from BCPL to C, took me weeks to figure out the bug the first time. SAS C wasn't terribly generous with errors/warnings :) but I was also writing a compiler generator so I had several layers to try and figure out.

Link to comment
Share on other sites

1 hour ago, Incarnation of Chaos said:

Where did he use "=" instead of "=="?

In the (not-so) fictional universe where the programmer made a typo.

IF you get in the habit of writing it "if string value == variable" then your typos generate errors. If you get in the habit of writing "if variable == string value" then your typos generate bugs that you may not notice until a long time later.

Link to comment
Share on other sites

6 hours ago, kfsone said:

Sure - golang turned 130,000 lines+ - snipped-

I'm expecting people to take certain things for granted here, so I acknowledge that I'm not providing end-to-end concrete proof that all other possibilities aren't in play. If you're actually interested, there's plenty of good stuff on language design and parsing out there :)

Was this what you were asking or were you referring back earlier to my example of XML vs CFG vs JSON?

That was what I was looking for, thanks for the clarification. 

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...