LoginLogin

[fixed] How to crash SB

Root / SmileBASIC Bug Reports / [.]

🔒
5logankCreated:
Ideally, that should return a "Type Mismatch" error for multiplying a string by an integer.
Multiplying a string by an integer is a valid operation in SB. It produces a string which is n copies of the multiplied strings concatenated one after the other. For example, "A"*2 will produce the string "AA".

I wish more languages were strongly type-checked. One of the biggest complaints I have with stuff like Python and SB is that they aren't strongly type-checked at all, resulting in bugs like A$="A"*65536*65536. Ideally, that should return a "Type Mismatch" error for multiplying a string by an integer.
I know what you mean, but when I use Python, I feel like the convenience of the so-called 'duck typing' outweighs the occasional unhelpful error message. As long as it tells me which line the error occurred in, I can probably figure out that it was a type mismatch problem.