assignment foor logic ops
issueid=655 14-11-2021 14:16
thinBasic MVPs
Number of reported issues by ReneMiner: 93
assignment foor logic ops

we have mathematical and string-ops with assignment in one go

As 1+=2
or
s$ &= " more..."

but for ops as Or "|" id no "=|" but if thats because "|" is the only symbolic operator could we write

"And=" "Or=" "Xor="
X And= 1
were equal to
X= X And 1

Y Or= 2
equals
Y = Y or 2

Z Xor= True

Z = Z Xor True

common symbol for NOT is exclamation mark
X AND! 1
X = X And Not 1

Y OR! 2
Y =Y Or Not 2

z XOR! False
Z = Z Xor Not False


for strings thereare no operations but 3 ways of concatenation &=, += .=
while i think the only way to work using replacements using curly braces with numbers is lacking some direct ways.


STRFormat$ ("This {1} String {2} And {3} line", "is a", crlf, "another")
it could have predefined

{\n} new line (curly braces avoid wrong replacements if string is a path for example)
{\q} quote

and the other way around if we append oor assign a string-expression that should hold variables not put them behind the text and make it a long snake of verbs that replace numbers in curly braces
but just like
Long importantValue = 123
String s$ ?= "this is an incomplete string as the question mark tells there are{\n}some {\q}minor{\q} replacements to do and at least {importantvalue} expressions to replace."
Issue Details
Issue Number 655
Issue Type Feature
Project thinBasic
Category Core engine (thinCore.dll)
Status Suggested
Priority Unknown
Suggested Version 2.0
Implemented Version (none)
Milestone (none)
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)




15-11-2021 19:20
thinBasic MVPs
I forgot to mention the lacking features of logic comparisons "If X And 1 Then" etc. to Select Case & Array Scan :

Very badly requires Array Scan to find array members theres values have a set certain bit -
but that is probably better a NUMERIC VERSION OF ARRAY EXTRACT
which will fill all elements of array A() into array B() when A(index) And Bitmask matches
bitmask must be same type as variable typeOf A() while B() could be any higher integer type as well
floats can not be

Its not only to prevent from breaking array scan again - since the function capacity might be across the limits what a human brain is able to understand - but also makes more sense to extract all at once for the user than repeatedly to scan / imagine you have a text- document merged from different sources and these are partially ANSI, UTF8, UTF7/ASCII encoded - a wild mix of chars
Its easy to find the end of sentences or paragraphs and actually to convert this mix into something readable its mandatory to find all chars theirs 8th Bit(=128) is set or not set. The "not set" go to Ascii the once in a while set go to ANSI and the ones that go to utf8 are such that are multiple bytes in a row > 127, since they were extracted already we have exact values to scan for...

And Select Case or some similar working function as Choose(), In() or Swiitch() to filter Bitmasks or sort values to proceed them in separated branches but not excluding any other branches as Select Case does but process all matching cases for a condition and without the need to repeat a thousand times " If X And... If Not X And" and the need to have big blocks of code either outsourced to additional functions or repeated within another if-blocks. I have no names for it yet i try to give a pseudo-basic-example:

Long lFlags ' is the variable thats bits are to examine, lets say it equals 5 (bit 3 and bit 1 are set if we agree the lowest bit with the value of 1 is "bit 1" ) and no "bit 0" exists but the exponentiation of "Bit 1"is 0 times
Function FATBOY: Filter According To Bits Of Yield(<container>)
the state in the moment of request is what is filtered for : it must not enter other branches than the ones matching rtight now.
If the value in lFlags changes must not lead to a difference what matches and what does not match
'proceed all branches that match using  logic bit comparison 
' Filter ATBOY  lFlags 

Begin Filter lFlags
Match And 1
' this to process in case( Flags And 1) = true

Match And Not 2 
'   process this in case( Flags And Not 2) = true
'   means the filtered "Match And 1"  above was processed  
' if the value of 5 is contained . And this is to process too
Match And 3
' ' not matching a 5,' skip this

Match And Not 4 
' not matching since 5 = (4 or 1) And Not 4 = False

Match And 2 
' not a match 
  ' the order as the user places the match-lines should be followed.
 The User must be aware that any changes to lFlags will force an
  Exit Filter 
' and no further matches are checked
 ' alike SelectExpression for select case it should allow to retrieve the value without the need to know the current filtered variables name

End Filter

+ Reply