Re: read single characters from stdin

2012-09-26 Thread nazriel
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch wrote: Hi, to learn D, I'd like to write a simple type trainer. It should write a line to stdout and then read single characters from stdin and only accept the correct characters How can I read single characters? A similar questio

Finite state machine in D

2012-09-26 Thread Druzhinin Alexandr
Hello Could someone help me with FSM (like boost MSM but simpler and in D of course) - where should I start from? I found good paper about FSM implementation in c++ (with type list and so on), but I'm not sure it is applicable in D. What is the D-way to implement fsm with code generation?

importing executables

2012-09-26 Thread Josh
I'm trying to make an installer application in D. I've checked with various hashes and the file it's outputting is different to the original, and therefore Windows is saying it's not a valid Win32 application. I'm sure it's me doing something wrong and not DMD's fault. Any help is appreciated.

Re: enum of tuples

2012-09-26 Thread Jonathan M Davis
On Wednesday, September 26, 2012 23:24:08 bearophile wrote: > Van de Bugger: > > Oops. What the problem? > > I seems one or more bugs. D named enums are adapted from the C > language, they were first of all meant to contain simple values > like ints or chars. The more complex things you keep tryin

append element to variantArray

2012-09-26 Thread Samuele Carcagno
Is it possible to append elements to a variantArray after it has been created? I have tuples of type: alias Tuple!(float[][][string], "data", ulong[string], "nSegs") aveNSegsTuple; I would like to append these tuples to a variantArray in a for loop, as more results come in. Thank you in ad

Re: enum of tuples

2012-09-26 Thread bearophile
Van de Bugger: Oops. What the problem? I seems one or more bugs. D named enums are adapted from the C language, they were first of all meant to contain simple values like ints or chars. The more complex things you keep trying to put in them, the more bugs you will find :-) People in D.learn

Re: enum of tuples

2012-09-26 Thread Van de Bugger
BTW, I use DMD64 D Compiler v2.060 on Fedora 17. ldc2 compiler (LLVM D Compiler LDC trunk, based on DMD v2.059 and LLVM 3.0) produces similar results: $ ldc2 -c -w enum_of_tuples.d enum_of_tuples.d(5): Error: template std.typecons.Tuple!(int,"v").Tuple.opCmp does not match any function templa

enum of tuples

