News for hackers. Stuff that matters.
Re:How to pack ternary numbers in 8-bit bytes by jjgreen on Tuesday July 21, 2026 @04:55AM (#48989768)
Re:How to pack ternary numbers in 8-bit bytes by benj111 on Tuesday July 21, 2026 @04:59AM (#48989789)
Off the top of my head. Compilers. You may know that a value has known 1s and 0s and unknowns. This would allow you to represent that for optimisation purposes.
Re:How to pack ternary numbers in 8-bit bytes by Imustaskforhelp on Tuesday July 21, 2026 @06:36AM (#48990469)
Arturo[0] language supports true,false and maybe. I really liked that idea actually, worth mentioning here.

so valid arturo code can be like (picked from their in-a-nutshell documentation)

i1: true

i2: false

i3: maybe

[0]: https://arturo-lang.io/documentation/in-a-nutshell

Re:How to pack ternary numbers in 8-bit bytes by taneq on Tuesday July 21, 2026 @07:45AM (#48990982)
Everyone hates null but (in database land, and arguably in other programming) it just means “no data.”

(As an aside, I found the characterisation of null as being a “billion dollar mistake” to be unfair. Those who don’t acknowledge null are doomed to reimplement it, probably poorly, or to have the unknowns in their logic remain unknown unknowns.)

Re:How to pack ternary numbers in 8-bit bytes by mcherm on Tuesday July 21, 2026 @08:33AM (#48991507)
The "mistake" was not in providing a way to represent "no data", it was in providing no way to represent "this definitely HAS" data.

Languages that correct the problem have two separate types (eg: Foo & Option<Foo>) meaning "definitely a Foo" and "a Foo but it might have no data". Java just has Foo, meaning "a Foo but it might have no data" but no way to represent "definitely a Foo".

Re:How to pack ternary numbers in 8-bit bytes by mi_lk on Tuesday July 21, 2026 @05:04AM (#48989819)
Had a good chuckle
Re:How to pack ternary numbers in 8-bit bytes by abcd_f on Tuesday July 21, 2026 @06:49AM (#48990578)
If it weren't for Bool as a name, that's just 0 for OK, non-zero for errors with 1 being general failure.
Re:How to pack ternary numbers in 8-bit bytes by inigyou on Tuesday July 21, 2026 @09:20AM (#48991962)
TDWTF code is usually hyperbolized. It might not have been called Bool.
Re:How to pack ternary numbers in 8-bit bytes by WorldMaker on Wednesday July 22, 2026 @01:15PM (#49010081)
But also it could have been found in the wild in C/C++ code, which both had no "native" Boolean type until surprisingly recently (C++17 and C23! as in 2017 and 2023 standards, irrespectively) so Bool is very much a possible real name and not part of the hyperbole.
Re:How to pack ternary numbers in 8-bit bytes by woadwarrior01 on Tuesday July 21, 2026 @08:33AM (#48991502)
I've seen this pattern repeated in a number of large production codebases using optional booleans.
Re:How to pack ternary numbers in 8-bit bytes by hahahaa on Tuesday July 21, 2026 @09:12AM (#48991870)
I want an LLM trained on dailywtf code