Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

whisper confuzzle

Moderators: kris

Posted: 09/05/08 01:36:20

Hello.

Playing with FileConduit/Writer?, I came across the following. Is it not supposed to do that, or am I just being dumb?

tak.d(15): Error: writer is used as a type
tak.d(15): Error: writer is used as a type
tak.d(15): Error: can't have array of void()
tak.d(15): Error: declaration tak.main.c is already defined
tak.d(19): Error: reader is used as a type
tak.d(19): Error: d2 is used as a type
tak.d(19): Error: cannot have parameter of type void
tak.d(19): Error: reader is used as a type
tak.d(19): Error: d2 is used as a type
tak.d(19): Error: cannot have parameter of type void
tak.d(19): Error: can't have array of void(void)
tak.d(19): Error: declaration tak.main.c is already defined

from this:

writer(c[0])(d)();
...
reader(c[0])(d2);

in this:

import tango.io.Stdout;
import tango.io.FileConduit;
import tango.io.protocol.Writer;
import tango.io.protocol.Reader;

void main(char[][] args){
  auto f = new FileConduit("test.dat",FileConduit.WriteCreate);
  auto writer = new Writer(f);
  auto reader = new Reader(f);

  char[] c = new char[23];
  c[0..11] = "hello world".dup;
  double d = 3.14159;

  writer(c[0])(d)();
  f.seek(0);
  char[] c2 = new char[12]; double d2;

  reader(c[0])(d2);
  Stdout(c[0]).newline;
  Stdout(d2).newline;

}

Author Message

Posted: 09/05/08 01:37:44

Whoops,

I'm using DMD 1.033 and tango 0.997, I think.