This file contains 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 core.stdc.stdio : printf; | |
void main() | |
{ | |
auto file = new File(__FILE__); | |
scope(exit) file.close; | |
// file に対してバイナリ入力を始める | |
auto binport = new BinaryInputPort(file); |
This file contains 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
#!r6rs | |
(import (rnrs)) | |
(define (iota-step k n s) | |
(if (<= s 0) (assertion-violation 'iota "non-positive step" s)) | |
(cond ((> k n) '()) | |
(else (cons k (iota-step (+ k s) n s))))) | |
(define-syntax iota | |
(lambda (stx) |
This file contains 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
# Makefile to build FreeBSD D runtime library libphobos2.a and its unit test | |
# | |
# make clean => removes all targets built by the makefile | |
# | |
# make zip => creates a zip file of all the sources (not targets) | |
# referred to by the makefile, including the makefile | |
# | |
# make release => makes release build of the library (this is also the | |
# default target) | |
# |
This file contains 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 std.stdio; | |
void main() | |
{ | |
C c1, c2; | |
C r1, r2; | |
r1 = c1 = new C(1); | |
r2 = c2 = new C(2); |
This file contains 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 int a = ensureNonNegative!(+42); // ok | |
enum int b = ensureNonNegative!(-42); // error! | |
template ensureNonNegative(int i) | |
{ | |
static if (i < 0) | |
mixin error!("Aiiieeeeeeeeeee! i=", i); | |
else | |
enum int ensureNonNegative = i; |
This file contains 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
class Container | |
{ | |
struct // Unique | |
{ | |
// Unique のデストラクタ… | |
// これが呼ばれたとき,Unique 自身のメモリ領域 (Container のメモリ領域) は生きてる? 死んでる? | |
// | |
// 「Container のメモリ領域開放 → Unique の破棄」というシナリオはあり得る? 逆はあっても…. | |
// |
This file contains 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
struct S | |
{ | |
int[] array; | |
int value; | |
R another; | |
} | |
struct R | |
{ | |
int[] array; |
This file contains 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
void main() | |
{ | |
enum s = S(S.F(42)); | |
alias W!( s .a ) k3; // 'a' | |
// alias W!(wantValue(s .a)) k4; // Error: this for a needs to be type F not type A | |
alias W!( s.forward.a ) k1; // 'a' | |
alias W!(wantValue(s.forward.a)) k2; // '42' | |
} | |
alias W!(S .square) symA; |
This file contains 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
diff --git src/mtype.c src/mtype.c | |
index 0dadfc6..c046505 100644 | |
--- src/mtype.c | |
+++ src/mtype.c | |
@@ -5403,6 +5403,10 @@ d_uns64 TypeQualified::size(Loc loc) | |
* if type, *pt is set | |
*/ | |
+static Dsymbol *searchForwardedSymbol(Loc loc, Scope *sc, | |
+ AggregateDeclaration *aggr, Identifier *id); |
This file contains 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 MyObject : Object | |
{ | |
init = Object.init, | |
} | |
static assert(!is(MyObject == Object)); | |
static assert(is(MyObject : Object)); | |
void main() |