Re: Fiber Local Storage

2013-07-29 Thread deadalnix
On Monday, 29 July 2013 at 15:25:49 UTC, Martin Nowak wrote: On 07/26/2013 08:06 AM, deadalnix wrote: On Friday, 26 July 2013 at 04:30:18 UTC, Manu wrote: Is there an FLS implementation floating around? If not, it's probably something that should be considered for std.thread. I'd also love t

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Nick Sabalausky
On Mon, 29 Jul 2013 14:59:33 -0700 Walter Bright wrote: > Not aimed at anyone in particular, but I see these kinds of > statements all too often: > > "Sure, I believe in free speech, but you can't let that guy say those > things!" > > "I'm certainly not advocating censorship, but those books do

Re: Low-overhead components

2013-07-29 Thread Jonathan A Dunlap
Fixed, thanks. I wasn't sure if the post was ready for Reddit, as it's mainly some thoughts written down for advanced D users. Thanks for writing this. Aside from the primary purpose of the article, I was able to learn along the way more about D's mixins because of it. As a game architect, I

Re: Low-overhead components

2013-07-29 Thread Vladimir Panteleev
On Monday, 29 July 2013 at 20:08:19 UTC, Walter Bright wrote: On 7/27/2013 11:20 PM, Vladimir Panteleev wrote: Not really an article or anything - this was planned as just a post to this newsgroup, but I decided to put it somewhere suitable for larger blocks of text with formatting: http://bl

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Walter Bright
Not aimed at anyone in particular, but I see these kinds of statements all too often: "Sure, I believe in free speech, but you can't let that guy say those things!" "I'm certainly not advocating censorship, but those books don't belong in the public library!" That said, I pay the bills for t

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Jonathan A Dunlap
Blaming person X for that, famous or not, would be a ridiculous shifting of responsibilities == That said, it is also clear that in any organization, attitudes, tone and style flow from the top down. (It's amazing how pervasive this is.) Totally agree, I didn't mention blaming. Of course, ev

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Walter Bright
On 7/29/2013 1:31 PM, Nick Sabalausky wrote: Blaming person X for that, famous or not, would be a ridiculous shifting of responsibilities on par with blaming some music band, or blaming JD Salinger, etc. A person, famous or not, cannot rationally be held responsible for what the masses of idiots

Re: Variadic grouping

2013-07-29 Thread Artur Skawina
On 07/29/13 22:43, Artur Skawina wrote: > On 07/29/13 17:24, bearophile wrote: >> Maybe there is a way to allow that too: >> >> >> template Select(bool condition, T...) if (T.length == 2) { >> static if (condition) >> enum Select = T[0]; >> else >> enum Select = T[1]; >> } >

Re: Variadic grouping

2013-07-29 Thread Artur Skawina
On 07/29/13 17:24, bearophile wrote: > Maybe there is a way to allow that too: > > > template Select(bool condition, T...) if (T.length == 2) { > static if (condition) > enum Select = T[0]; > else > enum Select = T[1]; > } > > void main() { > enum x = Select!(true, 10

Re: Variadic grouping

2013-07-29 Thread Artur Skawina
On 07/29/13 17:03, bearophile wrote: > errors += global.endGagging(oldGaggedErrors); > > It's replaced with: > if (global.endGagging(oldGaggedErrors)) > errors = true; > > Looking at that code it's easy to think about code like this, that is not > currently supported: > > errors ||= global.

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Nick Sabalausky
On Mon, 29 Jul 2013 19:47:30 +0200 "Jonathan A Dunlap" wrote: > Simply I believe the people > who have the most respect or fame in the industry need to be the > most careful about their expression. I agree with that, but only because being well-known leads to a much higher change of being quot

Re: Low-overhead components

2013-07-29 Thread Walter Bright
On 7/27/2013 11:20 PM, Vladimir Panteleev wrote: Not really an article or anything - this was planned as just a post to this newsgroup, but I decided to put it somewhere suitable for larger blocks of text with formatting: http://blog.thecybershadow.net/2013/07/28/low-overhead-components/ Pleas

Re: Low-overhead components

2013-07-29 Thread Andrei Alexandrescu
On 7/27/13 11:20 PM, Vladimir Panteleev wrote: Not really an article or anything - this was planned as just a post to this newsgroup, but I decided to put it somewhere suitable for larger blocks of text with formatting: http://blog.thecybershadow.net/2013/07/28/low-overhead-components/ Vote up

Re: Doc improvements, compilation

2013-07-29 Thread Brad Anderson
On Monday, 29 July 2013 at 19:03:25 UTC, Luís Marques wrote: On Monday, 29 July 2013 at 18:59:01 UTC, Brad Anderson wrote: A recent pull makes the jump to list generate before the page is shown so we won't get it suddenly appearing anymore. It's not the jump to list that's slow, it's hyphenate

Re: Doc improvements, compilation

2013-07-29 Thread Brad Anderson
On Monday, 29 July 2013 at 19:06:12 UTC, Brad Anderson wrote: On Monday, 29 July 2013 at 19:03:25 UTC, Luís Marques wrote: On Monday, 29 July 2013 at 18:59:01 UTC, Brad Anderson wrote: A recent pull makes the jump to list generate before the page is shown so we won't get it suddenly appearing a

Re: Doc improvements, compilation

2013-07-29 Thread Luís.Marques
On Monday, 29 July 2013 at 18:59:01 UTC, Brad Anderson wrote: A recent pull makes the jump to list generate before the page is shown so we won't get it suddenly appearing anymore. It's not the jump to list that's slow, it's hyphenate.js that is the bottleneck. The jump list generation would h

Re: Doc improvements, compilation

2013-07-29 Thread Brad Anderson
On Monday, 29 July 2013 at 18:51:28 UTC, Luís Marques wrote: In the docs for std.format we have the following example: import std.c.stdio; import std.format; void main() { auto writer = appender!string(); formattedWrite(writer, "%s is the ultimate %s.", 42, "ans

Doc improvements, compilation

2013-07-29 Thread Luís.Marques
In the docs for std.format we have the following example: import std.c.stdio; import std.format; void main() { auto writer = appender!string(); formattedWrite(writer, "%s is the ultimate %s.", 42, "answer"); assert(writer.data == "42 is the ultimate answ

Re: Fiber Local Storage

2013-07-29 Thread Luís.Marques
On Friday, 26 July 2013 at 04:30:18 UTC, Manu wrote: Is there an FLS implementation floating around? If not, it's probably something that should be considered for std.thread. Nice to see this asked. For a simulation library I was developing I was thinking that fiber support had to be done by

Re: Variadic grouping

2013-07-29 Thread Meta
On Monday, 29 July 2013 at 17:52:41 UTC, Meta wrote: In your notation, it seems like there could be issues. What if T2 is a local variable, then is that an assignment? If there is no possible issues then I wouldn't mind having such a syntax... anything is better than nothing. I don't think it

Re: Variadic grouping

2013-07-29 Thread Meta
On Monday, 29 July 2013 at 17:35:09 UTC, JS wrote: I don't think that is very robust notation but if it is then it would work. Using ';' makes it obvious the next group is starting. I think using f(..., name = ...) is pretty obvious, and possibly easier to spot in a list of commas than `;`.

Re: Flame bait: D vs. Rust vs. Go Benchmarking

2013-07-29 Thread Jonathan A Dunlap
That could give the impression that Linus frequently /uses obscenity/ as a /method/, which would be very, very misleading. Zed Shaw also falls into this category. He is usually polite and civil during debates. However like Linus, he does sometimes throw around obscenity to express a particula

Re: Variadic grouping

2013-07-29 Thread JS
On Monday, 29 July 2013 at 17:28:57 UTC, Meta wrote: On Monday, 29 July 2013 at 17:22:50 UTC, JS wrote: I'm not sure how named parameters would solve the original problem Your original use case: template t(T1..., T2...) ... t!(a, b, c; d, e, f); Becomes //Some weird hypothetical syntax te

Re: Fiber Local Storage

2013-07-29 Thread Sean Kelly
On Jul 25, 2013, at 9:29 PM, Manu wrote: > Is there an FLS implementation floating around? > If not, it's probably something that should be considered for std.thread. Nope. I'd love to have this, but it's pretty tricky once you include the need for dynamic library support and my time is quite

Re: Variadic grouping

2013-07-29 Thread Meta
On Monday, 29 July 2013 at 17:22:50 UTC, JS wrote: I'm not sure how named parameters would solve the original problem Your original use case: template t(T1..., T2...) ... t!(a, b, c; d, e, f); Becomes //Some weird hypothetical syntax template t(@name("T1") T1..., @name("T2") T2...) { .

Re: Variadic grouping

2013-07-29 Thread JS
On Monday, 29 July 2013 at 16:52:17 UTC, Meta wrote: On Monday, 29 July 2013 at 16:02:02 UTC, monarch_dodra wrote: Except for this... alias K = Select!(true, 4, int); ;) Useful? I don't think so... but I thought I'd point it out ^^ I think it's a feature that this doesn't work. As for variad

Re: Variadic grouping

2013-07-29 Thread Meta
On Monday, 29 July 2013 at 16:02:02 UTC, monarch_dodra wrote: Except for this... alias K = Select!(true, 4, int); ;) Useful? I don't think so... but I thought I'd point it out ^^ I think it's a feature that this doesn't work. As for variadic grouping, named parameters could easily solve this

Re: Variadic grouping

2013-07-29 Thread monarch_dodra
On Monday, 29 July 2013 at 16:00:47 UTC, monarch_dodra wrote: Wait never mind my above post. Your approach works. Except for this... alias K = Select!(true, 4, int); ;) Useful? I don't think so... but I thought I'd point it out ^^

Re: Variadic grouping

2013-07-29 Thread monarch_dodra
On Monday, 29 July 2013 at 15:57:36 UTC, monarch_dodra wrote: On Monday, 29 July 2013 at 15:31:39 UTC, bearophile wrote: How do you tell apart values from not values? :-) Is this brutal enough? :-) enum SameKind(T...) = __traits(compiles, {enum x = T[0], y = T[1]; }) || __traits(compil

Re: Variadic grouping

2013-07-29 Thread monarch_dodra
On Monday, 29 July 2013 at 15:31:39 UTC, bearophile wrote: How do you tell apart values from not values? :-) Is this brutal enough? :-) enum SameKind(T...) = __traits(compiles, {enum x = T[0], y = T[1]; }) || __traits(compiles, {alias x = T[0]; alias y = T[1]; }); template Select(boo

Re: Variadic grouping

2013-07-29 Thread bearophile
template Select(bool condition, T...) if (T.length == 2 && SameKind!T) { static if (__traits(compiles, {enum x = T[0];})) { static if (condition) enum Select = T[0]; else enum Select = T[1]; } else { static if (condition) alias Se

Re: Variadic grouping

2013-07-29 Thread bearophile
How do you tell apart values from not values? :-) Is this brutal enough? :-) enum SameKind(T...) = __traits(compiles, {enum x = T[0], y = T[1]; }) || __traits(compiles, {alias x = T[0]; alias y = T[1]; }); template Select(bool condition, T...) if (T.length == 2 && SameKind!T) { st

Re: Fiber Local Storage

2013-07-29 Thread Martin Nowak
On 07/26/2013 08:06 AM, deadalnix wrote: On Friday, 26 July 2013 at 04:30:18 UTC, Manu wrote: Is there an FLS implementation floating around? If not, it's probably something that should be considered for std.thread. I'd also love to have one ! (in fact I do think it should be the default). W

Re: Variadic grouping

2013-07-29 Thread bearophile
monarch_dodra: Select!(cond, 1, 2);// This doesn't compile Time ago I asked for an improvement of Select: https://github.com/D-Programming-Language/phobos/pull/1235 Maybe there is a way to allow that too: template Select(bool condition, T...) if (T.length == 2) { static if (condition)

Re: Variadic grouping

2013-07-29 Thread bearophile
John Colvin: There are a mind-boggling large number of things that are useful, but that's not the criteria for adding something to a programming language. A new feature has to be *sufficiently* useful to justify the increased complexity of the language and it's implementations (plus not cla

Re: Variadic grouping

2013-07-29 Thread Robert Clipsham
On Monday, 29 July 2013 at 14:46:02 UTC, Robert Clipsham wrote: You can achieve this like so: template Outer(T...) { template Inner(U...) { // Do something with T and U } } Outer!(a, b, c).Inner!(d, e, f); You can see an example of it in action here (type tuple interse

Re: Are there any crypto libraries floating around?

2013-07-29 Thread Tyler Jameson Little
https://github.com/Etherous/dcrypt Hmm, last commit 3 years ago? It'll probably take quite a bit of work to bring it up to Phobos quality (and probably to get it to even compile). It does look pretty complete though...

Re: Variadic grouping

2013-07-29 Thread monarch_dodra
On Monday, 29 July 2013 at 14:34:13 UTC, John Colvin wrote: On Monday, 29 July 2013 at 14:21:45 UTC, JS wrote: Then a third? The fact whether there is a use case or not, or whether I have one or not should be irrelevant. The issue should stand on it's own. Having some easily way to use multipl

Re: Variadic grouping

2013-07-29 Thread Robert Clipsham
On Monday, 29 July 2013 at 13:23:23 UTC, JS wrote: Sometimes it's nice to be able to have groups of variadic parameters: template t(T1..., T2...) ... t!(a, b, c; d, e, f); so that a,b,c are for T1 and d,e,f are for T2. This can be done by making a symbol and breaking up a single variadic b

Re: Variadic grouping

2013-07-29 Thread John Colvin
On Monday, 29 July 2013 at 14:21:45 UTC, JS wrote: Then a third? The fact whether there is a use case or not, or whether I have one or not should be irrelevant. The issue should stand on it's own. Having some easily way to use multiple variadic parameters is either useful or not. There are a

Re: Variadic grouping

2013-07-29 Thread JS
On Monday, 29 July 2013 at 13:59:54 UTC, bearophile wrote: JS: The usefulness should be obvious and I seriously doubt if someone thinks it is not then any example I could give would convince them otherwise. It's not obvious for me :-) Explaining the "obvious" is sometimes necessary. It

Re: Variadic grouping

2013-07-29 Thread bearophile
A possible static ternary operator syntax: enum foo = ct_cond !? Foo!5 : Bar!6; But in my opinion the need for it is not strong enough, better to keep the language simpler. A static ternary operator is sometimes handy, this is working code: import std.typetuple: TypeTuple; template Iota(i

Re: Variadic grouping

2013-07-29 Thread bearophile
JS: The usefulness should be obvious and I seriously doubt if someone thinks it is not then any example I could give would convince them otherwise. It's not obvious for me :-) Explaining the "obvious" is sometimes necessary. It came up for me trying to write a ternary if to use. struct

Re: Variadic grouping

2013-07-29 Thread JS
On Monday, 29 July 2013 at 13:30:58 UTC, bearophile wrote: JS: I doubt such a feature will ever get added but who knows... It seems a cute idea, but why don't you show two or more very different use cases? (Asking for a feature without showing use cases is not so good.) Bye, bearophile

Re: Variadic grouping

2013-07-29 Thread bearophile
JS: I doubt such a feature will ever get added but who knows... It seems a cute idea, but why don't you show two or more very different use cases? (Asking for a feature without showing use cases is not so good.) Bye, bearophile

Variadic grouping

2013-07-29 Thread JS
Sometimes it's nice to be able to have groups of variadic parameters: template t(T1..., T2...) ... t!(a, b, c; d, e, f); so that a,b,c are for T1 and d,e,f are for T2. This can be done by making a symbol and breaking up a single variadic but is messy. I doubt such a feature will ever get

Re: Current debugger options

2013-07-29 Thread Gary Willoughby
On Monday, 29 July 2013 at 10:48:13 UTC, Luís Marques wrote: Hi there! Is there a debugger you would recommend that understands D (demangling, etc) which runs under OS X? (or otherwise...) What are you using? A patched gdb? a normal gdb? Any llvm version? (sometimes it seems not to recognize

Re: Low-overhead components

2013-07-29 Thread Luís.Marques
On Sunday, 28 July 2013 at 06:20:29 UTC, Vladimir Panteleev wrote: Not really an article or anything - this was planned as just a post to this newsgroup, but I decided to put it somewhere suitable for larger blocks of text with formatting: http://blog.thecybershadow.net/2013/07/28/low-overhead

Re: Current debugger options

2013-07-29 Thread John Colvin
On Monday, 29 July 2013 at 11:00:27 UTC, David wrote: Am 29.07.2013 12:48, schrieb "Luís Marques" ": Hi there! Is there a debugger you would recommend that understands D (demangling, etc) which runs under OS X? (or otherwise...) What are you using? A patched gdb? a normal gdb? Any llvm vers

Re: Current debugger options

2013-07-29 Thread David
Am 29.07.2013 12:48, schrieb "Luís Marques" ": > Hi there! > > Is there a debugger you would recommend that understands D (demangling, > etc) which runs under OS X? (or otherwise...) > > What are you using? A patched gdb? a normal gdb? Any llvm version? > (sometimes it seems not to recognize stac

Request: Auto string mixin templates

2013-07-29 Thread JS
I have a template t that returns a string that is always to be used as a mixin. It is quite annoying to have to use mixin() on the template. e.g., mixin(t!()); It would be nice to be able to specify that the template is mixed in at the call site. e.g., string mixin template t() { ... }

Current debugger options

2013-07-29 Thread Luís.Marques
Hi there! Is there a debugger you would recommend that understands D (demangling, etc) which runs under OS X? (or otherwise...) What are you using? A patched gdb? a normal gdb? Any llvm version? (sometimes it seems not to recognize stack frames in my D code) Or just writeln? Thanks!

Re: Are there any crypto libraries floating around?

2013-07-29 Thread John Colvin
On Monday, 29 July 2013 at 08:26:03 UTC, Dejan Lekic wrote: On Saturday, 27 July 2013 at 15:58:04 UTC, Tyler Jameson Little wrote: I found this thread mentioning some initial work on a crypto library: http://forum.dlang.org/thread/j84us9$2m5k$1...@digitalmars.com?page=1 It looks like "std.dig

Re: Are there any crypto libraries floating around?

2013-07-29 Thread Dejan Lekic
On Saturday, 27 July 2013 at 15:58:04 UTC, Tyler Jameson Little wrote: I found this thread mentioning some initial work on a crypto library: http://forum.dlang.org/thread/j84us9$2m5k$1...@digitalmars.com?page=1 It looks like "std.digest" is what came of that though, not "std.crypto". I foun