Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1147E200BCF for ; Mon, 5 Dec 2016 19:52:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0FF59160B18; Mon, 5 Dec 2016 18:52:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 599F7160B09 for ; Mon, 5 Dec 2016 19:52:16 +0100 (CET) Received: (qmail 6225 invoked by uid 500); 5 Dec 2016 18:52:15 -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 6209 invoked by uid 99); 5 Dec 2016 18:52:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2016 18:52:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A882DD0CC9 for ; Mon, 5 Dec 2016 18:52:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id JS6bR2jXYfMX for ; Mon, 5 Dec 2016 18:52:13 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8CB345F56F for ; Mon, 5 Dec 2016 18:52:13 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id g23so17588665wme.1 for ; Mon, 05 Dec 2016 10:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=+RHPDeUtjdlFDNx4EPkL6zgsYZJFeJRUSIKifuvNTeU=; b=O3QmJ9iF+zD5v4CV4TdoDro9jFUsOvS7ShkQF2VF6xEeUontahcyFhR74mm6zQxfWk A4rZm04tGJoChHtlTJos2lHUtMgxQxgFRx28jUrlOH91SYK9jglA80T902ZHljZQcLXG L2wwF+a/C/J5qjxcOfw4o8Fvqx6+LCwpYpHJ00Hp6ROTSKuWIRpuLLMOdABI77/iCz5v DXjb9oeXkbkma7i+QJk9tldR1GnojfFR0O6ul+9zX/cwYLy+8iHSOx1Su0RQoAxITbLk KCDje7wgJ20pHGjC3MIreQlA1EFbb5HcJZiYpODt/rasn+jJwWPiDxMAd+d8NTjEutnM aOpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=+RHPDeUtjdlFDNx4EPkL6zgsYZJFeJRUSIKifuvNTeU=; b=WAH7FJO+A+xpzn8Z7nG47xhqdMWVJIDcW66gp03j7uXQ2tPb98ph0Cwm+dzu3jGddW NZRedyy/UAk0jMHQc2FPe34HR46QxHUaOPe2PAKpA68PE5qfWFCjxVMb/l5u1qaay5td kQVJwZkOq49xAJRGf6ilGJfYbCIm11vRHSz4wch8qd8WSDEhAbB2q83ysTPK2DPo32xx pp/ThSK5rrg2oj+gYz3u6v8ULJiRpADLNo0Ss+sglXuggKBqpVZKeKqRl2V30QPvYWaj m+FomSFMSlk07yAsM7HgoOhcdRijt76kkduqMRDbOO1GcMvISpEWQ2HS2pLXLJOydvN2 oQ4A== X-Gm-Message-State: AKaTC03ld2zDToNf32L0wpgImPqvnwosoAy3jZQyLFEPqyO5ixaUNzsQgAjTEwx8ga64mA== X-Received: by 10.28.152.79 with SMTP id a76mr11535882wme.47.1480963867127; Mon, 05 Dec 2016 10:51:07 -0800 (PST) Received: from [10.0.0.4] ([185.120.124.34]) by smtp.gmail.com with ESMTPSA id c133sm14876wme.12.2016.12.05.10.51.05 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Dec 2016 10:51:06 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [FALCONJX][FLEXJS} SWF Subclass (and other) Overrides From: Harbs In-Reply-To: Date: Mon, 5 Dec 2016 20:51:02 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: To: dev@flex.apache.org X-Mailer: Apple Mail (2.1878.6) archived-at: Mon, 05 Dec 2016 18:52:17 -0000 I like. On Dec 5, 2016, at 8:49 PM, Alex Harui wrote: > Hi, > > I just pushed changes to allow certain kinds of overrides in SWF that > normally aren't possible. The reasoning behind doing this is to allow us > to have a library that extends SWF classes like Sprite but hide the flash > APIs. > > For example, in Sprite, the parent property is defined as a > flash.display.DisplayObjectContainer. In FlexJS, we would much rather use > a non-Flash API like org.apache.flex.core.IParent, so a parent can be > platform-agnostic. Similarly, the dispatchEvent API takes a > flash.events.Event and it would be better to have it take an > org.apache.flex.events.Event, or maybe an > org.apache.flex.events.IFlexJSEvent. > > So, in our base classes, we would want to write: > > override public function get parent():IParent > > And > > override public function > dispatchEvent(event:org.apache.flex.events.Event):Boolean > > But not only would the SWF compiler not allow that, the Flash runtime > checks the type of any override at runtime and reports an error if there > isn't a match (and such an issue would not be caught by the JS runtime). > > So to get this all to work, the compiler needs to know that certain > type-mismatches are allowed, and also to restore the type to the original > type in the SWF. To do so, I taught the compiler to look for a > SWFOverride metadata that provides the original types for parameters or > return values. When the compiler sees a mismatch, it checks for metadata > allowing the mismatch. And when writing out the SWF, it also checks for > the metadata and replaces the types in the ABC traits. So far, in minimal > testing, it seems to work. > > Next up, after fixing a bunch of bugs in the queue, is to work on having > the compiler generate both SWF and JS output in a single run. Then with > proper overriding of various Flash APIs, we should be able to provide a > more efficient way for FlexJS developers to see any conflicts with > underlying platform implementations without having to wrap every > implementation. > > Later, > -Alex >