Feature Request - Strict option for types

BlitzMax Forums/BlitzMax Programming/Feature Request - Strict option for types

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I don't know if I am the only one, but I often end up typing in something like

Local list=New TList

By mistake, when it should be:

Local list:TList=New TList

The first version still compiles under BlitzMAX, and will work with the list functions, but of course is outside of the scope of the garbage collector which may lead to leaks.

I would like a compiler switch, similar to Strict which would throw an error when trying to compile the first version, unless explicit casting is used.

For example:

StrictTypes

'This is okay
Local list:TList=New TList

'This is okay since explicit casting is being used
'This won't actually compile at the moment, you have to do something like "Local list=Int(Byte Ptr(New TList))" instead
Local list=Int(New TList)

'This reports an error
Local list=New TLIst