Replies: 76 comments 168 replies
-
Keeping suggestions/ideas in a separate comment for each one [EDIT: Thanks @marchbold for having added some general guidelines now..], first one from my side would be:
Benefits: type-safety, readability, maintainability |
Beta Was this translation helpful? Give feedback.
-
ES4 proposed destructuring patterns and
|
Beta Was this translation helpful? Give feedback.
-
In principle the same as the Java equivalent (https://www.w3schools.com/java/java_abstract.asp) with the same goal to create an additional layer of abstraction |
Beta Was this translation helpful? Give feedback.
-
Something important for iteration proxies are generators (
And related: support the |
Beta Was this translation helpful? Give feedback.
-
Context keyword
|
Beta Was this translation helpful? Give feedback.
-
Arrow Functions
function (a:String):Number
{
return 1;
} Equivalent Arrow functions would be: (a:String):Number => {
return 1;
} (a:String):Number => 1; |
Beta Was this translation helpful? Give feedback.
-
Structural Function Type A way to define the parameters and return value of a function passed as a parameter. This is a common issue in our development of libraries and often the reason we avoid the "callback" function approach and stick with traditional events. For example if we look at a simple function foo that takes a callback function as a parameter. It expects this function to have a particular params and return value: function foo( callback:Function ):Number {
// callback has no type or return information defined so hard to enforce rules
var number:Number = callback( 'some string' );
return number;
} Then when you go to use it, foo( function( p:String ):Number {
return 1;
}); however in actionscript the following would compile but fail at runtime: foo( function():void {
// doesn't return a Number or accept the string parameter
} ); So basically would be nice to be able to define the parameters and return value of the |
Beta Was this translation helpful? Give feedback.
-
Asynchronous functions and Like |
Beta Was this translation helpful? Give feedback.
-
UPDATE: I guess the following idea isn't good after all, so just ignore it. String code pointsWay to deal with Strings code points (Unicode Scalar Value). Either provide alternative Python-like-composition Currently |
Beta Was this translation helpful? Give feedback.
-
In our more than a decade old desktop AIR code base, we have something like this: var ex:ThreeSixtyExceptionVO = VOUtility.makeException(faultEvent);
// having type inference like this will save a lot of keystrokes
var ex = VOUtility.makeException(faultEvent); Although modern IDEs do type inference in the IDE level but compiling the code produces a lot of warnings when you don't declare the types. |
Beta Was this translation helpful? Give feedback.
-
ReservedWord as IdentifierNameFollow Royale compiler on IdentifierName for function definitions, variable bindings, destructuring patterns and property operators. |
Beta Was this translation helpful? Give feedback.
-
Allow reserved word after dot and
|
Beta Was this translation helpful? Give feedback.
-
I think one of the worst and most universal things is lack of block-scope. Variable hoisting is trash and forces all sorts of "this" shenanigans. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Explicit Property Disambiguation
const dictionary: Dictionary = new Dictionary();
dictionary.toString = 10;
dictionary.valueOf = '';
trace(dictionary.constructor); Solve it by explicitly disambiguation between fixed and dynamic properties by reserving two certain non-parenthesized E4X qualifiers, such as dictionary.fixed::valueOf // refers to a "valueOf" property of the Dictionary prototype
dictionary.dynamic::valueOf // refers to a "valueOf" property of the dictionary |
Beta Was this translation helpful? Give feedback.
-
I think it's good to consider the ECMA standard (as many have), as ActionScript 3.0's origins began there, so it makes sense to revisit current standards. Also, as Haxe is something of a spiritual successor to ActionScript 3.0, with a community that I suspect has many roots in ActionScript 3.0, I'd be looking to see what's working well there too, when considering like-features for an official ActionScript 3.0 successor. It features a number of things already raised here.
I expect this would look quite approachable to an ActionScript 3.0 dev. class Game {
// Haxe applications have a static entry point called main
static function main() {
// Anonymous structures.
var playerA = { name: "Simon", move: Paper }
var playerB = { name: "Nicolas", move: Rock }
// Array pattern matching. A switch can return a value.
var result = switch [playerA.move, playerB.move] {
case [Rock, Scissors] |
[Paper, Rock] |
[Scissors, Paper]: Winner(playerA);
case [Rock, Paper] |
[Paper, Scissors] |
[Scissors, Rock]: Winner(playerB);
case _: Draw;
}
// Paper vs Rock, who wins?
trace('result: $result');
}
}
// Allow anonymous structure named as type.
typedef Player = { name: String, move: Move }
// Define multiple enum values.
enum Move { Rock; Paper; Scissors; }
// Enums in Haxe are algebraic data type (ADT), so they can hold data.
enum Result {
Winner(player:Player);
Draw;
} |
Beta Was this translation helpful? Give feedback.
-
The TLF TextField is deprecated. What's next? TLF TextField is deprecated. TextField is out of date. A modern text displaying framework is needed. |
Beta Was this translation helpful? Give feedback.
-
is not and not in operators if (instance is not SomeClass)
if (key not in Object) instead of if (!(instance is SomeClass))
if (!(key in Object)) |
Beta Was this translation helpful? Give feedback.
-
Package aliasThis syntax allows to alias the package com.ea.n4s {
public class N4S {}
}
// 1. Alias `com.ea.n4s` (public) and (internal) into a `n4s` NamespaceSet here
// 2. Open `com.ea.n4s` (public) here
import n4s = com.ea.n4s.*;
new n4s::N4S; |
Beta Was this translation helpful? Give feedback.
-
I recently found a specification in C # very interesting. In C#, the basic data type has corresponding keywords, compiler replaces the keyword with The actual basic types of .NET Framework. This to some extent ensures the coupling between language and runtime. For example, keyword |
Beta Was this translation helpful? Give feedback.
-
Dynamic compiling: Compile ActionScript code to bytecode on runtime. Using like the |
Beta Was this translation helpful? Give feedback.
-
Oh no. That is very sad indeed. :( |
Beta Was this translation helpful? Give feedback.
-
Options ClassesAn options class is a class containing the Note: options classes are common for defining options that a method or constructor may receive. A property is optional when it includes either null, undefined, or a default value (always the case in standard ActionScript 3.0). A property would not be optional when it is of a non-nullable data type such as in the [Options]
class MyC1 {
var property: Number;
}
var o1 : MyC1 = {
property: 10,
};
var o2 : * = MyC1({
property: 10,
}); This proposal implies that the call operator The call operator is required where a context accepts more than one type rather than only a specific |
Beta Was this translation helpful? Give feedback.
-
Package concatenationPackage concatenation is the ability to contribute a series of packages into one package, combining all their package foo.core {
public += baz.util.*;
public += qux.**;
public += baz.x.action;
} The syntax is defined as public += PackageName . * Use the former for concatenating one package and the latter for recursive packages. Edit: allow individual aliases too. public += PackageName . IdentifierName
|
Beta Was this translation helpful? Give feedback.
-
ConfigurationThe following Note: indeed, if-else can be used already with inline constants. The purpose here is to allow annotatable directives taking the exact same parent scope. In the present, this fails in AS3: package {
import flash.display.Sprite;
public class Main extends Sprite {
if (FOO::BAR) {
protected var fooBar: Number; // ERROR
} else {
trace("Qux");
}
public function Main() {
}
}
} This proposal would make it work: package {
import flash.display.Sprite;
public class Main extends Sprite {
configuration {
if (FOO::BAR) {
protected var fooBar: Number
} else {
trace("Qux");
}
}
public function Main() {
}
}
} The conditions can be a little more advanced, using relative and logical operations for example. This would allow to define classes and properties conditionally at compile-time. I've personally found that more AS3-ish or E4X-ish than using a hashword such as |
Beta Was this translation helpful? Give feedback.
-
I would love for support of Range Iteration like this in for loops, like in Haxe for (i in 0...10) {
if (i == 2) continue; // skip 2
if (i == 5) break; // stop at 5
trace(i);
} It's easier to do than for (var i:int = 0; i < 10; i++) {
if (i == 2)
{continue;} // skip 2
if (i == 5)
{break;} // stop at 5
trace(i);
} |
Beta Was this translation helpful? Give feedback.
-
More of an AIR than pure AS idea. It would add a lot of possibilities. Just a thought :) |
Beta Was this translation helpful? Give feedback.
-
Could |
Beta Was this translation helpful? Give feedback.
-
Just starting a thread for people to discuss ideas for the Actionscript Language.
Please follow the following to keep these ideas clean and easy to read and discuss:
Beta Was this translation helpful? Give feedback.
All reactions