Untitled
Anonymous
d
10/15/2022 11:30 PM
896 B
21
Indexable
// Class constructor test thing
// Regular old unsafe
this(Game game) {
super(game);
this.world = new World(100, 100);
atlas = cache.get("atlas").get();
this.exporter = new MapExporter(this);
}
// Wow, we're being safe
@safe:
@trusted
this(Game game) {
// Something unsafe goes here like this:
super(game);
// Single line safety
(() @safe => writeln("test"))();
// Safe scope
(() @safe => ({
writeln("I am being safe");
writeln("blorp shmoop");
}))();
// Back to trusted unsafe
this.world = new World(100, 100);
atlas = cache.get("atlas").get();
this.exporter = new MapExporter(this);
}Editor is loading...