Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DCC73E9DA for ; Fri, 14 Dec 2012 13:53:39 +0000 (UTC) Received: (qmail 63825 invoked by uid 500); 14 Dec 2012 13:53:37 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 63280 invoked by uid 500); 14 Dec 2012 13:53:36 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 62498 invoked by uid 99); 14 Dec 2012 13:53:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 13:53:36 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.210.175] (HELO mail-ia0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 13:53:30 +0000 Received: by mail-ia0-f175.google.com with SMTP id z3so3054216iad.6 for ; Fri, 14 Dec 2012 05:53:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=4vyA4dBMyVuZA/MPLz0FvuUA2C8eqBmaSyPImwDyQoQ=; b=RGmLtBHS96xsTH7wjacbBVunvUZjyUsZZnUlfI6GoTiX9fROOTSlOvTtTId8+oQ7zV EE22ZL9dvc8ZsfSe/fpuXY2bmsGu6jxIlS9IOMZu046gQ/pPoZWhWTqorwc/amBtGms3 YvOXJrD3uvEeE1OtpHQjcq5pBurPaOW3SPQgWWKNv8zsCB/xNcD9MhvPae9MQwYuyajc Um5WH50qI8vWmOpj+0+qv58RLtUd9DM1ixFup73AeKPJ2xIyhFBSDkvhIsx3yt+vQVn9 CzozQbw1TbKAjcke73Q8CJ5sb55aa63+ZxAa1Vf2UVYisDv/6+lZXshvLt1n1D1TVzrY UcQQ== MIME-Version: 1.0 Received: by 10.50.57.232 with SMTP id l8mr1559651igq.54.1355493189098; Fri, 14 Dec 2012 05:53:09 -0800 (PST) Received: by 10.64.34.234 with HTTP; Fri, 14 Dec 2012 05:53:08 -0800 (PST) In-Reply-To: <20121214073337.180849jsr6ej3vdt@franklin.liquidweb.com> References: <20121213193125.39700rxwp4q1yna5@franklin.liquidweb.com> <50CB0596.8040808@gmail.com> <20121214061715.18015fazzb79m2ez@franklin.liquidweb.com> <50CB0F7C.2010104@gmail.com> <20121214064946.18001mar0jfixdui@franklin.liquidweb.com> <20121214073337.180849jsr6ej3vdt@franklin.liquidweb.com> Date: Fri, 14 Dec 2012 14:53:08 +0100 Message-ID: Subject: Re: [FalconJx] Prototype ActionScript -> JavaScript compiler code up in svn From: Erik de Bruin To: "flex-dev@incubator.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmusPfm08BIiD9YLwMNg5A4lj/DduPCnlOrc+5zQ9/DyrtUCptlKwKnHx6uNQGRXlSHtobp X-Virus-Checked: Checked by ClamAV on apache.org > Ok, then not to worry, we can even tests this sooner than later to see > exactly what the closure compiler does with our namespaces. Taking the example AS -> JS we worked with last week, let me show you: //============================**==============================**======= AS CODE package com.example.components { import flash.display.Sprite; public class MyTextButton extends Sprite { public function MyTextButton() { super(); } private var _privateVar:String = "do "; public var publicProperty:Number = 100; public function myFunction(value: String): String { return "Don't " + _privateVar + value; } } } //============================**==============================**======= JS CODE (intended, maybe even current, output of FalconJx) /** * CROSS-COMPILED BY MXMLJSC (329449.1) ON 2012-12-07 08:11:27 */ goog.provide("com.example.components.MyTextButton"); goog.require("flash.display.Sprite"); /** * @constructor * @extends flash.display.Sprite */ com.example.components.MyTextButton = function() { goog.base(this); /** * @private * @type {string} */ this._privateVar = "do "; } goog.inherits(com.example.components.MyTextButton, flash.display.Sprite); /** * @type {number} */ com.example.components.MyTextButton.prototype.publicProperty = 100; /** * @this {com.example.components.MyTextButton} * @param {string} value * @return {string} */ com.example.components.MyTextButton.prototype.myFunction = function(value) { return (("Don't " + this._privateVar) + value); } // Ensures the symbol will be visible after compiler renaming (needed only for "application" level class) goog.exportSymbol('com.example.components.MyTextButton', com.example.components.MyTextButton); //============================**==============================**======= JS CODE (run through the Closure Builder) function a(){this.a="do "}function b(){}function c(){}c.prototype=b.prototype;a.b=b.prototype;a.prototype=new c;var d=["com","example","components","MyTextButton"],e=this;!(d[0]in e)&&e.execScript&&e.execScript("var "+d[0]);for(var f;d.length&&(f=d.shift());)!d.length&&void 0!==a?e[f]=a:e=e[f]?e[f]:e[f]={}; Now, although we use stuff from the "goog" library ('provides', 'requires', 'base' and 'inherits'), the Closure Builder output is ALL THAT'S NEEDED for our JS to run in the browser. This means that all dependencies have been resolved and the code is compiled such that doesn't need the "goog" library to run... Pretty efficient and highly optimised, I'd say ;-) EdB -- Ix Multimedia Software Jan Luykenstraat 27 3521 VB Utrecht T. 06-51952295 I. www.ixsoftware.nl