AZJIO Posted March 22, 2013 Share Posted March 22, 2013 Shanheavel Local $oDict = ObjCreate("Scripting.Dictionary") $oDict.CompareMode = 0 ; binar $oDict.Add("VAL", -45.961) $oDict.Add("val", 34) $oDict.Add("VaL", 1) $sStr = "VAL: " & $oDict.Item("VAL") & @CRLF $sStr &= "val: " & $oDict.Item("val") & @CRLF $sStr &= "VaL: " & $oDict.Item("VaL") MsgBox(32,"Variable",$sStr) My other projects or all Link to comment Share on other sites More sharing options...
czardas Posted March 22, 2013 Share Posted March 22, 2013 @Shanheavel FASM looks very interesting. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
BrewManNH Posted March 22, 2013 Share Posted March 22, 2013 (edited) I don't agree. That's matter of perspective and from my perspective case sensitive is more natural solution. Besides, argument that all serious programming languages are case sensitive is pretty strong.I disagree, case sensitive is not more natural, everyone knows that Dog and dog refer to a canine in written English, but in programming they aren't the same. SomeVariable should be the same as someVariable, it's much more natural that they mean the same thing because that's how humans think. My tongue in cheek reference could very well describe a real world situation where 2 variables with the same letters but different case can mean two completely opposite things in code. As a general rule you probably shouldn't ever do something like that, but if the language was written that way, then you can get away with it. Is that good coding practice? I'd say no.What if you write a program that used the word "Sleep" to put a computer system to sleep, and "sleep" to wake it back up and someone's finger slipped off the caps lock key when programming it? Some random bug gets inserted that randomly puts your computer to sleep and you can't figure out why, because the compiler doesn't see that you use the same word for 2 different operations.As to other programming languages having case sensitive variables, there's probably just as many that aren't. Edited March 22, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
trancexx Posted March 23, 2013 Share Posted March 23, 2013 What if you write a program that used the word "Sleep" to put a computer system to sleep, and "sleep" to wake it back up and someone's finger slipped off the caps lock key when programming it? Some random bug gets inserted that randomly puts your computer to sleep and you can't figure out why, because the compiler doesn't see that you use the same word for 2 different operations.If programmer deliberately uses "Sleep" for one thing and "sleep" for completely different then he has bigger issues with his coding than case sensitivity. What you describe is typical case of code obfuscation, process of making code deliberately less readable. You render your main argument invalid by saying things like that.As to other programming languages having case sensitive variables, there's probably just as many that aren't.Ehh, right. czardas 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
czardas Posted March 23, 2013 Share Posted March 23, 2013 (edited) Case sensitivity allows many more options with less bloat, and has merit for this reason if no other. Sure naming your variables as Bull, Collie and Sheep is fine; but with Dog dOg and doG you know they are all dogs. I try to be consistant when naming variables. Also I don't like it when I see all lower case for function names such as: bitor, or keywords such as global. I would say it is not absolutely necessary to use case sensitivity for this project, but I do see the logic behind Shanheavel's choice. Besides being effective, Azijo's hex naming solution is still a bit tricky. Although not a preprocessor, I would say the technique is a type of preprocessing - conversion to case insensitive (hexadecimal character string) variable names. Edited March 23, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Shanheavel Posted March 23, 2013 Author Share Posted March 23, 2013 @AZJIONext unconventional way. I don't like working with objects, but it's nice that there are still people who have original ideas. I did test with your both methods.I've a list of the most important system functions (more then 2400 names):For $line = 1 To $aLine[0] Assign(StringToBinary($aLine[$line]), $line) $oDict.Add($aLine[$line], $line) NextI compared times of loops, which have to get one of the last functions name with every round.For $i = 1 To 1000 $sData = Eval(StringToBinary("WSAAsyncGetProtoByNumber")) Next ... For $i = 1 To 1000 $sData = $oDict.Item("WSAAsyncGetProtoByNumber") NextMy research shows that the first is about 15-40% faster. But it's good to have a comparison. Link to comment Share on other sites More sharing options...
BrewManNH Posted March 23, 2013 Share Posted March 23, 2013 If programmer deliberately uses "Sleep" for one thing and "sleep" for completely different then he has bigger issues with his coding than case sensitivity. What you describe is typical case of code obfuscation, process of making code deliberately less readable. You render your main argument invalid by saying things like that.No, I think it makes my poiint. Why would you use 2 words for variable names with only the case of some of the letters being different? What possible use is there for it? It makes your code much harder to trouble-shoot if you do that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
czardas Posted March 23, 2013 Share Posted March 23, 2013 (edited) It makes your code much harder to trouble-shoot if you do that.I would say that depends on the type of information you want to convey with the name. If you want a major or minor variant of something, normally refered to by a single name, then it should be easier than using a different unrecognized name. If you wish to cionvey more information, you could treat upper case as representing one, and lower case as representing zero. If I decide to sort a list of names and they are called something like 'majorItem' and 'minorItem', they are liikely to become separtated by a name such as 'maxValue'. I think there are valid reasons. Edited March 23, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now