Re: Problem with rdmd

2013-09-01 Thread eles
Bah, what would be the meaning of accepting the shebang syntax then? SCripts are made to provide a quick way to hack: you edit it for 5 mins, you run it. You change a parameter inside, you run it. Otherwise, there would be no need for scripts, everything could be compiled, even if you fill ever

Iterate over a string to get unicode codes

2013-09-01 Thread Flamaros
Is there a simple way to extract from a string all Unicode codes as uint values?

Re: Iterate over a string to get unicode codes

2013-09-01 Thread Adam D. Ruppe
On Sunday, 1 September 2013 at 14:07:00 UTC, Flamaros wrote: Is there a simple way to extract from a string all Unicode codes as uint values? string foo = "whatever"; foreach(dchar ch; foo) { // ch is the code point as a 32 bit number // use it directly or cast to uint here }

Re: Iterate over a string to get unicode codes

2013-09-01 Thread Jos van Uden
On 1-9-2013 16:11, Adam D. Ruppe wrote: On Sunday, 1 September 2013 at 14:07:00 UTC, Flamaros wrote: Is there a simple way to extract from a string all Unicode codes as uint values? string foo = "whatever"; foreach(dchar ch; foo) { // ch is the code point as a 32 bit number // use it

Re: Iterate over a string to get unicode codes

2013-09-01 Thread Flamaros
On Sunday, 1 September 2013 at 14:11:54 UTC, Adam D. Ruppe wrote: On Sunday, 1 September 2013 at 14:07:00 UTC, Flamaros wrote: Is there a simple way to extract from a string all Unicode codes as uint values? string foo = "whatever"; foreach(dchar ch; foo) { // ch is the code point as a 32

Re: unserialize variants

2013-09-01 Thread Ali Çehreli
On 08/31/2013 10:22 PM, gedaiu wrote:> Hi, > > i want to save data from an array of variants into a file. I saw that > to!string format the array content in a nice way... I don't think the format is sufficient for recreating the array: import std.variant; import std.conv; import std.stdio; stru

Pitfalls of delegates inside ranges

2013-09-01 Thread Joseph Rushton Wakeling
Hello all, I came across an interesting little pitfall of delegates recently which I thought I'd share. TL;DR: having reference types as struct members can be dangerous. ;-) Suppose we have a fairly simple range which is supposed to count from 0 to some maximum. The trick is that the count

Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread John Carter
So I'm a reasonably experienced C/C++/Ruby/... programmer and D is looking very Good to me... So, time to get serious and sit down and learn it. Ultimately it won't pay me to learn it unless I can ultimately take my colleagues along. Currently they are itching to move from C to C++, and I'm

Re: Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread maarten van damme
1) afaik you can't cross compile to arm with dmd. I know it's possible with gdc. 2) There are people who successfully use d without gc. I think andrei posted a stub gc that throws an exception every time the garbage collector is tried to get used. You can't use whole phobos (yet) without gc. 2013

Re: Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread bearophile
John Carter: We work in the embedded linux real time area, I think you could use D for embedded area, but I think of D more like a low level application language. 1) Which D compiler should we start with? dmd is more updated and it's the reference one, it compiles fast, but it produces

Integer constant expression expected instead of...

2013-09-01 Thread Era Scarecrow
[code] enum fieldEntryLength = 4; //immutable fieldEntryLength = 4; //same issue alias immutable(char[fieldEntryLength]) NString; [/code] test.d(10): Error: Integer constant expression expected instead of fieldEntryLength This breaks code that previously compiled. I really don't see t

Re: Integer constant expression expected instead of...

2013-09-01 Thread bearophile
Era Scarecrow: [code] enum fieldEntryLength = 4; //immutable fieldEntryLength = 4; //same issue alias immutable(char[fieldEntryLength]) NString; [/code] test.d(10): Error: Integer constant expression expected instead of fieldEntryLength This breaks code that previously compiled. I re

Re: Integer constant expression expected instead of...

2013-09-01 Thread Era Scarecrow
On Monday, 2 September 2013 at 01:19:44 UTC, bearophile wrote: Era Scarecrow: [code] enum fieldEntryLength = 4; //immutable fieldEntryLength = 4; //same issue alias immutable(char[fieldEntryLength]) NString; [/code] test.d(10): Error: Integer constant expression expected instead of fieldEnt

Re: Integer constant expression expected instead of...

2013-09-01 Thread Era Scarecrow
Added: http://d.puremagic.com/issues/show_bug.cgi?id=10946

Re: Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread Adam D. Ruppe
On Monday, 2 September 2013 at 00:32:52 UTC, bearophile wrote: I think no one has converted CImg to D. There is a graphics project for D, perhaps named simplegraphics, that contains about 0.01% of CImg. If you mean my little libs, I'm not really aiming for complex drawing. simpledisplay.d has

Re: Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread John Carter
Thanks for your reply! On Monday, 2 September 2013 at 00:32:52 UTC, bearophile wrote: I didn't know it uses significant macros. Could you show some of such code pieces? Here is the documentation... http://cimg.sourceforge.net/reference/group__cimg__loops.html // Macros to perform various imag

Re: Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

2013-09-01 Thread bearophile
John Carter: "How easy is it to convert both C++ programs and C++ programmers to D?" Porting C code to D is not hard, it's mostly mechanical work, you just have to keep an eye on few things (like passing fixed-sized arrays to functions by reference, global floating point data not initialize

Error: type XXX is not an expression

2013-09-01 Thread Era Scarecrow
I feel like i need to fully re-learn and familiarize myself with D now. This is an interesting error I'm coming across, it's not pointing to anything in particular. I've used the -v verbose flag and it seems to appear each time after a struct declaration. code subrecord function smartm

Re: Error: type XXX is not an expression

2013-09-01 Thread Era Scarecrow
k here's the condensed test file. Seems related to an 'alias this', in theory the HandleFlags bit/flag handling you should be able to say 'state.def' and it would be the same as 'FlagStates.def' without actually having to name it. [code] import std.traits; /// struct HandleFlags(E, I) if (is(

Re: Pitfalls of delegates inside ranges

2013-09-01 Thread H. S. Teoh
On Mon, Sep 02, 2013 at 12:27:44AM +0200, Joseph Rushton Wakeling wrote: > Hello all, > > I came across an interesting little pitfall of delegates recently > which I thought I'd share. > > TL;DR: having reference types as struct members can be dangerous. ;-) Yes. > Suppose we have a fairly sim

Re: Error: type XXX is not an expression

2013-09-01 Thread H. S. Teoh
On Mon, Sep 02, 2013 at 06:21:18AM +0200, Era Scarecrow wrote: > k here's the condensed test file. Seems related to an 'alias > this', in theory the HandleFlags bit/flag handling you should be > able to say 'state.def' and it would be the same as > 'FlagStates.def' without actually having to name

Re: Error: type XXX is not an expression

2013-09-01 Thread Era Scarecrow
On Monday, 2 September 2013 at 04:49:46 UTC, H. S. Teoh wrote: You can't alias a type to this. You need to instantiate it first, then alias the instance to this (because 'this' is an object, not a type). For example: struct S {} struct T { //alias S this; // NG