Julia is a powerful language, so powerful it has many accidental features.
First, let’s use Tullio we can create a superset of shader onto basic Julia array. Hook it up to some rendering system and we basically accidentally can compete with GLSL or such.
Next, let’s turn to Black box optim.This tool seems innocuous, but hook it up to an experiment API and we basically have an automated experiment system. It’s unfortunate the search range was limited to being numbers, so we could only tune experiment parameters, but still…
So, if you keep digging, you may find more unexpected features Julia has to offer.
You are conflating the language with the package ecosystem. From the perspective of the language proper, of course packages are “accidental”, but they were written with a purpose in mind, and are not “features” of Julia — they are packages/libraries.
If I may provide a small suggestion for this discussion going forward, what might be worth considering is not so much accidental features, but rather, unexpected compositions of Julia with Julian packages.
I’d argue that your examples, similar to what @Tamas_Papp is suggesting, are superb examples of unexpected compositions within the Julia ecosystem. And how I define a Julian composition is the “process of combining specific packages or implementations together in order to solve another domain’s specific problems”. And unexpected compositions being those compositions which were not intended by the author but are a happy “side effect” of a package being used.
Don’t do this in general, another thread has gone farther to consider a macro for using zero-based indexing on 1-based arrays via begin+, and it identified notable exceptions e.g. :, firstindex, and any arbitrary methods, so it’s impossible to make a macro that covers them all. Offset-based indexing is only safe if you have literal integers to work with.
If you want proper zero-based indexing, OffsetArrays can wrap Arrays for that. You won’t be able to directly use methods that assume 1-based indexing like matrix multiplication, you’d have to do some unwrapping then rewrapping. But that won’t be a problem if the algorithm is implemented from scratch and doesn’t need other methods.
If you really need to stick to 1-based Arrays, it’s far safer to do the work and write the equivalent and idiomatic 1-based indexing, generic indexing (eachindex), inclusive endpoints, and for-loops than to add begin+ everywhere in very strange let-while-loops. Like I mentioned, inappropriate begin+ would cause off-by-1 errors, you’re not any safer by forcing C practices in Julia.
For the least effort with the most safety, you could try to get away with ccalling it and wrapping it in an appropriate Julia method signature, if you don’t need to add any capabilities via reimplementation.