fork download
  1. #!/usr/bin/env rdmd
  2. import std.stdio;
  3. import std.typecons;
  4.  
  5. struct Array(T) {
  6. private T[] arr;
  7. mixin Proxy!arr;
  8. this(T[] a) { arr = a; }
  9.  
  10. @property
  11. void each(void delegate(T) dg) {
  12. foreach(a; arr) {
  13. dg(a);
  14. }
  15. }
  16. }
  17.  
  18. void main(in string[] args) {
  19. Array!int ar = [1,2,3,4];
  20. ar.each(a => writeln(a));
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.d(20): expression expected, not '>'
prog.d(20): found 'writeln' when expecting ','
stdout
Standard output is empty