Request: Disable implicit Int <-> Obj conversions

BlitzMax Forums/BlitzMax Programming/Request: Disable implicit Int <-> Obj conversions

Robert(Posted 2005) [#1]
Would it be possible to add a compiler directive (similar to Strict), which would disable implicit Int <-> Obj conversions, so:

Global image=LoadImage(filename)


Would not be allowed. This well-meaning 'feature' has caused me a few headaches and it would be nice to be able to turn it off.

StrictTypes maybe?


Perturbatio(Posted 2005) [#2]
how about just adding it into strict?


Dreamora(Posted 2005) [#3]
This is no implicit casting.

This is to allow procedural programming for those who want to program in the "old blitz way".

It activates an automatic system for handling which for example gives access on the release command.


N(Posted 2005) [#4]
I'd like to see this ditched so that there will be less confusion about freeing resources.

At the moment, people (specifically, new users) would think Release released any data type (other than the normal ones like Int, Long, etc.) and that FlushMem was something completely useless.

Not to mention that the documentation barely helps in making this clear for new users.


Robert(Posted 2005) [#5]
This is to allow procedural programming for those who want to program in the "old blitz way".



Hopefully Mark can clarify this.

In any case, I would like to see an option to disable it. In order to perform this kind of conversion in 'extra-strict' mode:

global img=(int)LoadImage(fileName)



Shagwana(Posted 2005) [#6]
When you declare the varibles you should also specify there :type. That should help you get away from these errors. For example;
Global image:TImage=LoadImage(filename)



Robert(Posted 2005) [#7]
When you declare the varibles you should also specify there :type. That should help you get away from these errors. For example;


I think you misunderstand me. I would like the compiler to *force* me to specify the type, and throw an error if I forget.


BlitzSupport(Posted 2005) [#8]
I basically agree with this, especially for Strict mode.


Damien Sturdy(Posted 2005) [#9]
I'd also like to see this. I've stumbled over it too.


marksibly(Posted 2005) [#10]
Hi,

Yes, this will happen soon - has caught yours truly out a few times too!


Robert(Posted 2005) [#11]
Cheers, thanks Mr Sibly!