Administrators Jon Posted May 27, 2004 Administrators Posted May 27, 2004 With the GUi stuff you often have to AND/OR various values together to get the value you want and the BitAnd() / BitOr() functions are a bit nasty for this. We've pretty much run out of operators so I was going to add in "bitand" "bitor" as new operators but that would mean the removal of the functions of the same name and that would break old scripts. Damn my naming conventions Options are: 1. add new operators named BitAnd, BitOr etc and remove the functions - breaking existing scripts (we can only assume that games with their pixel scripts will already be using at least some ANDing) 2. add new operators bAnd, bOr and leave the functions in as well for backwards compatibility 3. Modify the existing bit functions to take lots of optional parameters (David suggested this ages ago) so you can do things like BitOr(1, 2, 3, 8, 16, 22) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Valik Posted May 27, 2004 Posted May 27, 2004 You could always use && for bit and and || for bit or. It might be confusing to C++ experienced people at first, but it's still somewhat logical, I guess. My preference would be to see it as an operator and for it to be reallyshort, like 1 - 2 characters. Option 3 would be okay, but it's not as intuitive to use unless they are operators.
CyberSlug Posted May 27, 2004 Posted May 27, 2004 I vote for "||" && "Option 3" Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Administrators Jon Posted May 27, 2004 Author Administrators Posted May 27, 2004 I had thought of the && thing but I thought it would have been completely backwards for the C people. There are BitXOR and BitNot as well which could complicate things further && BitAnd || BitOr ! BitNot (or !!) ^ is already power, so ^^ for bitxor Hmmm... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Nutster Posted May 27, 2004 Posted May 27, 2004 (edited) As an experienced C person (has it really been 15 years already?!), I can easily adapt to &&, ||, ^^, !! for bit-wise operators. As we are using & for concatination, ^ for power and ! for logical not, doubling up for all makes sense. Leave the functions for backwards compatibility. Besides, as a C person, I like being able to use operators to stick values together rather than functions.$x = BitOR(BitOR(2, 8), BitOr(16, 32))vs.$x = 2 || 8 || 16 || 32Turn the AND and OR operators into strictly logical operators. BTW, Can the same optimization that C does (not calling subsequent operations if the final value becomes known) be done in AutoIt for the logical operators? Edited June 2, 2004 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Valik Posted May 27, 2004 Posted May 27, 2004 I pretty much agree with all of what David said. Even though C++ is the language I use most, I can easily adapt to doubling up the symbols if it means we get to use them as operators. Plus not breaking scripts (Or at least moving things into a deprecation phase first) is always good, as well.
Josbe Posted May 28, 2004 Posted May 28, 2004 I agree too (#3). We need easy/fast operators like C. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Administrators Jon Posted May 28, 2004 Author Administrators Posted May 28, 2004 Can the same optimization that C does (not calling subsequent operations if the final value becomes known) be done in AutoIt for the logical operators?It's done this for a while If Func1() AND Func2() ThenIf Func1 returns false then Func2 will not be run. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
tylo Posted May 31, 2004 Posted May 31, 2004 (edited) AutoIt is written in C++ (a de facto standard programming language), which uses &&, || and ! as logical operators only. Using them as bit operators in AutoIt is IMHO not the best option, as it easily could lead to confusion. If & and ^ wasn't already used, it would be nice to use the C bit-operators: &,|,^,~. But as it stands, I belive option #2 is the best:$x = 2 bOR 4 bOR 8 bOR 16 bOR 32If you really want to use C-like bit-operators, an alternative could be adding a prefix character to them, e.g. backslash: \& \| \^ \~ for bit -and,-or,-xor,-not:$x = \~(2 \| 3 \| 4)It's done this for a while If Func1() AND Func2() ThenIf Func1 returns false then Func2 will not be run.Great. I presume that also applies for:If Func1() OR Func2() Then ...If Func1 returns true then Func2 will not be run?(not using v102 yet, else I simply would test it). Edited May 31, 2004 by tylo blub
Administrators Jon Posted May 31, 2004 Author Administrators Posted May 31, 2004 Great. I presume that also applies for:If Func1() OR Func2() Then ...If Func1 returns true then Func2 will not be run?(not using v102 yet, else I simply would test it).It should be like that in .101 and even .100I'm pretty sure I got this change in before the initial release... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
tylo Posted June 1, 2004 Posted June 1, 2004 You most certainly did. And you never cease to amaze me. blub
Nutster Posted June 2, 2004 Posted June 2, 2004 AutoIt is written in C++ (a de facto standard programming language), which uses &&, || and ! as logical operators only. Using them as bit operators in AutoIt is IMHO not the best option, as it easily could lead to confusion. If & and ^ wasn't already used, it would be nice to use the C bit-operators: &,|,^,~. But as it stands, I belive option #2 is the best:$x = 2 bOR 4 bOR 8 bOR 16 bOR 32If you really want to use C-like bit-operators, an alternative could be adding a prefix character to them, e.g. backslash: \& \| \^ \~ for bit -and,-or,-xor,-not:$x = \~(2 \| 3 \| 4)Actually there is a very well-defined standard for C++ . C++ is being used because of the power we can get out it and we need the low-level interfaces to make AutoIt do all we want it to.I tend to figure out when I am programming in C/C++ and in AutoIt pretty easily. The changes in operators is not big deal. Anybody else remember APL? \| That is just ugly, IMHO. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
tylo Posted June 3, 2004 Posted June 3, 2004 \| That is just ugly, IMHO.Ok, I admit It's not the nicest.Yeah, we can all adapt, but why squeeze in those strange C++ bitoperator characters anyway?I think BAND, BOR, BXOR, BNOT is fine, and follows the style of AutoIt's AND, OR,.. operators. Enough said on this issue from me. blub
Administrators Jon Posted June 3, 2004 Author Administrators Posted June 3, 2004 (edited) Ok, I admit It's not the nicest.Yeah, we can all adapt, but why squeeze in those strange C++ bitoperator characters anyway?I think BAND, BOR, BXOR, BNOT is fine, and follows the style of AutoIt's AND, OR,.. operators. Enough said on this issue from me. VBScript actually uses AND for both logical and bitwise AND which baffles the hell out of me as they work completely differently and have different levels of precedence too. Must be some egg heads working on that code Edited June 3, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Nutster Posted June 4, 2004 Posted June 4, 2004 Something-Heads anyway! So, do we want to use Band, Bor, BNot, BXor or &&, ||, !!, ^^ for the binary operators. I'm going to try that polling feature.While we are at it, can add % for Mod? David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Nutster Posted June 4, 2004 Posted June 4, 2004 I have added a poll to ask for opinions on this. Vote and we can check out in a few days (or whenever) to see how things are going on it. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Nutster Posted June 14, 2004 Posted June 14, 2004 Oh, no! We are tied in the poll. We need more people to vote. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Josbe Posted June 14, 2004 Posted June 14, 2004 (edited) I believe that there isn't great difference between BitOr to BOr. But the C++ style(||, &&, etc) is really an important change for the operators. Is needed a good reason for every criterion. (About the Poll)Edit: Another comment. Edited June 15, 2004 by josbe AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Nutster Posted June 15, 2004 Posted June 15, 2004 BOr, BAnd, etc. would be the operators, not functions, as in: $x = $flags BAnd 64 David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
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