flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DarkStone <DarkSt...@163.com>
Subject Re: ActionScript 4? What the hell?
Date Thu, 23 Jan 2014 11:28:10 GMT
I don't like function overloading at all, it causes confusion, think about this:

public function dosth(a:int):String
{
return "aaa";
}

public function dosth(b:uint):String
{
return "bbb";
}

Then you call:

var s:String = dosth(15);
What you will get? Very confusing!

I do want AS3 to support data enumeration for example:

var s:String;
If we only want to s accept "hello" and "world", in the current AS3 we typically declare a
Class, define two public static constants:

public class Words
{
public static const HELLO:String = "hello";

public static const WORLD:String = "world";
}

And then we have to restrict the s variable to accept only those two words by adding scripts
that requires runtime support.

If we can do it like this:

public class Words
{
[Enumeration]
public static const HELLO:String = "hello";

[Enumeration]
public static const WORLD:String = "world";
}

var s:String.<Words>;

We can restrict the variable s thru compiler not runtime, it's a very useful language feature
and long missing by AS3.

In the example above, if you do this:

s = "other words";

The compiler will post an error.

I think you get what I mean.

By adding the [Enumeration] (or [Enum] for short) and String.<Words> (TargetType.<AcceptEnumerationClass>),
maybe we can do it by modifying the flex compiler not the runtime.

I'm not a compiler or runtime expert, may someone share a thought about this, thanks : )

Sent from DarkStone's iPhone
2014-01-23

