Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Martin Nowak
In essence, when @type is encountered the compiler looks at TypeInfo_Struct (in object.di) for the equivalent xfuncname. Then uses the attributes of that function pointer (and also the parameter types/count) to compile the given method. Why would you want to add explicit annotation for imp

Re: Tuple unpacking syntax [Was: Re: Multiple return values...]

2012-03-14 Thread Robert Jacques
On Wed, 14 Mar 2012 03:52:55 -0500, Manu wrote: I'm encouraged to see that every person in this thread so far seems to feel the same way as me regarding the syntax. On 14 March 2012 05:25, Derek Parnell wrote: On Wed, 14 Mar 2012 13:33:18 +1100, Kevin Cox wrote: (int i,,float f) = intBo

Re: Tuple unpacking syntax [Was: Re: Multiple return values...]

2012-03-14 Thread RivenTheMage
On Wednesday, 14 March 2012 at 02:33:29 UTC, Kevin Cox wrote: Kind of unrelated but I think that it is important to have a way to ignore values also. Leaving them bank would sufice. (int i,,float f) = intBoringFloat(); or (int i, null, float f) = intBoringFloat(); or (int i, void, float f

Re: Negative integer modulo/division

2012-03-14 Thread Stewart Gordon
On 14/03/2012 11:27, Steven Schveighoffer wrote: This might be more efficient (assuming z is your target for this): if((z = x % y) < 0) z += y; Depends on what you want it to do if y is negative. In such cases, what you've got here will return a value in (y, 0] if x is positive, or in (2*y

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 16:11, Steven Schveighoffer wrote: On Mon, 12 Mar 2012 22:06:51 -0400, Walter Bright wrote: On 3/12/2012 6:40 PM, H. S. Teoh wrote: And I'm not talking about doing just toHash, or just toString either. Any of these functions have complex interdependencies with each other, so it'

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Steven Schveighoffer
On Tue, 13 Mar 2012 19:23:25 -0400, Walter Bright wrote: On 3/13/2012 4:15 AM, Don Clugston wrote: On 13/03/12 03:05, Walter Bright wrote: On 3/12/2012 6:15 PM, Stewart Gordon wrote: And what about toString? Good question. What do you suggest? Why can't we just kill that abomination?

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Steven Schveighoffer
On Mon, 12 Mar 2012 22:06:51 -0400, Walter Bright wrote: On 3/12/2012 6:40 PM, H. S. Teoh wrote: And I'm not talking about doing just toHash, or just toString either. Any of these functions have complex interdependencies with each other, so it's either fix them ALL, or not at all. Yup. It

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Steven Schveighoffer
On Tue, 13 Mar 2012 12:03:22 -0400, Alex Rønne Petersen wrote: Yes, and in some cases, it doesn't even work right; i.e. you can declare certain opCmp and opEquals signatures that work fine for ==, >, <, etc but don't get emitted to the TypeInfo metadata, and vice versa. It's a mess. Se

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Martin Nowak
In general, for modules a and b, all of these should work: dmd a b dmd b a dmd -c a dmd -c b For '-c' CTFE will already run semantic3 on the other module's functions. But it would be very inefficient to do that for attributes.

Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-14 Thread Steven Schveighoffer
On Mon, 12 Mar 2012 20:50:38 -0400, Era Scarecrow wrote: Let's assume you make a site for power users, those who want to buy computer parts and books and related stuff like that. Now if you require JS to have it run, and all the power users refuse to use JS, you've just killed all your

Re: Negative integer modulo/division

2012-03-14 Thread Steven Schveighoffer
On Tue, 13 Mar 2012 15:13:01 -0400, bearophile wrote: For the modulus I sometimes use: ((x % y) + y) % y This might be more efficient (assuming z is your target for this): if((z = x % y) < 0) z += y; Though I don't know, maybe the optimizer will reduce to this. Hard to do it in a single

Re: Optimize away immediately-called delegate literals?

2012-03-14 Thread Steven Schveighoffer
On Mon, 12 Mar 2012 20:28:15 -0400, H. S. Teoh wrote: Hmph. I tried this code: import std.stdio; struct A { int[] data; int opApply(int delegate(ref int) dg) { foreach (d; data) { if (dg

Re: Turning a SIGSEGV into a regular function call under Linux, allowing throw

2012-03-14 Thread deadalnix
Le 13/03/2012 23:24, Vladimir Panteleev a écrit : On Tuesday, 13 March 2012 at 10:09:55 UTC, FeepingCreature wrote: However, there is a method to turn a signal handler into a regular function call that you can throw from. Very nice! The only similarity with a buffer overflow exploit is that w

Re: [draft] New std.regex walkthrough

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 0:54, H. S. Teoh wrote: On Tue, Mar 13, 2012 at 11:27:57PM +0400, Dmitry Olshansky wrote: For a couple of releases we have a new revamped std.regex, that as far as I'm concerned works nicely, thanks to my GSOC commitment last summer. Yet there was certain dark trend around std.rege

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 3:23, Walter Bright wrote: On 3/13/2012 4:15 AM, Don Clugston wrote: On 13/03/12 03:05, Walter Bright wrote: On 3/12/2012 6:15 PM, Stewart Gordon wrote: And what about toString? Good question. What do you suggest? Why can't we just kill that abomination? Break a lot of exis

Re: Replacing AA's in druntime

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 6:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of object_.d for ease of testing & development;

Re: [draft] New std.regex walkthrough

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 0:32, Brad Anderson wrote: On Tue, Mar 13, 2012 at 1:27 PM, Dmitry Olshansky mailto:dmitry.o...@gmail.com>> wrote: For a couple of releases we have a new revamped std.regex, that as far as I'm concerned works nicely, thanks to my GSOC commitment last summer. Yet there w

Re: Wanted: 128 bit integers

2012-03-14 Thread Manu
On 14 March 2012 02:37, Alex Rønne Petersen wrote: > On 14-03-2012 01:34, Paul D. Anderson wrote: > >> I'm working on a decimal arithmetic project and I need 128 bit integers >> in order to implement the decimal128 type. (The decimal value is stored >> in 128 bits; the coefficient field is 114 bi

Re: Has Tomasz's (h3r3tic's) OpenGL font rendering code been ported to D2?

2012-03-14 Thread Jacob Carlborg
On 2012-03-14 09:03, FeepingCreature wrote: On 03/12/12 10:42, Jacob Carlborg wrote: On 2012-03-11 23:36, Chad J wrote: I did some font rendering in C# using FreeType and OpenGL for a simple game. I can't remembering it being that hard. FreeType is not a C# library. FreeType is a C library. I

Re: Tuple unpacking syntax [Was: Re: Multiple return values...]

2012-03-14 Thread Manu
I'm encouraged to see that every person in this thread so far seems to feel the same way as me regarding the syntax. On 14 March 2012 05:25, Derek Parnell wrote: > On Wed, 14 Mar 2012 13:33:18 +1100, Kevin Cox > wrote: > >> (int i,,float f) = intBoringFloat(); >> > > For what its worth, the Eu

Re: toHash => pure, nothrow, const, @safe

2012-03-14 Thread Manu
On 13 March 2012 04:15, H. S. Teoh wrote: > On Mon, Mar 12, 2012 at 07:06:51PM -0700, Walter Bright wrote: > > On 3/12/2012 6:40 PM, H. S. Teoh wrote: > > >And I'm not talking about doing just toHash, or just toString either. > > >Any of these functions have complex interdependencies with each >

Re: Has Tomasz's (h3r3tic's) OpenGL font rendering code been ported to D2?

2012-03-14 Thread FeepingCreature
On 03/12/12 10:42, Jacob Carlborg wrote: > On 2012-03-11 23:36, Chad J wrote: > I did some font rendering in C# using FreeType and OpenGL for a simple game. > I can't remembering it being that hard. > FreeType is not a C# library. FreeType is a C library. If this was easy for you, it was due to

Re: Turning a SIGSEGV into a regular function call under Linux, allowing throw

2012-03-14 Thread FeepingCreature
On 03/13/12 23:24, Vladimir Panteleev wrote: > On Tuesday, 13 March 2012 at 10:09:55 UTC, FeepingCreature wrote: >> However, there is a method to turn a signal handler into a regular function >> call that you can throw from. > > Very nice! > > The only similarity with a buffer overflow exploit i

Re: Arbitrary abbreviations in phobos considered ridiculous

2012-03-14 Thread Jeff Nowakowski
On 03/13/2012 03:15 PM, Nick Sabalausky wrote: That's not even an accurate comparison anyway. Disabling CSS never does much to improve things, and usually it'll just make things *far* worse. I disable CSS frequently in Mozilla: View -> Page Style -> No Style. This fixes a lot of annoying styl

<    1   2