Re: Unique IDs for each template instantiation at compile-time?

2013-12-18 Thread H. S. Teoh
On Thu, Dec 19, 2013 at 12:01:03AM +0100, Weasel wrote: > I was wondering if it was possible to generate unique(in order) IDs > for each template instantiation of a class at compile-time. [...] You could use the built-in .mangleof property to get the mangled name of the template, which can then be

Re: casting between structs

2013-12-18 Thread bearophile
Mariusz `shd` Gliwiński: * it's currently safe One thing to remember when casting, is that when you cast const/immutable to mutable, then you can't mutate the data. Bye, bearophile

casting between structs

2013-12-18 Thread Mariusz `shd` Gliwiński
I'd like to reinterpret data as different type without copying. extern(C) struct A{ /* */ } struct B { A a; alias a this; } extern(C) A* f1(){ /* */ } B* f2() { return cast(B*) f1(); } Assuming that i cast() correct state, i'd like to know if: * it's currently safe * it's guaranteed to b

Re: Unique IDs for each template instantiation at compile-time?

2013-12-18 Thread bearophile
Weasel: I was wondering if it was possible to generate unique(in order) IDs for each template instantiation of a class at compile-time. I think you can't do this. (It's usually named gensym). Bye, bearophile

Unique IDs for each template instantiation at compile-time?

2013-12-18 Thread Weasel
I was wondering if it was possible to generate unique(in order) IDs for each template instantiation of a class at compile-time. A short example of what I'm trying to do: static int counter = 0; class A(T) { enum id = counter++; } class B : A!B { } Ofcourse, this doesn't compile because the

Re: How to read fastly files ( I/O operation)

2013-12-18 Thread Jay Norwood
On Wednesday, 13 February 2013 at 17:39:11 UTC, monarch_dodra wrote: On Tuesday, 12 February 2013 at 22:06:48 UTC, monarch_dodra wrote: On Tuesday, 12 February 2013 at 21:41:14 UTC, bioinfornatics wrote: Some time fastq are comressed to gz bz2 or xz as that is often a huge file. Maybe we nee

Re: [OT] Re: How to read fastly files ( I/O operation)

2013-12-18 Thread Jay Norwood
On Friday, 8 February 2013 at 06:22:18 UTC, Denis Shelomovskij wrote: 06.02.2013 19:40, bioinfornatics пишет: On Wednesday, 6 February 2013 at 13:20:58 UTC, bioinfornatics wrote: I agree the spec format is really bad but it is heavily used in biology so i would like a fast parser to develop som

Re: Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Ali Çehreli
On 12/18/2013 01:17 PM, Hugo Florentino wrote: > Changing the codepage worked indeed. Thanks. > Now, how could I do that programmatically, so that if my application > runs on a system with a different codepage, the output looks correct? It is not solvable in general because stdout is nothing but

Re: Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 10:05:49 -0800, Ali Çehreli wrote: On 12/18/2013 05:32 AM, Hugo Florentino wrote: output is incorrect in Windows (even with unicode-supporting fonts). Is the code page also set to UTF-8? I think you must issue the command 'chcp 65001'. I have changed your program to print

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Dmitry Olshansky
19-Dec-2013 01:05, Andrej Mitrovic пишет: On 12/18/13, Dmitry Olshansky wrote: The precedent is Perl. A heavy influencer on the (former) std.regex design. http://perldoc.perl.org/perlre.html#Capture-groups (grep for $') Ah, classic Perl. Write once - don't bother to read ever again. :p Or

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Andrej Mitrovic
On 12/18/13, Dmitry Olshansky wrote: > The precedent is Perl. A heavy influencer on the (former) std.regex design. > http://perldoc.perl.org/perlre.html#Capture-groups > (grep for $') Ah, classic Perl. Write once - don't bother to read ever again. :p

Re: Embed Windows Internet Explorer

