PDA

View Full Version : Variable type assertions



calo_mir
Aug 22 2009, 05:39
How do I assert that the value of a variable is of a given type?

I wasted over an hour yesterday searching for a bug that would never have occurred had the language allowed me to check that a variable was not nil and was numeric.

Additionally, I wouldn't have spent an hour searching had the compiler actually given error messages that were even vaguely accurate.

This is a feature common to every scripting language I can think of (except Perl, perhaps). I can't see anything in the wiki that suggests this is possible to do.

Gigan
Aug 22 2009, 07:55
When you want to know value type, there is the typename command.
http://community.bistudio.com/wiki/typeName

calo_mir
Aug 22 2009, 08:10
Thank f*** for that!

Thanks.