High-level comments: 1) We should really discourage people from using <switch>/<when>/etc. because they can not be used in .lzo's. Instead we should encourage people to use <passthrough> where necessary, and, more importantly, runtime dispatching on capabilities.
2) We should try to keep the option path as "open" as possible. In the past, we have been too aggressive in filtering options, which has limited experimentation along these lines. It would be great if switch and passthrough were _not_ limited to a predefined set of conditions, but could match arbitrary option strings. We have the chance to do this, now that your options are all specified in one place, in one structure. 3) Rather than slow build an expression language into these tests (what about startsWith, endsWith, doesNotContain, etc.), probably the most general thing you could do would be to support an arbitrary javascript expression as the condition. It's simple enough to add a Javascript evaluator to the compiler. Then all you have to do is define the environment that these expressions are evaluated in, like say that there is a lzoptions global that is a hash of the properties and the string that was that property's parameter, so you could say: <when expression="'air'.indexOf(lzoptions.flexoptions) != -1"> ? On 2010-09-13, at 10:16, Henry Minsky wrote: > Yeah I think we ought to have some way to access that. > > I've got a patch out for review which adds a "flexoptions" arg, that can > contain > a string that gets passed to the SWF10 backend. It currently supports a > syntax > like this > > flexoptions(version=10.1,air) > > The 'flexoptions' arg is passed all the way down to the SWF10 script > compiler, > which decodes that to set the flex compiler command line options for AIR. > > I guess we could add a $air compile time constant that the compiler sets > based on the > flexoptions arg, or make something more general > to allow the <when> tag to examine compiler properties, like > > <when $property="flexoptions" contains="air"> or something like that > > On Mon, Sep 13, 2010 at 9:19 AM, Raju Bitter < > [email protected]> wrote: > >> Henry, >> reading this, should you add a compile time constant for the AIR >> runtime? Since there are AIR specific APIs/settings, and the Flex >> compiler needs a different configuration to deploy AIR apps? >> >> Just a thought. >> >> On Sun, Sep 12, 2010 at 4:11 AM, Henry Minsky <[email protected]> >> wrote: >>> The list of possible compile time constants are these, I believe >>> >>> $runtime : string >>> $swf7 : boolean >>> $swf8 : boolean >>> $as2 : boolean >>> $swf9 : boolean >>> $swf10 : boolean >>> $as3 : boolean >>> $dhtml : boolean >>> $j2me : boolean >>> $svg : boolean >>> $js1 : boolean >>> $debug : boolean >>> $profile : boolean >>> $backtrace : boolean >>> >>> >>> >>> On Sat, Sep 11, 2010 at 10:08 PM, Henry Minsky <[email protected]> >>> wrote: >>>> >>>> The supported attributes for <when> are >>>> >>>> 'property', which looks at a boolean compile time property >>>> <when property="$as3"> // checks for Boolean true >>>> >>>> 'property' with 'value', checks that the given compile time property >>>> equals the given literal value >>>> <when property="$runtime" value="swf9"> // checks for string >>>> equality >>>> >>>> and for back compatibility, the 'runtime' attribute, equivalent to the >>>> above: >>>> <when runtime="swf9"> >>>> >>>> <unless> takes the same arguments as <when>, it just has the sense >>>> inverted, so it includes it's body if >>>> the condition is false. >>>> >>>> >>>> >>>> >>>> On Sat, Sep 11, 2010 at 6:06 PM, Lou Iorio <[email protected]> wrote: >>>>> >>>>> Are <property> and <value> the only two attributes for <when>? >>>>> What are the possible values? >>>>> Are the attributes for <unless> the same as those for <when>? >>>>> My plan is to do simple reference pages for <when>, <unless>, >>>>> and <otherwise>, and link from those pages to the <switch> page. >>>> >>>> >>>> -- >>>> Henry Minsky >>>> Software Architect >>>> [email protected] >>>> >>>> >>> >>> >>> >>> -- >>> Henry Minsky >>> Software Architect >>> [email protected] >>> >>> >>> >> > > > > -- > Henry Minsky > Software Architect > [email protected]
