One for BiG D

Wol

In Cryo Sleep
Death it is.

Seconded.

Languages which don't have types just end up with all kinds of buggery.

int i = 8;
print("My variable number is" + i.toString());

thats fairly easy to do, and keeps the fact that i is an int!
 

BiG D

Administrator
Staff member
Right, but why are you storing an int as a string if you don't want it treated as a string, then?
 

Wol

In Cryo Sleep
Right, but why are you storing an int as a string if you don't want it treated as a string, then?

Eh. I've missed something here. The number is being stored as an int, not a string? but converted to a string when needed.
 

BiG D

Administrator
Staff member
Yes, that question was for Ronin.

For you: what is the benefit of having it explicitly declared an int, and then explicitly casted to a string? Why can't the computer handle that on its own?
 

waterproofbob

Junior Administrator
hahahaha this wasn't my plan when making this thread in the slightest but I love it.

Argue my code monkeys.

/me cackles like the wicked witch of the west.

I control you all in no way what so ever.
 

Ronin Storm

Administrator
Staff member
Yes, that question was for Ronin.

I want to know the difference in each case. "1" might be an ID that's actually in hex, which happens to equal integer 1 but that's happenstance. I want clarity over which I mean. Soft types get in the way of that clarity.

For you: what is the benefit of having it explicitly declared an int, and then explicitly casted to a string? Why can't the computer handle that on its own?

It can, in some cases. Implicit casting is available in C#. However, I highly recommend avoiding it because it's not what your maintenance programmer is expecting.
 

BiG D

Administrator
Staff member
Implicit casting is available in C#. However, I highly recommend avoiding it because it's not what your maintenance programmer is expecting.
There!

I think that's what it comes down to. You're not used to it, and it's rather contrary to everything you've already learned.

As I said in the shoutbox earlier, it's just another thing like memory management and garbage collection that many languages do automatically so the programmer can focus on programming.
 
Top