What is the meaning of: while false end

I’ve seen this line of code used in some packages and Julia source code:

while false end

I assume it’s used for precompilation, but I’m not sure.
Could someone explain what the purpose of this line of code is?

Linking related PR.

1 Like

Thanks @rafael.guerra !

1 Like

What does it mean to “disable the interpreter”?

@leandromartinez98, you replied to me but that is something far beyond my knowledge!

May be that shortcut code does not get interpreted and goes straight to compilation & execution?

2 Likes

Just as you can either choose to execute sin(1.0) “the normal way” or with

using JuliaInterpreter
result = @interpret sin(1.0)

so too Julia comes with its own built-in interpreter as an alternative to the compiled execution pipeline. There’s a heuristic for deciding which pipeline to use (all this happens behind the scenes so you don’t see it). But occasionally you need to control which one gets used, hence the PR.

3 Likes

I didn’t know Julia had an interpreter. How does it work?

Pretty much the same way the external one, JuliaInterpreter, does. The built-in interpreter doesn’t have the foundations needed to build a debugger, hence the external one; the external one is also documented, including some pages focused on explaining the inner workings.

In the long run, it might make sense to try to share as much infrastructure as possible, but I think there’s some ground work to lay first (we probably want a more efficient representation of lowered code for execution).

6 Likes