royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yishay Weiss <yishayj...@hotmail.com>
Subject RE: [royale-asjs] branch feature/revert-refactor updated: Fixes #261. Untyped members need to be surrounded with quotes.
Date Mon, 18 Jun 2018 10:03:10 GMT
Hi Carlos,



If you look at ProgressBar.as:61 you’ll see



        private var materialProgress:Object;



this is the raw mdl object that ProgressBar wraps. When you call a method on that wrapped
object, e.g.



         materialProgress.setProgress(value);



the transpiled minified code could look something like



mp.sp(v),



But because mdl is a third part library which is not touched by our compiler we will get a
run time error because mdl expects setProgress(), not sp().



One way to solve this is by creating a typedef for materialProgress. That tells our compiler
not to rename methods and properties belonging to that type. It has the added value of catching
compile time errors, hinting to IDEs, and as Alex says, provides room for optimizations when
the compiler gets smarter.



I don’t understand how HTMLDialogELement.as gets generated. Do you remember how you did
this? Maybe we can add ProgressBar too, for the sake of providing an example.

________________________________
From: carlos.rovira@gmail.com <carlos.rovira@gmail.com> on behalf of Carlos Rovira <carlosrovira@apache.org>
Sent: Monday, June 18, 2018 10:43:06 AM
To: dev@royale.apache.org
Subject: Re: [royale-asjs] branch feature/revert-refactor updated: Fixes #261. Untyped members
need to be surrounded with quotes.

Hi Yishay,

 I planned MDL like a wrapper of existing JS/CSS MDL functionality. I found
in that way that I need Dialog polyfill so I added to typedefs.
Didn't need anymore at that time. So can you put some example of what you
propose in order to understand better the need of typedefs for raw mdl
components?
thanks

2018-06-18 7:54 GMT+02:00 Yishay Weiss <yishayjobs@hotmail.com>:

> Out of curiosity, why are there no type defs for raw mdl components?
>
>
>
> ________________________________
> From: Alex Harui <aharui@adobe.com.INVALID>
> Sent: Monday, June 18, 2018 6:53:51 AM
> To: dev@royale.apache.org; commits@royale.apache.org
> Subject: Re: [royale-asjs] branch feature/revert-refactor updated: Fixes
> #261. Untyped members need to be surrounded with quotes.
>
> FYI, IMO, the recommended practice is to not have untyped members and
> create types if needed.  But this is for MDL, so doesn't really matter.
>
> My reasoning is that it will always help future optimizers and runtimes to
> know the types of everything.
>
> My 2 cents,
> -Alex
>
> On 6/17/18, 3:43 AM, "yishayw@apache.org" <yishayw@apache.org> wrote:
>
>     This is an automated email from the ASF dual-hosted git repository.
>
>     yishayw pushed a commit to branch feature/revert-refactor
>     in repository https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-
> asjs.git&data=02%7C01%7Caharui%40adobe.com%7Cd77275bd67964759a70908d5d43f
> 1b91%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%
> 7C636648289868136910&sdata=OX9Bv6x8tofEiFP4CL618YzO8flAxb
> Thhkdk13pZ3RQ%3D&reserved=0
>
>
>     The following commit(s) were added to refs/heads/feature/revert-refactor
> by this push:
>          new c1f20f3  Fixes #261. Untyped members need to be surrounded
> with quotes.
>     c1f20f3 is described below
>
>     commit c1f20f30eeddf4aec20894f5326ec1d188b729c0
>     Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
>     AuthorDate: Sun Jun 17 13:42:50 2018 +0300
>
>         Fixes #261. Untyped members need to be surrounded with quotes.
>     ---
>      .../src/main/royale/org/apache/royale/mdl/ProgressBar.as
>   | 4 ++--
>      1 file changed, 2 insertions(+), 2 deletions(-)
>
>     diff --git a/frameworks/projects/MaterialDesignLite/src/main/
> royale/org/apache/royale/mdl/ProgressBar.as b/frameworks/projects/
> MaterialDesignLite/src/main/royale/org/apache/royale/mdl/ProgressBar.as
>     index 8dbaa23..820a9f5 100644
>     --- a/frameworks/projects/MaterialDesignLite/src/main/
> royale/org/apache/royale/mdl/ProgressBar.as
>     +++ b/frameworks/projects/MaterialDesignLite/src/main/
> royale/org/apache/royale/mdl/ProgressBar.as
>     @@ -149,7 +149,7 @@ package org.apache.royale.mdl
>              {
>                  if (materialProgress && !_indeterminate)
>                  {
>     -                materialProgress.setProgress(value);
>     +                materialProgress["setProgress"](value);
>                  }
>              }
>
>     @@ -171,7 +171,7 @@ package org.apache.royale.mdl
>              {
>                  if (!event.currentTarget) return;
>
>     -            materialProgress = event.currentTarget.MaterialProgress;
>     +            materialProgress = event.currentTarget["
> MaterialProgress"];
>
>                  setCurrentProgress(_currentProgress);
>                  setCurrentBuffer(_currentBuffer);
>
>     --
>     To stop receiving notification emails like this one, please contact
>     yishayw@apache.org.
>
>
>


--
Carlos Rovira
http://about.me/carlosrovira
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message