Note: Once again I am playing around with my purely fictional language beyond the confined bounds of AS3. This post has no practical applications what so ever, and is merely an exercise of the mind.
[SIZE=3]Java-style definitions[/SIZE]
Before explaining my idea, let’s take a step back for a second and look at how variables are defined in “Java-like” languages:
public int counter = <definition>;
[LIST]
[*]Here you are defining the name counter as an int data type.
[SIZE=1]You are then merging what should be two lines of code and assigning it a value, but that is a topic for another time.[/SIZE]
[/LIST]
Now, let’s look at how classes are defined:
public class CountingMechanism { <definition> }
[LIST]
[*]Here you are defining the name CountingMechanism as a class data type.
[SIZE=1]And theoretically also assigning it immediately after the definition, just without an equals operator.[/SIZE]
[/LIST]
[SIZE=3]How class definitions should (theoretically) be written in AS3[/SIZE]
Now, if you look at definitions like that and follow the same pattern, theoretically classes should be defined like this:
public var CountingMechanism:Class { <definition> }
Or, more accurately, since "class"definitions (or rather, named references to those definitions) can’t be replaced at runtime, technically they should be constants. Also, according to AS3, constants need to use the assignment operator as well.
public const CountingMechanism:Class = { <definition> }
[CENTER][/CENTER]