2013-12-18 Thread Andre
Am 16.12.2013 19:44, schrieb Andre: Hi, I try to embed Windows Internet Explorer into my application. Most of the coding should be availabe. During method navigate2 I get an empty white screen. No errors is thrown but also the web page is not loaded. Do you have some ideas? => Is use the window

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Dmitry Olshansky
18-Dec-2013 23:54, Andrej Mitrovic пишет: On 12/18/13, Dmitry Olshansky wrote: P.S. This reminds me to put a roadmap of sorts on where std.regex is going and what to expect. Btw one thing I'm not fond of is the format specifiers, in particular: $` part of input preceding the match. $'

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Andrej Mitrovic
On 12/18/13, Dmitry Olshansky wrote: > P.S. This reminds me to put a roadmap of sorts on where std.regex is > going and what to expect. Btw one thing I'm not fond of is the format specifiers, in particular: $` part of input preceding the match. $' part of input following the match. `

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Andrej Mitrovic
On 12/18/13, Dmitry Olshansky wrote: > By the end of day any feature is interesting as long as we carefully > weight: > > - how useful a feature is > - how widespread the syntax/how many precedents in other libraries > > against > > - how difficult to implement > - does it affect backwards compati

Re: std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Dmitry Olshansky
18-Dec-2013 22:33, Andrej Mitrovic пишет: I'm reading through http://www.regular-expressions.info, and there's a feature that's missing from std.regex, quoted: - All the characters between the \Q and the \E are interpreted as literal characters. E.g. \Q*\d+*\E matches the literal text *\d+*.

std.regex literal syntax (the \Q…\E escape sequence)

2013-12-18 Thread Andrej Mitrovic
I'm reading through http://www.regular-expressions.info, and there's a feature that's missing from std.regex, quoted: - All the characters between the \Q and the \E are interpreted as literal characters. E.g. \Q*\d+*\E matches the literal text *\d+*. The \E may be omitted at the end of the reg

Re: Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Ali Çehreli
On 12/18/2013 05:32 AM, Hugo Florentino wrote: > output is incorrect in Windows (even with unicode-supporting > fonts). Is the code page also set to UTF-8? I think you must issue the command 'chcp 65001'. I have changed your program to print the code units individually in hex. I changed the

Re: Can't isolate ICE

2013-12-18 Thread H. S. Teoh
On Wed, Dec 18, 2013 at 12:27:01PM +0100, Andrea Fontana wrote: > I have an internal compiler error in my code. I can't reduce code to > reproduce this problem, but I remember there was a tool that can do > this, what's its name? Where can I download that tool? Dustmite, by Vladimir Panteleev. It

Re: package.d

2013-12-18 Thread Joseph Rushton Wakeling
On 18/12/13 10:41, Leandro Motta Barros wrote: With these simple examples I sent, rdmd seem to resolve dependecies correctly. For example, with this last example I sent (which prints the class name): $ rdmd main.d mylib.util.Foo If I create an example analogous to yours, it seems OK. However,

Re: how to detect OS architecture?

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 13:16:35 -, Regan Heath wrote: IsWow64Process returns (in the output parameter) if the 32 bit application is running in WOW64. WOW64 *only* exists on a 64 bit OS. So, if true this tells you you're on a 64 bit OS. You don't need an additional call to GetNativeSystemI

Re: how to detect OS architecture?

2013-12-18 Thread Hugo Florentino
On Wed, 18 Dec 2013 13:20:45 -, Regan Heath wrote: On Wed, 18 Dec 2013 04:22:23 -, Hugo Florentino wrote: On Tue, 17 Dec 2013 15:13:18 +0100, Gary Willoughby wrote: Make sure you handle if users have a 32bit OS installed on a 64bit PC. As a matter of fact that was the actual confi

Wrong output of quotes in Windows (encoding?)

2013-12-18 Thread Hugo Florentino
Hi, A short while ago I had minor difficulties escaping quotes, and noticed (I don't remember where) a simple function by a D user which I have now tried to enhance. The problem is that output is incorrect in Windows (even with unicode-supporting fonts). I tried to use transcode but could not

Re: how to detect OS architecture?

2013-12-18 Thread Regan Heath
On Wed, 18 Dec 2013 04:22:23 -, Hugo Florentino wrote: On Tue, 17 Dec 2013 15:13:18 +0100, Gary Willoughby wrote: Make sure you handle if users have a 32bit OS installed on a 64bit PC. As a matter of fact that was the actual configuration in the system I wrote the app. I am now with a

Re: Can't isolate ICE

2013-12-18 Thread Andrea Fontana
On Wednesday, 18 December 2013 at 11:47:16 UTC, Timon Gehr wrote: On 12/18/2013 12:27 PM, Andrea Fontana wrote: I have an internal compiler error in my code. I can't reduce code to reproduce this problem, but I remember there was a tool that can do this, what's its name? Where can I download t

Re: how to detect OS architecture?

2013-12-18 Thread Regan Heath
On Wed, 18 Dec 2013 04:28:57 -, Hugo Florentino wrote: On Tue, 17 Dec 2013 13:21:30 -, Regan Heath wrote: Is GetNativeSystemInfo your other solution? On the MSDN page for GetNativeSystemInfo it recommends using IsWow64Process to detect if you're running under WOW64, at which point yo

Re: how to detect OS architecture?

2013-12-18 Thread Regan Heath
On Tue, 17 Dec 2013 15:13:20 -, Marco Leise wrote: Am Tue, 17 Dec 2013 13:30:25 - schrieb "Regan Heath" : On Mon, 16 Dec 2013 21:27:13 -, Hugo Florentino wrote: > On Mon, 16 Dec 2013 20:23:00 +0100, Jacob Carlborg wrote: >> On 2013-12-16 17:46, Marco Leise wrote: >> >>> Hehe,

Re: Using threads on Mac OS X using D1 and Tango

2013-12-18 Thread Jacob Carlborg
On 2013-12-15 16:28, Jacob Carlborg wrote: I'm trying to use threads on Mac OS X using D1 and Tango. I have this very simple example: import tango.core.Thread; void main () { Thread thread = new Thread({ }); thread.start(); thread.join(); } I'm using DMD 1.076 to compile the abo

Re: Can't isolate ICE

2013-12-18 Thread Timon Gehr
On 12/18/2013 12:27 PM, Andrea Fontana wrote: I have an internal compiler error in my code. I can't reduce code to reproduce this problem, but I remember there was a tool that can do this, what's its name? Where can I download that tool? https://github.com/CyberShadow/DustMite

Can't isolate ICE

2013-12-18 Thread Andrea Fontana
I have an internal compiler error in my code. I can't reduce code to reproduce this problem, but I remember there was a tool that can do this, what's its name? Where can I download that tool?

Re: package.d

2013-12-18 Thread Leandro Motta Barros
On Wed, Dec 18, 2013 at 6:56 AM, Joseph Rushton Wakeling < joseph.wakel...@webdrake.net> wrote: > On 17/12/13 01:51, Leandro Motta Barros wrote: > >> I have some code using the old "all.d" idiom, which I am changing to use >> the new >> "package.d" feature. >> > > Related question -- it seems like

Re: package.d

2013-12-18 Thread Leandro Motta Barros
Here's another rather interesting case: // mylib/util.d module mylib.util; class Foo { } // mylib/package.d module mylib; public import mylib.util; // main.d import std.stdio; import mylib; void main() { auto f = new mylib.Foo; writefln("%s", f.classinfo.name); } This prints 'mylib.util

Re: package.d

2013-12-18 Thread Joseph Rushton Wakeling
On 17/12/13 01:51, Leandro Motta Barros wrote: I have some code using the old "all.d" idiom, which I am changing to use the new "package.d" feature. Related question -- it seems like rdmd doesn't like package-based code, and can't resolve dependencies as it can with regular modules. Is there

Re: package.d

2013-12-18 Thread Andrej Mitrovic
On 12/17/13, Leandro Motta Barros wrote: > Is there any documentation describing the expected to behavior in regard to > the fully-qualified names of the publicly imported symbols in package.d? It might have been an oversight, but we'll have to wait for (I think Kenji) to reply since he implement