From my understanding, now there are two problems:
- Using a “safe” version of number datatypes with all validation checks is an expensive operation which slows down the program. And one set of Julia users are ready to understand these intricacies and is ready to appropriately modify their variable types to get accurate answers
- Another set of Julia users don’t want to get into the intricacies of computing and just want to get their stuff done “accurately”; they may be ready to take a little speed penalty on the way.
I should say I’m a bit of both the groups. When I work on my side projects, I would be really happy to dive into the intricacies of high-performance code and is happy to learn a lot of new stuff on the way. But when I use Julia for my research purpose/simulations, I will mostly be dwelling on the research problem and may not be in a state to go through the intricacies; at this time, I’m more concerned about the result than how fast I got it. But these two are not isolated anyway; the experience from first usually helps me in the second to write both fast and accurate code. It is always an empowering experience, but at times with slight irritations.
Since Julia is advertised as a “high-performance language for scientific computing”, I believe Julia should take care of both the groups of people to grow. I see that the core Julia developers and Julia community are doing a great job in producing high-quality software and distributing it free of cost. I completely appreciate that. But I believe the current Julia community is most of the “early adopters” and to break into the bigger community, we need to be able to cater to the second group as well.
I understand that each decision regarding the core of Julia is taken after much discussion inside the community and it is perfectly right to keep the core focused on “high-performance”.
What I want to propose is a small trick outside of the core of Julia. Is it possible to define a function, which when called on Julia startup will provide a “safe” environment for scientists? This safe environment will automatically take care of safe types: ie a = 10
after this function call will make a
a SafeInt
or something similar which includes all the checks that is required for accurate answers?
Examples use case (without safe environment):
julia> 10^19
-8446744073709551616
With a safe environment (hypothetical)
julia > enable_safe_env() # That hypothetical function which makes all data types Safe
julia > a = 10^19 # At this point, 'a' should automatically be of type 'SafeInt64', without the programmer bothering about it.
ERROR: OverflowError: 10^19
Stacktrace:
[1] ^(::SafeInt64, ::SafeInt64) at /home/rdeits/.julia/packages/SaferIntegers/eMjmj/src/pow.jl:45
[2] ^(::SafeInt64, ::Int64) at /home/rdeits/.julia/packages/SaferIntegers/eMjmj/src/pow.jl:71
[3] macro expansion at ./none:0 [inlined]
[4] literal_pow(::typeof(^), ::SafeInt64, ::Val{19}) at ./none:0
[5] top-level scope at none:0
Now, in this case, all that is needed by the second group (who don’t want to get into the intricacies of computing) is just to make sure that there is this function call at the top of all their scripts and they can be sure that their experiments will not have any overflow/underflow problems.
Is it possible to create such a function, maybe as an external package, which can ensure a safe environment? My skills with Julia are just developing and is not enough to know where I should start for such a requirement. I would like to know whether community will be interested in such a solution and can we develop it together?
Regards,
v-i-s-h