hari3368 / sb2-js

Automatically exported from code.google.com/p/sb2-js
0 stars 0 forks source link

Correctly implement casting. #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Since I'm such an amazing programmer and all (:> :>) none of the examples 
attempt to add a string to a number or anything silly like that, but I know 
that some project somewhere will. (actually, sketch might even do this)

The goal would be to replace all parsing Number() functions with a scratch 
accurate castNumber(), and adding castNumber in areas where it wouldn't even 
appear if it were just parsed as a number. (eg. 3*"3" = 9, but would have to 
cast 3*"pineapple" to 0.

This is because NaN does not cast to any number in js, so NaN+1 = NaN and 
pretty much every array access breaks as soon as a NaN value appears on 
anything. (as seen with games breaking to a white screen sometimes)

so whatever veggie made a wiki page for this so i'll check it out ok

Original issue reported on code.google.com by rhy3alte...@gmail.com on 14 Jun 2012 at 2:21

GoogleCodeExporter commented 8 years ago
Partially done.

Original comment by rhy3alte...@gmail.com on 15 Jun 2012 at 4:43

GoogleCodeExporter commented 8 years ago
I didn't make that page :L

Original comment by theflowe...@gmail.com on 15 Jun 2012 at 10:46

GoogleCodeExporter commented 8 years ago
you make everything on the scratch wiki

Original comment by rhy3756...@gmail.com on 15 Jun 2012 at 11:51

GoogleCodeExporter commented 8 years ago
No I don't I just mercilessly edit it!

Original comment by theflowe...@gmail.com on 16 Jun 2012 at 3:40

GoogleCodeExporter commented 8 years ago
Did some micro optimization to remove the speed impact of this by 10x.

Original comment by rhy3756...@gmail.com on 17 Jun 2012 at 12:58

GoogleCodeExporter commented 8 years ago

Original comment by rhy3alte...@gmail.com on 20 Jul 2012 at 6:27

GoogleCodeExporter commented 8 years ago
Done with as minimal performance overhead as possible.

Original comment by rhy3alte...@gmail.com on 5 Aug 2012 at 1:20