Questions tagged [unions]
9 questions
56
votes
10 answers
Are there any unions for software developers?
Why does Software Engineering not have union representation like other professional occupations, such as teaching? Are there any unions for software developers that exist and are successful?

Engineer2021
- 3,238
- 5
- 28
- 32
14
votes
8 answers
Are you a member of a trade union?
Are you a member of a trade union? Why? Why not? If you are, and don't mind mentioning it, which one?
Do you know of any programmers who were helped by being in a union, or would have been helped by being in a union? Do you know of any programmers…

Scott
- 2,091
- 2
- 18
- 21
11
votes
3 answers
Naming of union and intersection types in TypeScript
In TypeScript, the following is called a union type:
number | string
and this is called an intersection type:
number & string
However, is the resulting type of the | not actually an intersection, and that of & a union?
From the docs:
For…

P Varga
- 329
- 1
- 8
4
votes
2 answers
Why does C not support direct array assignment?
In C you cannot assign arrays directly.
int array[4] = {1, 2, 3, 4};
int array_prime[4] = array; // Error
At first I thought this might because the C facilities were supposed to be implementable with a single or a few instructions and more…

user16217248
- 1,029
- 1
- 5
- 19
3
votes
3 answers
Is there any merit to using `union` to create an alias?
I've inherited a bit of code and saw something new. They have a data structure definition out in a .h file, and in various local files they'll declare:
union globalStructOstuff localVar;
Is there any merit to this?
I could see some if the global…

Philip
- 6,742
- 27
- 43
1
vote
1 answer
Is using lambdas and overload resolution a recommended way to write a visitor for a variant?
If I have a discriminated union and want to write a function piecewise, the following code works just fine, but is taking advantage of some fairly tricky (at least to me) stuff involving overload groups:
struct A { };
struct B { };
typedef…

Daniel McLaury
- 352
- 1
- 7
1
vote
4 answers
is stored procedure having multiple UNION efficient than running all SQL's in parallel?
I have below in my stored proc
if
then
SELECT TABLE1.COLUMN1,TABLE1.COLUMN2,TABLE1.COLUMN3,TABLE1.COLUMN4 FROM TABLE1,TABLE2 where criteria1 (covers functionality 1)
UNION
SELECT…

Vipin
- 141
- 1
- 8
0
votes
1 answer
How are discriminated unions (e.g. in TS) used in messaging schemes?
In the documentation about discriminated unions in typescript, here it says:
Discriminated unions are useful for more than just talking about
circles and squares. They’re good for representing any sort of
messaging scheme in JavaScript, like when…

Bahaa
- 127
- 4
0
votes
0 answers
Stable, Hash Based Symmetrical Difference
A lot of thought went into the implementation of the set algorithms in LINQ: Distinct, Except, Intersect and Union. They guarantee that the items are returned in the same order that they appear in before calling the method. So, these two expressions…

Travis Parks
- 2,495
- 1
- 19
- 23