Artūras Šlajus
arturas@tinylabproductions.com
public static int parseInt(string str);
public Player findPlayerIn(int x, int y);
public void updateState(
Vector3 movement,
bool animating, string animationType
);
public class Player : MonoBehaviour {
public void init(FooManager fooManager) {
...
}
}
public class Player : MonoBehaviour {
public class Init {
public Init(FooManager fooManager) {
...
}
}
}
// Not honest
public Player findPlayer(int x, int y);
// Honest
public Option<Player> findPlayer(int x, int y);
We haven't seen an NPE in ages.
// Not honest
public static int parseInt(string str);
// Somewhat honest
public static bool tryParseInt(
string str, out int parsed
);
// Honest
public static Either<string, int> parseInt(
string str
);
Represents a value that may be available in the future.
TLPLib - Future, no threading support
C# stdlib - Task, with threading, heavy
Represents a value stream.
Think of LINQ for events
TLPLib - integrated with library, no threading support
Unirx - standalone, more C#ish, threading support, heavier
[SerializeField, NotNull]
GameObject bulletPrefab;
[SerializeField, NonEmpty]
List<GameObject> enemyPrefabs;
Available in TLPLib
https://slides.com/arturasslajus/c-sharp-fp-unity3d
Artūras Šlajus
arturas@tinylabproductions.com