2012-09-26 Thread Van de Bugger
Hi, I faced a little trouble and can not decide if it is a my mistake, a bug in std library or in compiler… Look: $ cat enum_of_structs.d struct T { int v; int opCmp( T rhs ) { return v == rhs.v ? 0 : ( v < rhs.v ? -1 : +1 ); }; }; enum E : T { A = T( 1 ),

Re: read single characters from stdin

2012-09-26 Thread Adam D. Ruppe
On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch wrote: How can I read single characters? The way I'd do it is with the C call fgetc(stdin). You can do it in D the same way if you import core.stdc.stdio; But, if you are on Linux, it isn't going to be that simple. The Linux termi

read single characters from stdin

2012-09-26 Thread Thomas Koch
Hi, to learn D, I'd like to write a simple type trainer. It should write a line to stdout and then read single characters from stdin and only accept the correct characters How can I read single characters? A similar question has been asked before without a working answer: http://forum.dlang.or

Re: GUI development libraries in D?

2012-09-26 Thread Gary Willoughby
On Tuesday, 25 September 2012 at 21:51:40 UTC, Matthew Turner wrote: Hello, I'm wondering if there is any library for making a GUI with D. If not, what would you recommend for that? Could I just use c++ libraries? Thank you, Matt GtkD is probably your best bet. I wrote a blog post here o

Re: object.error: Privileged Instruction

2012-09-26 Thread Don Clugston
On 22/09/12 21:49, Jonathan M Davis wrote: On Saturday, September 22, 2012 21:19:27 Maxim Fomin wrote: Privilege instruction is an assembly instruction which can be executed only at a certain executive process context, typically os kernel. AFAIK assert(false) was claimed to be implemented by dmd

Re: function is not function

2012-09-26 Thread Don Clugston
On 21/09/12 21:59, Ellery Newcomer wrote: solution is to use std.traits, but can someone explain this to me? import std.stdio; void main() { auto a = { writeln("hi"); }; pragma(msg, typeof(a)); // void function() pragma(msg, is(typeof(a) == delegate)); // nope!

Re: Testing for template argument being result of takeExactly

2012-09-26 Thread Timon Gehr
On 09/26/2012 05:08 PM, Andrei Alexandrescu wrote: On 9/26/12 9:50 AM, monarch_dodra wrote: struct S{}; is(typeof(takeExactly(S, 1)) == S) //false is(S == typeof(takeExactly(S, 1))) //Error: template std.range.takeExactly does not match any function template declaration Neither should work. T

Re: GUI development libraries in D?

2012-09-26 Thread Jesse Phillips
On Tuesday, 25 September 2012 at 21:51:40 UTC, Matthew Turner wrote: Hello, I'm wondering if there is any library for making a GUI with D. If not, what would you recommend for that? Could I just use c++ libraries? Thank you, Matt http://www.prowiki.org/wiki4d/wiki.cgi?GuiLibraries Sorry

Re: Testing for template argument being result of takeExactly

2012-09-26 Thread Andrei Alexandrescu
On 9/26/12 9:50 AM, monarch_dodra wrote: struct S{}; is(typeof(takeExactly(S, 1)) == S) //false is(S == typeof(takeExactly(S, 1))) //Error: template std.range.takeExactly does not match any function template declaration Neither should work. The expression should be takeExactly(S.init, 1). And

Re: Testing for template argument being result of takeExactly

2012-09-26 Thread Timon Gehr
On 09/26/2012 03:50 PM, monarch_dodra wrote: On Wednesday, 26 September 2012 at 13:19:13 UTC, Timon Gehr wrote: On 09/25/2012 08:41 AM, monarch_dodra wrote: On Monday, 24 September 2012 at 22:13:51 UTC, Timon Gehr wrote: On 09/24/2012 09:41 AM, monarch_dodra wrote: > [SNIP] I don't think this

Re: Linking OpenSSL on Windows

2012-09-26 Thread Jason Spencer
I think this thread is not TOO old to use as a place to beg for help :) I've wandered into this nightmare, and I'm hoping someone who's been down this road can point the way back to the light. Summary: "no OPENSSL_Applink" runtime error when executing D openssl application. I have managed

Re: Testing for template argument being result of takeExactly

2012-09-26 Thread monarch_dodra
On Wednesday, 26 September 2012 at 13:19:13 UTC, Timon Gehr wrote: On 09/25/2012 08:41 AM, monarch_dodra wrote: On Monday, 24 September 2012 at 22:13:51 UTC, Timon Gehr wrote: On 09/24/2012 09:41 AM, monarch_dodra wrote: > [SNIP] I don't think this does what you think it does. The 'is(R r)' d

Re: Testing for template argument being result of takeExactly

2012-09-26 Thread Timon Gehr
On 09/25/2012 08:41 AM, monarch_dodra wrote: On Monday, 24 September 2012 at 22:13:51 UTC, Timon Gehr wrote: On 09/24/2012 09:41 AM, monarch_dodra wrote: > [SNIP] I don't think this does what you think it does. The 'is(R r)' declares r to be an alias for R. So 'r' is a type in that code snippet

Re: How can I hide implementation details when make a library

2012-09-26 Thread Daniel Kozak
On Tuesday, 25 September 2012 at 17:54:39 UTC, Jonathan M Davis wrote: On Tuesday, September 25, 2012 13:58:00 Daniel Kozak wrote: Yes, it works. Thanks a lot. However I still dont get it, why dmd generates all sources instead of just public symbols and functions declarations A number of feat