----------------
Alan Karp
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CANpA1Z1Q--Sfz8RNpzQ-dF_%2Bae0v5fZeek1_HWNbFX-kk_6ofg%40mail.gmail.com.
On Fri, May 8, 2026 at 6:47 PM Alan Karp <alan...@gmail.com> wrote:
>
> https://www.gingerbill.org/article/2026/05/03/signed-by-default/
>
I suppose there is also a "unsigned integers are unnatural numbers" camp, where
we point out that the natural numbers never have a subtraction
operator, they can have a truncated subtraction like monus.
But we can also have forms of subtraction that return some form
including a pair of "spaceship operator" (< or == or >) and absolute
difference.
I'd rather see systems languages that attempt to do some form of
bounded natural numbers, than keep on repeating these same
algebraic mistakes. Instead of just cutting them down a peg by doing
them not by default. I suppose this is really just saying if you need
to ensure sane algebraic rules followed, you probably want something
dependently typed.
But even when not default, whenever you reach for the unsigned
integers for all the millions of cases where you don't have negative
indices
it isn't like these pitfalls have just disappeared because they are no
longer default. shrug
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CACTLOFrmBxRnmh_bxPEz%3DqWNo%3De7csB7wXvvwAbxCsaxvZfERA%40mail.gmail.com.
The problem is with the int class of types. Overflow is inevitable, signed or unsigned, and the consequences can be devastating.
The solution is to eliminate int in all of its forms. Instead, have a single floating point type that has excellemt performance on integers. You get the performance and eliminate the danger. That is what DEC64 does.
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/419a2a62-1a7e-4099-b9b2-fea2d168a67cn%40googlegroups.com.
The problem is with the int class of types. Overflow is inevitable, signed or unsigned, and the consequences can be devastating. The solution is to eliminate int in all of its forms. Instead, have a single floating point type that has excellemt performance on integers. You get the performance and eliminate the danger. That is what DEC64 does.
To view this discussion visit https://groups.google.com/d/msgid/friam/CAJ7XQb6CFJ69NcqZ2oWSOD%3D5wvExSMGJdgsq%3Dq%2BYTyqEXxvbXQ%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CANpA1Z2%3DHYOOrqd26mR6VuQF2rs0X%3D1nim9Q3Jck82LFyPgOfA%40mail.gmail.com.
Result promotion, virtual integer types, big integer types and integer bit width generics can prevent that and allow some space to solve this without resorting to variable sized integer types
a: u8 = 53b: u8 = 34c: u16 = a * bThe question is: what happens to a * b?
On 5/9/26 5:29 AM, Douglas Crockford wrote:
> The problem is with the int class of types. Overflow is inevitable,
> signed or unsigned, and the consequences can be devastating. The
> solution is to eliminate int in all of its forms. Instead, have a single
> floating point type that has excellemt performance on integers. You get
> the performance and eliminate the danger. That is what DEC64 does.
My problem with going straight to floats is that you end up having to
carry around 5.0001, and decide whether to tell the user it might as
well have been 5. And similarly, dividing by 3 and then multiplying by
3 loses precision.
I built a ratio package when I was at Agoric so that we could multiply
and divide financial numbers and manage the rounding. (If you worry
about sensitivity analysis, it often makes sense to put off the
divisions as long as possible.) The other thing we did was attach units
to all ratios so you could tell when you accidentally multiplied when
you should have divided or used the wrong exchange rate.
I thought it worked pretty well.
Chris
--
Currently reading: Rivalry and Central Planning, Don Lavoie;
Vault of the Ages, Poul Anderson; Salt, Adam Roberts; Why
Plato Matters Now, Angie Hobbs.
Chris Hibbert
hib...@mydruthers.com
Blog: http://www.pancrit.org
http://mydruthers.com
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/787e7d1c-1167-4db9-a449-d0cef038145b%40mydruthers.com.
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/8462c59a-5d4c-4b0a-bb81-4c2bf22032ed%40mydruthers.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CAMpet1V6LqhTSBD9cTJGr%2B1-bn9qaped3kEZvvBrVn1fcw3JQA%40mail.gmail.com.
A very nice explanation.I wonder about where the 2KB basic unit comes from rather than just using a general bigint.
To view this discussion visit https://groups.google.com/d/msgid/friam/CANpA1Z3MMZLTuc1f2iU1aJ8FhMXmhnJ63fysHoNqJU-%2BXgL-qQ%40mail.gmail.com.
--------------
Alan Karp
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CANpA1Z1Q--Sfz8RNpzQ-dF_%2Bae0v5fZeek1_HWNbFX-kk_6ofg%40mail.gmail.com.
I should think there is potential benefit in statically tracing floating point precision.
--
You received this message because you are subscribed to the Google Groups "friam" group.
To unsubscribe from this group and stop receiving emails from it, send an email to friam+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CAJ7XQb7RtzrPb9k5sR-tP_N6mXAiHDOz2Sya_yL%3DxcANENh_yQ%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CAMpet1WnFdP716nvyuv2tQyiwEueVnrQ4vME7RDQOxCW-RXyow%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/friam/CAMpet1Xw3cVdHhq%2BKCj6t1EAc%2B7X94f5J0ZQ2B8fUiHXD%3DuHnA%40mail.gmail.com.
I don't think you need to introduce a specific language feature. Rust has the concept of newtype for this problem. You would write Struct Nondimensional(f64), and let pi = Nondimensional(3.141593).
To view this discussion visit https://groups.google.com/d/msgid/friam/CANpA1Z1UWoyix58-GvTp2%2BqUkb_ij6Ze%3DPu8Sxapd0wdzfRQFQ%40mail.gmail.com.
On Sun, May 17, 2026 at 9:04 PM Alan Karp <alan...@gmail.com> wrote:I don't think you need to introduce a specific language feature. Rust has the concept of newtype for this problem. You would write Struct Nondimensional(f64), and let pi = Nondimensional(3.141593).
In rust, uom is probably closer:
let pi = uom::si::f64::Ratio::new::<uom::si::ratio::ratio>(3.141593);
because letting newtype do dimensional analysis requires insane amounts of boilerplate.
But my concern is actually not about adding new types, or if adding annotions to existing types can do the trick of doing basic static dimentional analysis type safety, it is if the raw float types should even be there at compile time, or if 'some' explicit dimension annotation or dimention explicit type should be the only thing the developer can use in the first place.
That is, is any "implicitly" dimensionless float type enough "safe by default" to allow them in a safe by default language?
On Mon, May 18, 2026 at 12:40 AM Rob Meijer <pib...@gmail.com> wrote:On Sun, May 17, 2026 at 9:04 PM Alan Karp <alan...@gmail.com> wrote:I don't think you need to introduce a specific language feature. Rust has the concept of newtype for this problem. You would write Struct Nondimensional(f64), and let pi = Nondimensional(3.141593).
In rust, uom is probably closer:
let pi = uom::si::f64::Ratio::new::<uom::si::ratio::ratio>(3.141593);
because letting newtype do dimensional analysis requires insane amounts of boilerplate.
But my concern is actually not about adding new types, or if adding annotions to existing types can do the trick of doing basic static dimentional analysis type safety, it is if the raw float types should even be there at compile time, or if 'some' explicit dimension annotation or dimention explicit type should be the only thing the developer can use in the first place.
That is, is any "implicitly" dimensionless float type enough "safe by default" to allow them in a safe by default language?
Some extra specific context from my pet project. A blog post on the subject. I've left the implicit dimensionless question as an open issue in the "Implicit dimensionless floats?" section.