[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal for compile-time dynamic code or something (was: proposal for reading individual characters from strings faster)
- From: Coroutines <coroutines@...>
- Date: Sat, 3 May 2014 14:27:13 -0700
Hmm, you are using this like a macro facility :p
You could do this 2 ways. Either way the function that executes at
compile-time should return something that can be represented as a
literal:
local debirand = function () return 4 end
local a = @debirand()
Or:
local C = function (c) return string.byte(c) end
if c == @C('?') then ... end -- becomes:
if c == 63 then ... end
The other part is the functions that execute at compile-time can
either take literals where they are called (so the compiler can
evaluate these by starting up a minimal Lua instance and running the
function), or it could also take arguments that reference other values
known at compile time:
local questionMark = '?'
@C(questionMark)
I don't really expect this to be upvoted....... still fun to dream :-)
- References:
- proposal for reading individual characters from strings faster, Coroutines
- Re: proposal for reading individual characters from strings faster, Philipp Janda
- Re: proposal for reading individual characters from strings faster, Coroutines
- Re: proposal for reading individual characters from strings faster, Petite Abeille
- Re: proposal for reading individual characters from strings faster, Coroutines
- Re: proposal for reading individual characters from strings faster, Tim Hill
- Re: proposal for reading individual characters from strings faster, Coroutines
- Re: proposal for reading individual characters from strings faster, Tim Hill
- Re: proposal for reading individual characters from strings faster, Coroutines
- Proposal for compile-time dynamic code or something (was: proposal for reading individual characters from strings faster), Thiago L.