You don't need a new programming language for something that C++ templates with integer constants give you for free.
Show HN: Numbat – A programming language with physical dimensions as types
11–20 of 122 posts
Re: Show HN: Numbat – A programming language with physical dimensions as types
#12I've seen from to time some empirical equations that result to this. Usually, it's just hand-waved away and the non-integer units are ignored or dropped when the transcendental function is evaluated. I guess the trivial answer is probably add an extra factor with a value of 1 with the reciprocal units to result to the said type 1 for dimensionless units?
Re: Show HN: Numbat – A programming language with physical dimensions as types
#13You don't need a new programming language for something that C++ templates with integer constants give you for free.
Can you provide examples?
- 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 dimensions as types
#14You don't need a new programming language for something that C++ templates with integer constants give you for free.
Can you provide examples?
Re: Show HN: Numbat – A programming language with physical dimensions as types
#15You don't need a new programming language for something that C++ templates with integer constants give you for free.
Can you provide examples?
Re: Show HN: Numbat – A programming language with physical dimensions as types
#16Re: Show HN: Numbat – A programming language with physical dimensions as types
#17Earlier quoted context omitted.
All are physical units. In particular in special relativity time is couples with position and you myst use cuadrivectors (t, x, y, z).
Time exists independent of location and can not be visualized in any "physical" way. The same is true for lots of other units of measure. https://phys.org/news/2012-04-physicists-abolish-fourth-dime...
Also, btw, you might want to read the article you linked. The article is discussing a fringe idea that some scientists have. Scientists are free to explore new ideas, and they make for good click bait for science journalists. Until those ideas gain traction, they don't provide for compelling arguments, though.
Re: Show HN: Numbat – A programming language with physical dimensions as types
#18I can't resist mentioning F# Units of Measure aka UoM :) https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
Re: Show HN: Numbat – A programming language with physical dimensions as types
#19I got curious and installed the CLI tool[1] and found that it does indeed account for leap second / leap years:
>>> let jahr: Time = 1 year
>>> let tage: Time = jahr -> days
>>> tage
= 365.243 day [Time]
References:Re: Show HN: Numbat – A programming language with physical dimensions as types
#20So if I try to get the Falcon to do the Kessel run in two Parsecs, Numbat will raise an exception.