Comments (7)
I was wondering how a short circut XOR would work considering that each operand needs to be evaluated inorder for the xor semantics require an evaluation. The semantics of SCL logic dictate that only sub-expressions of a full expression be evaluated to some extent to short the logic, if they dont evaluate to a truth value to simply stop the evaluation. If we added a short-circut XOR operator, perhaps "^^". How would you implement SCL logic on it. I'm certian it isn't possible at all, the evaluation would need to take place, which means it cannot map 1:1 with operator logic. Any thoughts? I really want a SCL XOR :P
from gmqcc.
Simply not possible, because the result always depends on both operands. (False and X) = False, (True or X) = True, but (False xor X) = X and (True xor X) = Not(X), there's always a dependency here.
What WOULD make sense however is when we want perl-like results of logical operations. div0 mentioned he'd like that: x && b
would result in a ? b : a
, in other words, if a
is true, it yields b
, which doesn't necessarily have to be a boolean value. Eg. (1 && 5)
doesn't yield 1
but 5
, or (ent_a && ent_b)
yields the entity ent_b
if ent_a != world
. In this case, the XOR operator could work like described above: (a ? !b : b)
, however this could become a bit uncomfortable since !b
is always a boolean (ie. float
in QC), but b
itself could be an entity, so we'd need to implicitly cast false
to world
in such a construct.
from gmqcc.
since short circut evaluation cannot be implement on a logical XOR, we should still implement an operator for it, something along the lines of ^^, I cannot digress how much I despise the idea of !a != !b, which when truncated for whitespace looks insane "!a!=!b". I'd only allow this operator for -std=gmqcc, since I don't suspect another standard of the language implements it, but I know div would generally agree with I suspect; his perl-likeness of perl-like operators is insane, fteqcc even implements a backwards bitwise assignment operator, with negation, In C you'd use something like a&=b, in fteqcc it's a&=b, which is just insane. I suspect -std=fteqcc will need to implement this operator for fteqcc conformancy. Please open a ticket on this matter
from gmqcc.
Nice catch, I completely forgot about div's &~=
operator...
We now need 2 sets of tests: one for -fshort-logic, and one for this with an additional -fperl-logic.
from gmqcc.
I feel as if we should call -fperl-logic, f-omgwtfiswrongwithyou-logic
from gmqcc.
It's perfectly natural, many languages use it. shells, LUA, python, ...
from gmqcc.
added tests
from gmqcc.
Related Issues (20)
- internal error when a qc function is called with an empty parameter HOT 2
- How should I compile this? HOT 1
- Segfault when variable and typedef share name
- Wrong column numbers
- Broken XOR assign HOT 1
- enum : flag uses incorrect incrementation with =
- frame macro syntax broken with C-style functions HOT 1
- operator != and == does not work with comparisons against nil HOT 1
- invalid types for variable argument function assignment
- Broken char literals get accepted
- Inconsistent math with multiple assignments to the same variable HOT 2
- for loop bug HOT 7
- if(cond) + break; issue with -O3 HOT 1
- if bug HOT 1
- multiple constants with same value HOT 1
- A way to run GMQCC as a linter HOT 5
- Repository and fork
- failed to open `progs.src` for reading when in subdirectory
- Deduplicate emitted opcodes variants
- CRC mismatch when using C-Style Function Declaration on System Entity Fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmqcc.