Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

[RT] Compile-time-data injection

Note
titleProposal
  • This is not yet a part of apache flex.
  • This is in concept stage

Summary

Introduction of new Metadata Tags that instruct the compiler to fill-in arguments or properties with data that is available at compile-time.

...

Code is right now introspected using describeType, exception stack-traces (that only work in the debug players) and passing data by hand. Also: Developers need to set up ant tasks to pass in data like the build version or compiler flags or need to do some code twisting for it to work. If some of the data was compiled into the bytecode then performance could be traded for swf size. This is specially interesting for low-level apis like logging or dependency injection. All this could be achieved by including all compiler data into a swf but this would result in unnecessarily bloated swfs. An approach using meta-data would allow selective injection for those parts that are needed.

Mailinglist discussions

Trace & Log
Proposal Compile-time-data-injection

Available data

Type

Information about classes, their methods and those arguments. Basically things that are right now available with describeType and getQualifiedClassName.

...

key

description

type

caller.type

Type in which the calling method was located

Type

caller.args

The arguments that have been passed to the caller

Array

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2d1c3ba4-a459-4edc-859d-94bd604c261b"><ac:plain-text-body><![CDATA[

call.clean

Called clean like foo.bar() or not (like foo["bar"]() or foo.bar.call(null))

Boolean

]]></ac:plain-text-body></ac:structured-macro>

call.lineNo

The line number of the file of the type where the method has been called

int

call.preferedReturnType

Type that the code wants to work with afterwards

Type

call.arguments args

Types passed in for all arguments

Array

call.argumentarg.<argument>

Type for a particular argument

Type

...

Code Block
langactionscript
[Fill(data="type")]
const type: XML; // Type as in describe-type

[Fill(data="type")]
const type: Object; // describe-type xml in a object tree

[Fill(data="compile.time")]
const time: int; // Time as Integer;

[Fill(data="compile.time")]
const time: String; // Time as String;

[Fill(data="compile.time")]
const time: Date; // Time as Date;

[Fill(bar="callercall.argumentarg.content")]
function foo(content:*, bar:Class=null); // Content type as class

[Fill(bar="callercall.argumentarg.content")]
function foo(content:*, bar:String=null); // Content type as String

[Fill(bar="callercall.argumentarg.content")]
function foo(content:*, bar:XML=null); // Content type as XML

...