Hi again!
For example, take this code: Playground
class Player
property flask_charges = 3_i8
end
p = Player.new
p.flask_charges -= 1
p.flask_charges -= 1_i8
puts p.flask_charges
puts typeof(p.flask_charges)
Some questions:
- What’s the difference between line
7
and8
? - It seems to be using
1_i8
for the decrement operation, however, is there any performance benefit in writing1_i8
out, as compared to just1
?
I was pondering this dilemma all day because I just noticed _i8
littered all over, and honestly, removing all the _i8
suffixes makes it look less verbose / easier to read. Not only that, but I keep thinking of the TYPES! Types need to match! If I set a property to a specific type, I always think I should use the same kind of type modifying it. For example, typeof(1)
is Int32
. Int32
is not an Int8
. So it kinda feels weird to modify a Int8
with a Int32
.
Or, am I just overthinking it?