# How definitions should (theoretically) be written in AS3

**URL:** <https://forum.kirupa.com/t/how-definitions-should-theoretically-be-written-in-as3/322783>\
**Category:** flash\
**Created:** [June 3, 2011, 12:48am UTC](https://forum.kirupa.com/t/how-definitions-should-theoretically-be-written-in-as3/322783 "2011-06-03T00:48:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [June 3, 2011, 12:48am UTC](https://forum.kirupa.com/t/how-definitions-should-theoretically-be-written-in-as3/322783/1 "2011-06-03T00:48:10Z")

</div>

**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:

```auto
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:

```auto
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:

```auto
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.

```auto
public const CountingMechanism:Class = { <definition> }

```

[CENTER] ![](http://www.conjointgaming.com/forum/Smileys/classic/spray_trollface_copy.png)[/CENTER]
