This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In Lapsang static composition can be used to add features to types in a way that can be validated by the compiler. | |
The syntax for a new function component takes the form: | |
package some.component.package.name | |
component returnType functionName(type someName) default implFunctionName | |
component returnType implFunctionName(type someName) | |
code goes here | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a class that is similar to: | |
public class SystemConfiguration<T1, T2, T3, T4, T5> | |
where T1 : ILogger, new() | |
where T2 : IReporter, new() | |
where T3 : IQueue, new() | |
where T4 : IConfiguration, new() | |
where T5 : ILauncher, new() | |
{ | |
public SystemConfiguration() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Take the following method: | |
private void UpdateCurrentBall() | |
{ | |
_currentBall++; | |
if (_currentBall == 3) | |
{ | |
_currentBall = 0; | |
_currentFrame++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enum base class: | |
package language.extensions.enums | |
{ | |
public class EnumBase | |
{ | |
function EnumBase(token:*) | |
{ | |
if (token !== runtimeInstantiationPreventionKey) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.display.MovieClip | |
import flash.display.Sprite | |
import haxe.Timer | |
import flash.Lib | |
class MathSinbyexample | |
@RED: Int = 0xFF0000 | |
_stage:MovieClip | |
_view_mc:Sprite | |
_wide:Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following two methods use the currentDateTime() method to get the current time, | |
rather than calling new Date() directly. the only reason I did this was so that I | |
could override currentDateTime() in my test case class in order to pass in an | |
existing Date object to ensure that the time would not have changed between the | |
method being called and the assert made. | |
Is this bad practice? I can't decide. | |
/** | |
* Callback method used by _macroSubstitutions to provide the current date in DD_MMM_YYYY format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public function initialiseSetsUpModelStateAndMap():void | |
{ | |
var model:Model = new Model(); | |
var state:State = new State(); | |
var map:Dictionary = new Dictionary(); | |
initialise(model, state, map); | |
assertThat(_model, strictlyEqualTo(model)); |
NewerOlder