News for hackers. Stuff that matters.
Re:Show HN: Numbat – A programming language with physical di... by antoineMoPa on Thursday November 16, 2023 @11:27AM (#38291566)
Can you provide examples?
Re:Show HN: Numbat – A programming language with physical di... by pif on Thursday November 16, 2023 @11:32AM (#38291635)
- you define a template class accepting 1 constant integer for each dimension you want to consider (length and/or time and/or mass and/or temperature);

- you define addition and subtraction between objects of one type returning an object of the same type;

- you define multiplication and division as returning an object of a type with the dimensions summed or subtracted;

- and you get dimensional correctness via type safety.

Re:Show HN: Numbat – A programming language with physical di... by n_plus_1_acc on Thursday November 16, 2023 @11:34AM (#38291663)
Re:Show HN: Numbat – A programming language with physical di... by n_plus_1_acc on Thursday November 16, 2023 @11:33AM (#38291646)
https://crates.io/crates/uom trivially convertable to cpp
Re:Show HN: Numbat – A programming language with physical di... by leakim on Thursday November 16, 2023 @01:15PM (#38293240)