Compile-time calculation: Difference between revisions
Content added Content deleted
(Added FreeBASIC) |
(Lingo added) |
||
Line 475: | Line 475: | ||
<lang julia>foo() = @fact 10</lang> |
<lang julia>foo() = @fact 10</lang> |
||
then the value of 10! = 3628800 is computed at parse-time and is inlined in the compiled function <code>foo</code>, as can be verified by inspecting the assembly code via the built-in function <code>code_native(foo, ())</code>. |
then the value of 10! = 3628800 is computed at parse-time and is inlined in the compiled function <code>foo</code>, as can be verified by inspecting the assembly code via the built-in function <code>code_native(foo, ())</code>. |
||
=={{header|Lingo}}== |
|||
As an interpreted language with the interpreter always being present, Lingo has no clear separation of compile-time and runtime. Whenever you change the code of a script at runtime, it's immediately (re)compiled to bytecode (in memory). You can also create new scripts at runtime: |
|||
<lang lingo>-- create new (movie) script at runtime |
|||
m = new(#script) |
|||
-- the following line triggers compilation to bytecode |
|||
m.scriptText = "on fac10"&RETURN&"return "&(10*9*8*7*6*5*4*3*2)&RETURN&"end" |
|||
put fac10() |
|||
-- 3628800</lang> |
|||
=={{header|m4}}== |
=={{header|m4}}== |