lua-users home
lua-l archive

RE: Lua code generation and optimisation

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> On Behalf Of steve donovan
> Sent: woensdag 3 oktober 2012 15:26
> To: myshkin@cix.co.uk; Lua mailing list
> Subject: Re: Lua code generation and optimisation
> 
> On Wed, Oct 3, 2012 at 3:13 PM, David Collier <myshkin@cix.co.uk>
> wrote:
> > won't # if fred == nil then
> > fulfil the purpose?
> 
> That would be the syntax, yes - and 'fred == nil' there is a _compile-
> time_ value, which could be anything. Or you could have a big shouting
> IF.
> 
> > Indeed - I am thinking ahead to trying to get a worthwhile size of
> > program inside a single-chip-micro
> 
> Then I fully understand. I'll experiment with classic if/ifelse/else
> macros in LM
> 
> steve d.
Trickiest part is whether you want the code to run 'un-preprocessed' as well
#IF something
 print("something")
#ELSE
 print("something else")
#ENDIF
This will clearly fail, won't compile. If you mark with --# it will run but
incorrect, as it executes both lines
--#IF something
 print("something")
--#ELSE
 print("something else")
--#ENDIF
Now if you can make the IF ELSE switch based on --# as in
--#IF something
 print("something")
--#ELSE
--# print("something else")
--#ENDIF
It will also run on un-preprocessed, only if preprocessed with 'something'
set, the 'something else' line would become available
Thijs

AltStyle によって変換されたページ (->オリジナル) /