Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Option Request
Author | Message | ||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi I was playing with some older code and discovered a problem with the variable names as some of the different types of variables have the same name Then after reading the change log properly " To prevent a common type of programming error variables with the same name but different types are no longer supported. ie, var = 123 : var$ = "abc" will now cause an error" So the question is would to be possible to make this an option ie on by default and off by setting an OPTION Variabletype off or some thing similar Anybody else with any thoughts around this ? Regards Jman |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
John I don't care if this is an option or not but I would never knowingly use variables the way you describe. If there is a need to associate variables by name then I would use a descriptive appendage or similar. Example: var.one var.two Bob |
||||
G8JCF Guru Joined: 15/05/2014 Location: United KingdomPosts: 676 |
In a previous post about this subject, http://www.thebackshed.com/forum/forum_posts.asp?TID=7078&PN =3&TPN=5 and Peter The only Konstant is Change |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Thanks Peter I missed that one but I do agree with Robert Regards Jman |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9063 |
Sorry to pester you, and this is a slight digression from topic, but why is having A and A$ NOT being allowed a problem? Is it more just that it breaks existing code, and you have to port the code to the new version of MMBASIC? Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
If a variable name does not describe what it is used for then the name is wrong. Having a number and a string version of the same variable is just silly. It would save so much debugging time when that is not allowed that it will make up the little problem of changing existing code. A simple search and replace will do the change in a few seconds. . Microblocks. Build with logic. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9063 |
OK, I can see the logic in that now. Thanks. Smoke makes things work. When the smoke gets out, it stops! |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Oh Dear this going to be can of worms so this the last post about this for me. So if we had the hours of the day in a string say hours$ but now we wanted this as an integer to do some math on then calling the variable hours is silly really !!! Jman |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
HoursText$ Hours Problem solved. Microblocks. Build with logic. |
||||
Dylan Regular Member Joined: 17/06/2013 Location: NetherlandsPosts: 81 |
Hour$ Hours Even simpler. |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Dylan; I'm with you on that one - however I see any 'well fuelled eyes' missing the odd '$' and 'S' typo among a big listing!! For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
Print this page |