
The Frink Is Good, the Unit Is Evil - weinzierl
https://www.hillelwayne.com/post/frink/
======
geoffpado
In case you were wondering (as I was), what kind of fart joke could make
someone angry enough to write a programming language, HN has discussed it
before:
[https://news.ycombinator.com/item?id=1543428](https://news.ycombinator.com/item?id=1543428)

Direct link:
[http://futureboy.homeip.net/frinkdocs/#FartJokes](http://futureboy.homeip.net/frinkdocs/#FartJokes)

~~~
unnouinceput
Following on that, here is something:

" Thus, a good estimate to the problem stated above is that a real (gassy)
human would need to save their farts for:

12.5 kilotons TNT / ((methaneenergy + h2energy) / day) -> years
1.9379377133697419931e+7

or about 19 million years to make the equivalent of the energy in a (small)
atomic bomb! So the estimate given in that e-mail is off by a factor of at
least 2.8 million! "

Now Mexico City has around 19 millions souls, given or take, right?
(metropolitan area). That means, given the Mexican food is quite spicy and as
such it's kinda farty too, every year Mexico City is releasing a Hiroshima
bomb in potential energy every year through farts :).

------
throwaway744678
> In the UK, beer is measured using pints but its alcohol by volume is
> measured in SI.

Small nitpick here: unless I am mistaken, ABV is dimensionless, it's simply a
ratio volume of pure alcohol per unit volume.

~~~
tialaramex
I _think_ what the author is referring to is that other than beer (and cider)
the SI units are used to measure booze in the UK.

You don't even tend to buy _beer_ (or cider) by the pint outside of somewhere
"licensed to sell alcohol for consumption on the premises" (ie a bar, pub,
some restaurants). You order a pint (or a half, or a third, of very strong
beers or to taste test several beers) to drink now, but when buying cans or
bottles of beer for consumption later they're labelled in SI units like any
other beverage e.g. a 330ml can or a 500ml bottle are perfectly normal things
to see.

In a licensed premises the stronger classes of booze are measured in SI units
too but with a convenience factor for ordering and, for weird historical
reasons, each place of business gets to choose one of two definitions. For
example a glass of wine could be 150ml or 175ml. Customers might say "A glass
of the house red" but there must be a notice posted defining this as either
150ml or 175ml. Or vodka may be sold with a shot being defined as 25ml or as
35ml (again a posted sign tells you which) so you might say "A double vodka"
and that's defined as either 50ml or 70ml.

Though they're not technically required, many British licensed premises use
"optics" which are a device that fastens to a liquor bottle, the bottle is
then inverted and the optic displays to the customer that there's a fixed
measure of product (e.g. 35ml of whisky) ready to dispense, then a single
motion dispenses that product into the glass without need for the staff to
measure, when the glass is removed the optic refills ready for the next.

~~~
davedx
Yeah I worked in a 35ml bar and we were supposed to clarify with _every single
customer_ who asked for a double that it was going to be 70ml, really tiresome

------
quantified
Note of minor disagreement: there are large classes of quantities with units
that the article claims are unitless. It’s a question of ability to describe
the units. You need more components to your unit algebra to describe ratios
and percentages, this lets you ascribe units to (and check units of)
statistical operations and much more sophisticated expressions.

You definitely need a way to describe counts of identities too, which takes
you into the land of ontologies as well. Happy to discuss with anyone who
geeks out on this stuff as well.

~~~
mdiesel
I make distinction between dimensionless and unit-less.

Radians are a unit, but are dimensionless. You'll end up in a world of trouble
if you got rad/s and rpm mixed up.

~~~
ShamelessC
I actually (embarrassingly) got tripped up by that a bit.

So, you're saying that radians/degrees _are_ a unit because we can use them to
describe a count of something, but they're still in fact dimensionless?

Is that because 2*pi or degrees never refer to an actual physical length? I
think that's what trips me up because I generally have thought of degrees and
radians as essentially units of length around a circle. But I suppose that
since we're working with circles of arbitrary rather than specified diameter,
they're still unitless.

I think I got to it on my own at the end there ha but I'm happy to be
corrected!

~~~
klyrs
One way to think about radians is "feet (of perimeter) per feet (of radius)"
\-- the dimensional units cancel and you're left with a dimensionless unit.

Taxes are a familiar dimensionless unit -- dollar owed to the government, per
dollar spent on snacks. The dollars cancel and you're left with a raw
percentage. (actually, to convert to a percentage you multiply by 100 percent
per whole; another dimensionless conversion)

~~~
quantified
If they are truly dimensionless, when is it meaningful to multiply a non-
currency value by them? There’s still a semantic that attaches the rate to
dollars obtained in a transaction.

------
emmanueloga_
Frink the language looks fantastic for all sorts of casual and even some
advanced use cases. How cool would it be if it would be possible to embed
Frink in, say, any markdown document, and render and solve it from any host
language? (specially JavaScript). I think the fact that the language is
proprietary and closed source is holding it back.

~~~
nickcw
Is the source of Frinklang available? I couldn't see it in a few minutes of
searching.

~~~
mkl
No it isn't. See "Why isn't this open source?" here:
[https://frinklang.org/faq.html](https://frinklang.org/faq.html)

------
yunruse
The note on timestamps – that they can be subtracted but not added to any
reasonable definition – is more generally an affine version of a unit. In this
case, time is affine because it has a reference point to which it is relative.

Temperature is another obvious affine unit, due to a constant reference point.
You could argue contextual measurements (eg voltage) may be affine in
circumstance, but that’s covered better by experimental technique than a unit
definition.

------
david_draco
Units are supported by a few python packages:

* [https://pypi.org/project/units/](https://pypi.org/project/units/)

* [https://pint.readthedocs.io/en/stable/](https://pint.readthedocs.io/en/stable/)

* [https://docs.astropy.org/en/stable/units/](https://docs.astropy.org/en/stable/units/)

~~~
baryphonic
SymPy's units module is excellent, and the best I've found in Python.[0]

[0]
[https://docs.sympy.org/latest/modules/physics/units/index.ht...](https://docs.sympy.org/latest/modules/physics/units/index.html)

------
bcatanzaro
Was surprised the author didn’t bash Celsius degrees - because of their non-
zero affine constant they don’t work in a system where units are supposed to
multiply. (And so I would imagine they pose problems for Frink).

Ask any high school chemistry student struggling with PV=nRT. You stick
Celsius degrees in there and you lose. And unlike other SI units, conversion
requires an addition, not a multiplication.

~~~
tialaramex
Celsius isn't an ISO base unit. Just use Kelvin everywhere, you can get used
to it pretty easily. It's almost 300K here right now, which is too hot for my
liking.

~~~
bcatanzaro
Sure it’s not an ISO base unit, but then again neither are most of the things
in Frink.

+1 to the idea that real scientists use Kelvin for everyday life.

~~~
tialaramex
I'm not a scientist, it was just easier once I got used to it. Also I don't
like heat and in Kelvin my main argument in support of this (what should be
entirely a personal matter of taste but it's _fun_ to argue about matters of
personal taste like which is the best movie) is more obvious than in a system
like Celsius with an arbitrary zero.

The coldest it is possible for anything to be is 0K. That is indeed too cold,
but only about 280K less than the inside of my refrigerator or a glass of
Coke. You can wear gloves to (carefully) handle something at almost zero and
colder is not possible.

On the other hand things get _way_ hotter, there is an essentially unlimited
amount too hot that things might be. Boiling water is too hot (not even 400K),
a pizza oven is even hotter (700K plus for a good one) but lava is much hotter
than that, yet lava is a naturally occurring substance, it's just right there
in our environment whereas there's no chance of stumbling onto anything at 0K.

------
gumby
C++ has standard support for chronological measurements and there is an effort
to extend this to other units for C++23. Compile time or runtime.

------
kangnkodos
"Units can have different historical values. A foot is defined as exactly
0.3048 meters. Before 1959, though, it was 0.3048006 meters. This is means
that all historical documents have a different measurement of foot. And there
was a period of time where we used both definitions in different places!"

In the US, different definitions of a foot are still used in different states
today. The plan is to standardize on 0.3048 meters at the end of 2022.

[https://www.sco.wisc.edu/2019/10/18/us-survey-foot-to-be-
dep...](https://www.sco.wisc.edu/2019/10/18/us-survey-foot-to-be-deprecated-
on-december-31-2022//17/2019-22414/deprecation-of-the-united-states-us-survey-
foot)

------
GnarfGnarf
C++ can do an excellent job of catching unit mismatches at compile time. We
have developed classes that support this:

    
    
        cInches in1, in2, in3;  // basically 'floats'
        cCm cm1;   // floats
        void foo(cInches);
    
        in1 = in2 + in3;  // OK
        in1 = in2 + cm1;  // compile error
        in1 = in2 * in3;  // compile error: square inches are not inches
        in1 = in2 / in3;  // compile error
        float x = in2 / in3;  // OK
        foo(in1);  // OK
        foo(cm1);  // compile error
    

Classes like these have made the code much more readable, maintainable and
reduce errors.

------
kbob
Has everyone forgotten /usr/bin/units ?

    
    
        $ units furlong/fortnight c
                * 5.5474886e-13
                / 1.8026175e+12
    

It's been there since the 1970s...

------
ajuc
> What’s 20° + 1 radian? They’re both unitless quantities that have compatible
> dimensions.

How are they unitless if you add ° behind one and "radian" behind the other?

~~~
croutonix
They're not unitless, they're dimensionless, see
[https://math.stackexchange.com/questions/803955/why-
radian-i...](https://math.stackexchange.com/questions/803955/why-radian-is-
dimensionless). I think the author made a mistake.

~~~
tantalor
[https://en.wikipedia.org/wiki/Radian](https://en.wikipedia.org/wiki/Radian)

> the SI unit for measuring angles

> defined in the SI as being a dimensionless value

------
juped
This is cool. I have generally pulled out my TI-89 or HP-50 to do dimensional
calculations.

------
twarge
Calca is way more natural for me. We could use an open implementation.

------
Gys
About the Frink programming language

