I'm looking for the equivalent of Python decorators / Lisp macros / Java annotations (yes, I know that these are not necessarily equivalent themselves) in Actionscript. Tools that provide similar features would also be great (I'm using the Flex Builder plugin for Eclipse on Linux).
I'm writing a Flex application and here's what I want to accomplish:
I have encapsulated various sets of remote functionality in separate classes (this is sometimes called "Messaging Gateways" or "Remote Proxies"), where each method mirrors a method on the server, like so:
class UserManagementService extends MyHttpService {
//...
private final _urlBase:String = "http://example.com/services/users"
//...
public function usrGet(ix:int):User
{
url = urlBase + "/get";
mp:Dictionary = new Dictionary();
mp["ix"] = ix;
result:User = this._service.varSend(url, this.sEncodeParams(mp), Class("User"));
return result;
}
//...
}
Since I have the parameters and the return type of the remote function already in the function declaration, it would be nice to just add the URL suffix, like this (Python-inspired pseudocode):
@remotify("/get")
public function usrGet(ix:int):User { }
Now, wouldn't that be neat? ;-)