www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Build error about LockingTextWriter

reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Dear,
i do not understand what is wrong in my code and produce this:

-------------------------
$ ldc2 ../../lib/libdscience-ldc.a -I=3D../.. fasta.d
/usr/include/d/std/range.d(295): Error: static assert  "Cannot put a
Sequence into a LockingTextWriter"
    instantiatied in /usr/include/d/std/format.d(1512):
put!(LockingTextWriter,Sequence)
    instantiatied in /usr/include/d/std/format.d(1869):
formatRange!(LockingTextWriter,Sequence,char)
    instantiatied in /usr/include/d/std/format.d(2232):
formatValue!(LockingTextWriter,Sequence,char)
    ... (1 instantiations, -v to show) ...
    instantiatied in /usr/include/d/std/stdio.d(684):
formattedWrite!(LockingTextWriter,char,Sequence)
    instantiatied in /usr/include/d/std/stdio.d(1563):
write!(Sequence,char)
    instantiatied in fasta.d(12): writeln!(Sequence)
-------------------------


sequence file can be show here:
https://gitorious.org/dscience/dscience/blobs/master/dscience/molecules/seq=
uence.d


thanks
Mar 03 2012
next sibling parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/03/2012 06:11 AM, bioinfornatics wrote:
 Dear,
 i do not understand what is wrong in my code and produce this:

 -------------------------
 $ ldc2 ../../lib/libdscience-ldc.a -I=../.. fasta.d
 /usr/include/d/std/range.d(295): Error: static assert  "Cannot put a
 Sequence into a LockingTextWriter"
      instantiatied in /usr/include/d/std/format.d(1512):
 put!(LockingTextWriter,Sequence)
      instantiatied in /usr/include/d/std/format.d(1869):
 formatRange!(LockingTextWriter,Sequence,char)
      instantiatied in /usr/include/d/std/format.d(2232):
 formatValue!(LockingTextWriter,Sequence,char)
      ... (1 instantiations, -v to show) ...
      instantiatied in /usr/include/d/std/stdio.d(684):
 formattedWrite!(LockingTextWriter,char,Sequence)
      instantiatied in /usr/include/d/std/stdio.d(1563):
 write!(Sequence,char)
      instantiatied in fasta.d(12): writeln!(Sequence)
 -------------------------


 sequence file can be show here:
 

 thanks

Just by reading the code, LockingTextWriter can "put" only the dchar type. This is from std.stdio: /// Range primitive implementations. void put(A)(A writeme) if (is(ElementType!A : const(dchar))) // ... void put(C)(C c) if (is(C : const(dchar))) I haven't tried it myself, but changing the return type of Sequence.front() to dchar would work. Ali
Mar 03 2012
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/03/2012 09:00 AM, bioinfornatics wrote:
 Le samedi 03 mars 2012 à 07:38 -0800, Ali Çehreli a écrit :
 On 03/03/2012 06:11 AM, bioinfornatics wrote:
   >  Dear,
   >  i do not understand what is wrong in my code and produce this:
   >
   >  -------------------------
   >  $ ldc2 ../../lib/libdscience-ldc.a -I=../.. fasta.d
   >  /usr/include/d/std/range.d(295): Error: static assert  "Cannot 


   >  Sequence into a LockingTextWriter"
   >       instantiatied in /usr/include/d/std/format.d(1512):
   >  put!(LockingTextWriter,Sequence)
   >       instantiatied in /usr/include/d/std/format.d(1869):
   >  formatRange!(LockingTextWriter,Sequence,char)
   >       instantiatied in /usr/include/d/std/format.d(2232):
   >  formatValue!(LockingTextWriter,Sequence,char)
   >       ... (1 instantiations, -v to show) ...
   >       instantiatied in /usr/include/d/std/stdio.d(684):
   >  formattedWrite!(LockingTextWriter,char,Sequence)
   >       instantiatied in /usr/include/d/std/stdio.d(1563):
   >  write!(Sequence,char)
   >       instantiatied in fasta.d(12): writeln!(Sequence)
   >  -------------------------
   >
   >
   >  sequence file can be show here:
   >
 


   >
   >
   >  thanks
   >

 Just by reading the code, LockingTextWriter can "put" only the dchar
 type. This is from std.stdio:

           /// Range primitive implementations.
           void put(A)(A writeme) if (is(ElementType!A : const(dchar)))
 // ...
           void put(C)(C c) if (is(C : const(dchar)))

 I haven't tried it myself, but changing the return type of
 Sequence.front() to dchar would work.


I was wrong anyway. I think is(C : const(dchar)) means if C can implicitly be convertible to dchar. That is the case for char and wchar, so that can't be the reason.
 Ali

thanks ali i have try but no same error

Sorry, no more ideas here. :( Ali
Mar 03 2012
prev sibling parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le samedi 03 mars 2012 =C3=A0 07:38 -0800, Ali =C3=87ehreli a =C3=A9crit :
 On 03/03/2012 06:11 AM, bioinfornatics wrote:
  > Dear,
  > i do not understand what is wrong in my code and produce this:
  >
  > -------------------------
  > $ ldc2 ../../lib/libdscience-ldc.a -I=3D../.. fasta.d
  > /usr/include/d/std/range.d(295): Error: static assert  "Cannot put a
  > Sequence into a LockingTextWriter"
  >      instantiatied in /usr/include/d/std/format.d(1512):
  > put!(LockingTextWriter,Sequence)
  >      instantiatied in /usr/include/d/std/format.d(1869):
  > formatRange!(LockingTextWriter,Sequence,char)
  >      instantiatied in /usr/include/d/std/format.d(2232):
  > formatValue!(LockingTextWriter,Sequence,char)
  >      ... (1 instantiations, -v to show) ...
  >      instantiatied in /usr/include/d/std/stdio.d(684):
  > formattedWrite!(LockingTextWriter,char,Sequence)
  >      instantiatied in /usr/include/d/std/stdio.d(1563):
  > write!(Sequence,char)
  >      instantiatied in fasta.d(12): writeln!(Sequence)
  > -------------------------
  >
  >
  > sequence file can be show here:
  >=20
 https://gitorious.org/dscience/dscience/blobs/master/dscience/molecules/s=

  >
  >
  > thanks
  >
=20
 Just by reading the code, LockingTextWriter can "put" only the dchar=20
 type. This is from std.stdio:
=20
          /// Range primitive implementations.
          void put(A)(A writeme) if (is(ElementType!A : const(dchar)))
 // ...
          void put(C)(C c) if (is(C : const(dchar)))
=20
 I haven't tried it myself, but changing the return type of=20
 Sequence.front() to dchar would work.
=20
 Ali
=20

thanks ali i have try but no same error
Mar 03 2012