Return-Path: X-Original-To: apmail-flex-dev-archive@www.apache.org Delivered-To: apmail-flex-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 69DECD9CC for ; Sun, 27 Jan 2013 21:55:56 +0000 (UTC) Received: (qmail 34332 invoked by uid 500); 27 Jan 2013 21:55:55 -0000 Delivered-To: apmail-flex-dev-archive@flex.apache.org Received: (qmail 34305 invoked by uid 500); 27 Jan 2013 21:55:55 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 34297 invoked by uid 99); 27 Jan 2013 21:55:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Jan 2013 21:55:55 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.216.173] (HELO mail-qc0-f173.google.com) (209.85.216.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Jan 2013 21:55:48 +0000 Received: by mail-qc0-f173.google.com with SMTP id b12so1026603qca.32 for ; Sun, 27 Jan 2013 13:55:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:x-gm-message-state; bh=qlMYRjX5wBjMvrSKUMiTQUSGvt7D5itusN0sJ0xgkOg=; b=YoZGpp+ifAg3ldkxiVqDR72KD+k6gMXw0HJbXTGI0L3mnMtu9B8Qij7qK16xN+Nv3l EeVIAj8WTx1DcUrVSqOU5xj/wj9ZoslrzADKBZqc9BsiuEORwbzu+/KlGTtwA7yWY0nd mB7uV826igX6fbVwSNgyGd5HZhODenxL6UHuqT73Xl8zzN/YzmH8pXOpYocWN0jSODfA m1R8bWZ4HEOxsy7wPoZ/iBsqNh5L8VeRAfddX/po/cnk5/2moCWyuPvrlu7wNzf6y4Oz S7AoAMVzOz4QJihSbz++qDFLsHBbdkz0TBHR6mbbpcViF2J4mFRWZr3XGD6vb8DJQifH tPcw== MIME-Version: 1.0 X-Received: by 10.49.133.195 with SMTP id pe3mr15560765qeb.58.1359323727460; Sun, 27 Jan 2013 13:55:27 -0800 (PST) Received: by 10.49.59.68 with HTTP; Sun, 27 Jan 2013 13:55:27 -0800 (PST) In-Reply-To: References: Date: Sun, 27 Jan 2013 22:55:27 +0100 Message-ID: Subject: Re: [ASJS] Integration with existing JS libraries and components From: Frank Wienberg To: dev@flex.apache.org Content-Type: multipart/alternative; boundary=047d7bea3518e8f81604d44c3740 X-Gm-Message-State: ALoCoQnNEjl4SWGfODmeutafTmCoyBIK8T7KKG7ueGhM9xKXqlzvcDMDYbVMb3ALVc3+fQFB0Qku X-Virus-Checked: Checked by ClamAV on apache.org --047d7bea3518e8f81604d44c3740 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Jan 27, 2013 at 5:52 PM, Erik de Bruin wrote: > > I think I can now pinpoint the difference to RequireJS: It is in the > > existence of deps.js. > > deps.js says it's generated, and seems to be the extracted dependencies > of > > all the other JS files, right? Aha, so this is how the necessary scripts > > get loaded in advance. And this is where you need the build tool: To > > extract the dependencies and generate this additional file deps.js. > > No, the deps.js is just a list of ALL the require statements in the > entire library + application (indeed generate during the publish > process. However, ONLY the files listed that are ACTUALLY USED are > loaded dynamically by the code in 'base.js'. If you look in either > Chrome or FF you can see which script files are actually loaded and > compare that list agains the 'deps.js' list. You'll see that the only > file hard-coded into the HTML is 'base.js', which is the equivalent of > 'require.js' in your approach. All the other script files are loaded > dynamically, in order, based on the dependencies as given in their > contents, much like with Require.js. > > > With the AMD approach, you can re-generate exactly one file and reload in > > the browser, and everything will work. > > Same with the 'goog' way. > > One more thing, something I didn't find out is how deps.js gets loaded. > It > > has to be triggered by base.js somehow. Can you please explain? > > It's a kind of magic :-) As I explain above, 'base.js' uses it, > together with the 'provide' and 'require' statements to figure out > which other project files to load. Let me press that point, since it > seems to be pivotal to the discussion: ONLY the files that are > ACTUALLY needed to run the application are loaded into the browser. > NOT all the files in 'deps.js' and certainly not all the files in the > Closure Library. > > To get one misunderstanding out of the way, I never claimed base.js would load more scripts than required. I just wonder all the time how base.js can know *in advance* which scripts to load. And deps.js seems to be the answer to that question. Believe me, I'm just trying to understand how it works and where it is substantially different from RequireJS. So deps.js is not only the list of all require statements starting at the "main" class, but as you say a "list of ALL the require statements in the entire library + application". My example was that you change a single file, but change it in a way that you add a dependency. Without re-generating deps.js, base.js could not know in advance that the newly dependent module is needed, so just generating the class' own output file would result in a non-working state. And (re-)generating deps.js is exactly the pre-processing step AMD so elegantly avoids from the start. > > Okay, we can wait for that, but since Michael says what I did with > Jangaroo > > 3 is easily re-implemented in Falcon, why not compare now? The output > > will/should be very very similar to what the Jangaroo 3 output looks like > > now, e.g. the one of the Open Flash Chart example. > > Another idea would be I take your example code (or any other code you > want) > > and compile it with Jangaroo 3 and also deploy the output. What do you > > think? > > I enabled "View Source" on the Flash output, so you can grab the AS > source and put it through Jangaroo if you please. You can also pick up > Alex's FlexJS source and do the same with that.Might be interesting to > see what comes out and compare the various approaches when using a > different compiler. > Yes, I'll try to do that, but except from the deps.js file discussed above I expect the difference to be rather small. > I think you're not going to convince me to throw away all the work I > did so far (and I strongly believe is at least as valid for our > purpose as what you are suggesting) and start the whole process again > based on your approach, only to do away with one step in the build > process of the intermediate output (the 'deps.js' you object to plays > no role in generating the 'release' code). I'll continue development > of my proof of concept and I hope to find other contributors willing > to help out. > Nobody asks you to throw away your work. We are discussing which library / tool better supports the JS target of Apache Flex. From a code-generation point of view, our approaches are fairly similar, and there are suggestions (see Roland's thread) that it should be easy to switch between such similar code output patterns. So we'll probably have both of them. However, I still think it is better to consolidate than to offer too much to chose from (where it brings no benefit). And I'd still like to hear your opinion on my warning that the input language for GCC is a dialect of JavaScript (restrictions, extensions), not standard JavaScript. -Frank- --047d7bea3518e8f81604d44c3740--