> 在 2014年1月23日,15:58,Alex Harui <aharui@adobe.com> 写道:
> 
> I think we can do a partial implementation by preprocessing and renaming
> functions without runtime changes, but it will have limitations like using
> ["functionName"]() syntax won't work.
> 
>> On 1/22/14 10:22 PM, "Avi Kessner" <akessner@gmail.com> wrote:
>> 
>> Does function overloading require changes to the runtime?
>>> On Jan 22, 2014 9:30 PM, "Gordon Smith" <gosmith@adobe.com> wrote:
>>> 
>>> I looked over the spec to refresh my memory. In addition to user-defined
>>> namespaces, other things that were dropped were E4X, undefined,
>>> prototypes,
>>> and dynamic classes. Basically, AS4 became more like Java and less like
>>> Javascript. Dropping any of these things would have a large impact on
>>> Flex.
>>> But none of them have to be dropped. You could cherry-pick the additions
>>> (as long as they are implementable on the existing runtime) rather than
>>> the
>>> removals.
>>> 
>>> - Gordon
>>> 
>>> -----Original Message-----
>>> From: Gordon Smith [mailto:gosmith@adobe.com]
>>> Sent: Wednesday, January 22, 2014 11:20 AM
>>> To: dev@flex.apache.org
>>> Subject: RE: ActionScript 4? What the hell?
>>> 
>>>> the main thrust of the language was a totally new language geared for
>>> functional programming, and then some backward compatibility stuff to
>>> make
>>> it seem more like ActionScript.
>>> 
>>> I wouldn't characterize it that way. To me it felt like incremental
>>> change
>>> to AS3. There were still classes and interfaces so I'm not sure what you
>>> mean by "geared for functional programming"; to me it was still
>>> definitely
>>> an object-oriented language. It did add "strong function types"'; for
>>> example
>>> 
>>> var f:(int, int)=>String;
>>> 
>>> declared a variable that could only contain a reference to a function
>>> that
>>> took two ints and returned a String. It also added array types like
>>> 
>>> var a:[]int;
>>> 
>>> - Gordon
>>> 
>>> 
>>> -----Original Message-----
>>> From: Alex Harui [mailto:aharui@adobe.com]
>>> Sent: Wednesday, January 22, 2014 11:06 AM
>>> To: dev@flex.apache.org
>>> Subject: Re: ActionScript 4? What the hell?
>>> 
>>> 
>>> 
>>>> On 1/22/14 10:55 AM, "Gordon Smith" <gosmith@adobe.com> wrote:
>>>> 
>>>> Adobe designed AS4 to be the language for a new Flash runtime ("V12")
>>>> that it was working on but dropped. (I was working on the AS4 compiler
>>>> then.) Not all features of AS4 can be implemented -- at least not
>>>> easily and efficiently -- on the existing Flash runtime. However, some
>>>> features can be.
>>>> 
>>>> Alex, I suggest that you try to arrange for the donation of the
>>>> incomplete AS4 compiler to Apache for cherry-picking.
>>> Well, donations take a lot of time and energy.  I would rather we know
>>> there is something we want and doesn't require runtime implementation
>>> before expending that energy.
>>> 
>>> I haven't looked at the AS4 docs, and Gordon certainly knows better, but
>>> my takeaway from past discussions about AS4 was that it had dual
>>> personalities: the main thrust of the language was a totally new
>>> language
>>> geared for functional programming, and then some backward compatibility
>>> stuff to make it seem more like ActionScript.  Sure you could call that
>>> an
>>> improvement, but I'm not clear it would be an incremental improvement.
>>> It
>>> would be like rewriting the framework in Lisp.
>>> 
>>>> 
>>>> - Gordon
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Kessler CTR Mark J [mailto:mark.kessler.ctr@usmc.mil]
>>>> Sent: Wednesday, January 22, 2014 10:32 AM
>>>> To: dev@flex.apache.org
>>>> Subject: RE: ActionScript 4? What the hell?
>>>> 
>>>>  Well using the assumption that AS 4 would be an improvement in some
>>>> area's from AS3 even if it was an incomplete work.   While I haven't
>>>> looked at it yet, I would be interested in just seeing the differences
>>>> and bring over small pieces that could be an improvement for us.
>>>> Assuming it wasn't in the same direction as ASC 2 which started getting
>>>> rid of things we use.
>>>> 
>>>> -Mark
>>>> 
>>>> -----Original Message-----
>>>> From: Alex Harui [mailto:aharui@adobe.com]
>>>> Sent: Wednesday, January 22, 2014 12:20 PM
>>>> To: dev@flex.apache.org
>>>> Subject: Re: ActionScript 4? What the hell?
>>>> 
>>>> I'm not sure what the rules are.  The language reference is under
>>>> Apache license.  The specifications are under CC-NC which is not good.
>>>> I suppose I could try to get that changed.
>>>> 
>>>> But first, come up with something you do want to cherry pick that
>>>> doesn't require implementation in the runtime.
>>>> 
>>>> -Alex
>>>> 
>>>> On 1/22/14 8:39 AM, "Kessler CTR Mark J" <mark.kessler.ctr@usmc.mil>
>>>> wrote:
>>>> 
>>>>> Since this is hosted publicly but not donated, I assume we cannot
>>>>> cherry pick any good changes from as4...
>>>>> 
>>>>> -Mark
>>>>> 
>>>>> -----Original Message-----
>>>>> From: bkelley [mailto:brady.kelley@cleantelligent.com]
>>>>> Sent: Wednesday, January 22, 2014 11:15 AM
>>>>> To: dev@flex.apache.org
>>>>> Subject: Re: ActionScript 4? What the hell?
>>>>> 
>>>>> DarkStone wrote
>>>>>> I believe Adobe said in the flash runtime roadmap that AS4 was
>>> dropped:
>>>>>> http://www.adobe.com/devnet/flashplatform/whitepapers/roadmap.html
>>>>>> 
>>>>>> Now they reopen AS4 on GitHub, what does it mean?
>>>>> 
>>>>> From the read me on the github project: "Adobe is publishing the
>>>>> ActionScript 4 specifications in the hope that they may be useful to
>>>>> the programming language and managed runtime communities. The
>>>>> specifications are as they existed when the project with which they
>>>>> were associated was discontinued and therefore may be considered
>>>>> incomplete. Source code for the compiler and runtime is not available.
>>>>> Adobe has no plans to resume development of ActionScript 4."
>>>>> 
>>>>> Looks like it is just for reference only, Adobe has no plans to
>>>>> continue development, unfortunately. :-(
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> View this message in context:
>>>>> http://apache-flex-development.2333347.n4.nabble.com/ActionScript-4-Wh
>>>>> at-
>>>>> t
>>>>> he-hell-tp34089p34106.html
>>>>> Sent from the Apache Flex Development mailing list archive at
>>> Nabble.com.
> 

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message