The speed of light is an integer. Why should we care?

If a professor explains something to students and they do not understand, blame the students.

If the same professor explains the same thing on TV and people don’t understand, blame the professor.

We are now closer to the second pattern. :slight_smile:

You quoted me wrongly.

I said: “the problem starts at the physics students not being taught

I think the division behaviour in Python 2 vs 3 is a nice analogy :wink:

This changed last year

Since 2019, the magnitudes of all SI units have been defined by declaring exact numerical values for seven defining constants when expressed in terms of their SI units.

4 Likes

OK now I see your point after the edit regarding my last remark :wink: Yeah indeed, it’s closer then…

1 Like

That’s pretty much what SaferIntegers.jl is for.

1 Like

Yes, but to use this solution, you at least should be warned about its existence in the official documentation. As early as possible. That was the main point of my initial post.

1 Like

It is actually mentioned here.

2 Likes

It is done in the Frequently Asked Questions section at the very end of the documentation.

If users ask the corresponding question frequently, may be it is worth to explain it to them yet in the first sections of the documentation? Preferebly, when introducing the basic arithmetic operations. :slight_smile:

Great, thanks! Didn’t know it exists so I learned something today. :slight_smile:

I was curious about how LLVM handles integer overflow and this blog post came up. It seems quite relevant. Long story short - it’s a sacrifice for performance. Perhaps compiler people can shed more lights.

@giordano what’s up with the units in that example? shouldn’t it be m rather than J^1/2 s kg^-1/2?

They’re equivalent. Unitful.jl doesn’t normally simplify units.

Yes I know they’re equivalent, should maybe have made that clear - the question was more specifically why the units weren’t simplified. I thought Unitful did that, but clearly I haven’t worked enough with it.

1 Like

As Mason said, Unitful.jl doesn’t automatically convert to the simplest unit, because it’s not supertrivial and also because who knows what units the user wants? Physicists can use very strange units, for example the Hubble parameter has the dimension of the inverse of a time, but it’s usually expressed as a speed over distance, e.g. km/s/Mpc.

There is the upreferred function which kind of simplifies to the simplest units:

julia> using PhysicalConstants.CODATA2018, Unitful

julia> upreferred(sqrt(NewtonianConstantOfGravitation * (PlanckConstant / 2pi) / SpeedOfLightInVacuum ^ 3))
1.616255024423705e-35 m
8 Likes

Sweet, thanks for the explanation!

By definition, there are only a limited number of “first sections” in the documentation. You can’t put a lot of things there. Almost all the items in the FAQ are actually frequently asked.

We get this prediction a lot from people who don’t think that reading the docs is worth their time, and/or find that their quick proposals for redesigning the language are not met with wide approval.

FWIW, I am now resigned to the fact that Julia will be a niche language, with the niche defined as “used by people who actually read the docs”.

There are worse fates.

18 Likes

The first sections of the documentation are not overloaded with new information to say the least, so putting there a good example definitely does not hurt.

I am using Linux since the time Microsoft ended its suppot of MS DOS 6.22, that is, about 30 years already. Most of this time, the Linux community stated that their operating system is the best ever, and almost every question on how to do something in it was replied by just “read the documentation,” though the documentation at that time was and still is very poor, not complete and mostly out of date. The following suggestion to go and use Windows was also not rare at all. As a result, after about 30 years of development, the market share of “the best operating system ever” is still very tiny as it is shown here, and Linus Torvalds still have to answer questions on Why Linux is not competitive on desktops?

This errogant tendency has been changed only recently after Linux community was massively accused of being toxic.

The same happens here. In my initial post, I pointed out to the improvement that can be made to the documentation and got a lot of replied of the form: “It is already written there. It is already done in the best possible way. If you don’t like it, you are free to go and use any other programming language.” And that’s is just as toxic, arrogant and self-complacent as it was in the case of Linux.

Recently, I spoke with quite a lot of programmers trying to persuade them to try Julia or asking their opinion about it if they already tried it. Each of them gave me a very pricise answer on why he are not going to use Julia in his project. One of these answers, from a programmer currently working in Rust, which is far not the only programming language he ever used, was quite striking for me at the time. He said: “This project is far from being mature and its community is too self-complacent. So, I don’t believe that they will do a good product at the end.” Now, I do understand what he meant.

6 Likes

It seems like this thread has gotten heated enough that it would be better to let everyone cool down a bit.

15 Likes

This discussion is heating up, I think, because the topic is moving.

I quoted the primary problem of the OP (and others in other threads).
It is about expectations. What do people/users/developers can expect? What should someone expect? Shifted already to: what can someone expect from the Julia community!

The main problem Julia has, is, that it produces many many expectations, very divers expectations, like “it has to be a scientific calculator” (at least the REPL) or like “it must be faster than C++ or Java or Python” (put your own language in).

I see this pattern in many discussions: Julia as a general programming language, Julia as a data exploration language, Julia for scripting, … it must always be better than what has been used before.

As always and for everything, same for Julia, it can not be everybodys darling. Trying to be makes everybody unhappy.

To answer the quote above in a very simple way:

This is true. A powerfull language as Julia is, it should not be used as scientific calculator by an average student! I wouldn’t suggest to an average student to use Python as this. There are scientific calculators out there, use them!

But, if you want to learn something, if you want to be more than average, go and create your own scientific calculator and you may use Julia and the REPL to build up a new package “ScienceCalc”. Or use another language, as you wish. The important point is: If you want to use something, choose the right tool. If you want to create something, don’t be a user, be a creator.

This is, what Julia is for at first: to make new things possible. In a new and more productive way.
It is not about makeing old things better or faster.

PS: If I am wrong and OP is really only about integer overflow I say: This is so basic, it should not be part of some warning in some first sections of the documentation, because there would be so many other basic things, it would just not be readable for people, who want to learn Julia. In fact, integer overflow is a general problem in programming, it should be read in general programming books, not in specific language documentations. This
https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/#Overflow-behavior-1
is just perfect and enough.

6 Likes