Re: [:] as empty associative array literal, plus warning for null

2013-07-03 Thread Diggory
I agree - the current state with both null and non-null empty arrays is confusing, and the separate syntax for empty arrays and associative arrays is nice and consistent. I would go as far as to say it should be impossible, or at least fairly difficult in safe code to distinguish (both

Re: Compiler could elide many more postblit constructor calls

2013-06-30 Thread Diggory
If this is indeed Diggory's point, it's not very pointy (sorry). The compiler should be able to safely omit the postblit on 's' when it passes it to foo (and the possible destructor of foo's argument inside foo when foo exits). If the postblit is omitted, and the function or code it calls

Re: AA value returned by ref function (comments needed)

2013-06-30 Thread Diggory
On Sunday, 30 June 2013 at 09:46:00 UTC, Maxim Fomin wrote: In the 9498 issue there is a discussion about such code: string[string] myValues; ref string getValue(string v) { return myValues[v]; } void main() { getValue(myValue) = myString; } Currently it throws range violation as

Re: Compiler could elide many more postblit constructor calls

2013-06-30 Thread Diggory
On Sunday, 30 June 2013 at 10:21:12 UTC, TommiT wrote: Perhaps an interesting observation about this is that while in C++ const correctness literally never improves performance [1], in D (if these optimizations were implemented) const correctness could potentially increase performance

Re: Compiler could elide many more postblit constructor calls

2013-06-29 Thread Diggory
On Saturday, 29 June 2013 at 17:57:33 UTC, TommiT wrote: On Saturday, 29 June 2013 at 13:47:36 UTC, TommiT wrote: [..] Example: struct S { int[] values; this(this) { values = values.dup; } } void foo(const S) { } void main() { const S s; foo(s); // No need to

Re: How would you solve this 'interview' question in D?

2013-06-26 Thread Diggory
On Wednesday, 26 June 2013 at 22:43:05 UTC, David wrote: Am 26.06.2013 22:51, schrieb Gary Willoughby: Just for a bit of fun, I saw this question posted on reddit the other day and wondered how *you* would solve this in D? http://stackoverflow.com/questions/731832/interview-question-ffn-n I

Re: Passing Appender by value

2013-06-22 Thread Diggory
On Saturday, 22 June 2013 at 13:48:53 UTC, Andrej Mitrovic wrote: On 6/22/13, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Appender!(int[]) buffer; call(buffer); writeln(buffer.data); // writes [], it's empty Apparently it's the same thing as the old AA problem. Essentially

Re: feature request: N-ary map

2013-06-21 Thread Diggory
On Friday, 21 June 2013 at 22:56:04 UTC, Andrei Alexandrescu wrote: On 6/21/13 3:55 PM, Andrei Alexandrescu wrote: On 6/21/13 3:45 PM, Timothee Cour wrote: I'd like to support N-ary map, ie std.algorithm.map that takes 1 or more ranges as arguments and operates lazily on those. Actually map

Re: randomShuffle

2013-06-21 Thread Diggory
On Thursday, 20 June 2013 at 21:48:49 UTC, Joseph Rushton Wakeling wrote: On 06/04/2013 01:03 PM, Diggory wrote: Still a few places to optimise, and I think the compiler optimisation should be able to give a decent speed up as well. Would be interested to see how it compares in your benchmark

Re: IFTI, value types, and top-level const

2013-06-09 Thread Diggory
On Sunday, 9 June 2013 at 12:19:13 UTC, Peter Alexander wrote: On Sunday, 9 June 2013 at 10:49:17 UTC, Jonathan M Davis wrote: On Sunday, June 09, 2013 12:33:39 Peter Alexander wrote: It looks like the core issue here is that it's simply not possible to create a mutable copy of a const object

Re: DConf 2013 Day 2 Talk 5: A Precise Garbage Collector for D by Rainer Schütze

2013-06-06 Thread Diggory
Interesting talk. It seems there are a few features D could provide which would make for some more powerful GCs: - Hook for when generating code which reads/writes a pointer allowing GC to put in read/write barriers where necessary. - Hook for union assignment so that the GC could emplace

Re: Is the -property compiler flag broken/bad idea?

2013-06-06 Thread Diggory
On Thursday, 6 June 2013 at 00:56:22 UTC, Adam D. Ruppe wrote: On Thursday, 6 June 2013 at 00:08:31 UTC, Jonathan M Davis wrote: Which is essentially the position of weak property enforcement. Yes, though I wish we would stop calling it 'enforcement' because nothing actually needs to be

Re: Is the -property compiler flag broken/bad idea?

2013-06-06 Thread Diggory
On Thursday, 6 June 2013 at 10:38:27 UTC, Martin Primer wrote: What would be good is: @property int foo { get() { _val = value; } set() { value = _val; } } usage: foo = 12; int bar = foo; my 2 cents. That's both much more limited and longer than the current

Re: std.compress

2013-06-05 Thread Diggory
On Wednesday, 5 June 2013 at 11:30:10 UTC, John Colvin wrote: On Wednesday, 5 June 2013 at 08:11:14 UTC, Walter Bright wrote: On 6/5/2013 12:38 AM, Jonathan M Davis wrote: Maybe some do, but many don't, and 1000 lines is _far_ from too much. If we start making modules that small, we're going

Re: std.compress

2013-06-05 Thread Diggory
On Wednesday, 5 June 2013 at 17:21:01 UTC, Jonathan M Davis wrote: On Wednesday, June 05, 2013 14:02:37 Jakob Ovrum wrote: We have a standard library in disagreement with the language's encapsulation mechanics. The module/package system in D is almost ignored in Phobos (and that's probably

Re: std.compress

2013-06-05 Thread Diggory
On Wednesday, 5 June 2013 at 17:36:05 UTC, Andrei Alexandrescu wrote: On 6/5/13 1:10 PM, Jonathan M Davis wrote: On Wednesday, June 05, 2013 07:49:22 H. S. Teoh wrote: (Actually, std.algorithm currently sits at 11636 lines. I call BS on whoever claims to be able to skim over std.algorithm and

Re: randomShuffle

2013-06-04 Thread Diggory
On Monday, 3 June 2013 at 21:24:50 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 08:28 PM, Diggory wrote: I'd guess that the heavy use of floating point arithmetic to calculate the step sizes means that algorithm has a fairly large constant overhead even though the complexity is smaller

Re: randomShuffle

2013-06-04 Thread Diggory
On Tuesday, 4 June 2013 at 08:30:58 UTC, Diggory wrote: On Monday, 3 June 2013 at 21:24:50 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 08:28 PM, Diggory wrote: I'd guess that the heavy use of floating point arithmetic to calculate the step sizes means that algorithm has a fairly large

Re: randomShuffle

2013-06-04 Thread Diggory
Here's the fixed one: uint[] randomSample(uint N, uint M) { uint[] result = new uint[N]; struct hashPair { uint key; uint index; } size_t tableSize = N*4; if (tableSize M) tableSize = M;

Re: DConf 2013 Day 2 Talk 4: Web Development in D by Vladimir Panteleev

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 12:14:48 UTC, Andrei Alexandrescu wrote: On reddit: http://www.reddit.com/r/programming/comments/1fkr5s/dconf_2013_day_2_talk_4_web_development_in_d_by/ On hackernews: https://news.ycombinator.com/item?id=5812723 On facebook:

Re: DConf 2013 Day 2 Talk 4: Web Development in D by Vladimir Panteleev

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 18:51:45 UTC, Vladimir Panteleev wrote: On Monday, 3 June 2013 at 18:07:57 UTC, Diggory wrote: Great talk! Would love to see the improvements to phobos suggested. An idea for the virtual address space problem on 32-bit: - Assuming each stack has a marker page

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: ... Thoughts? I think it is simpler to set a first enum member as invalid. However, I like an idea of

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 12:13:30 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 17:36:13 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 16:46:15 UTC, Diggory wrote: On Monday, 3 June 2013 at 12:13:30 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote

Re: std.compress

2013-06-03 Thread Diggory
On Tuesday, 4 June 2013 at 03:44:05 UTC, Walter Bright wrote: https://github.com/WalterBright/phobos/blob/std_compress/std/compress.d I wrote this to add components to compress and expand ranges. Highlights: 1. doesn't do any memory allocation 2. can handle arbitrarily large sets of data 3.

Re: randomShuffle

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 13:18:30 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 02:30 PM, Joseph Rushton Wakeling wrote: On 06/03/2013 01:29 PM, Diggory wrote: For small samples from very large ranges an efficient algorithm would be: int[] randomGen(int N, int M) { if (N == 0

Re: randomShuffle

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 17:35:22 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 07:00 PM, Diggory wrote: Thanks for testing before dismissing completely :P The way it returns results can be improved a lot by pre-allocating a range of the necessary size/using a range passed in. Surely

Re: A Small Contribution to Phobos

2013-06-02 Thread Diggory
On Sunday, 2 June 2013 at 18:43:44 UTC, monarch_dodra wrote: On Sunday, 2 June 2013 at 16:55:23 UTC, Andrei Alexandrescu wrote: On 6/2/13 11:41 AM, monarch_dodra wrote: On Sunday, 2 June 2013 at 13:07:18 UTC, Andrei Alexandrescu wrote: [1, 2, 3, 4].map!(n = n.writeln).reduce; Andrei One

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Diggory
On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: enum Machine { X86, X86_64, } So off you go and let the users (or yourself) use this in code: - void main() { Machine machine; ...

Re: Labels as values and threaded-code interpretation

2013-06-01 Thread Diggory
On Saturday, 1 June 2013 at 11:50:23 UTC, bearophile wrote: As example the very small but fast virtual machine written in GNU C++ from the International Contest on Functional Programming 2006: http://codepad.org/iibBeWKw It's faster than the same code without computed gotos. Bye, bearophile

Re: Are heap objects never moved by the garbage collector?

2013-06-01 Thread Diggory
On Saturday, 1 June 2013 at 08:11:05 UTC, sclytrack wrote: On Friday, 31 May 2013 at 16:31:39 UTC, Carl Sturtivant wrote: The D Programming Language (TDPL) p.178 asserts the following. The objects themselves stay put, that is their locations in memory never change after creation. I take

Idea for allocators

2013-05-31 Thread Diggory
So, I've been thinking about a few of the current problems with D: - No allocators on containers - Standard library functions doing too much GC allocation - Escaping pointers to memory not allocated using the GC - Implicit allocation with ~, ~= and array literals And I came up with something

Re: Are heap objects never moved by the garbage collector?

2013-05-31 Thread Diggory
On Friday, 31 May 2013 at 17:14:52 UTC, Jonathan M Davis wrote: On Friday, May 31, 2013 18:31:38 Carl Sturtivant wrote: The D Programming Language (TDPL) p.178 asserts the following. The objects themselves stay put, that is their locations in memory never change after creation. I take this

Re: dmd 2.063 released with 260 bugfixes and enhancements

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 17:28:49 UTC, Dmitry Olshansky wrote: 30-May-2013 21:16, Simen Kjaeraas пишет: On 2013-05-30, 17:16, Andrei Alexandrescu wrote: For the full story, mosey to the redesigned changelog: http://dlang.org/changelog.html Kudos to Andrej for this. *This* is how a great

Re: Inability to dup/~ for const arrays of class objects

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 05:54:57 UTC, Maxim Fomin wrote: On Thursday, 30 May 2013 at 05:44:43 UTC, Diggory wrote: On Thursday, 30 May 2013 at 05:41:06 UTC, Maxim Fomin wrote: On Wednesday, 29 May 2013 at 23:45:04 UTC, Ali Çehreli wrote: On 05/29/2013 03:59 PM, Peter Williams wrote: I've

Re: Inability to dup/~ for const arrays of class objects

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 07:15:39 UTC, Jonathan M Davis wrote: On Thursday, May 30, 2013 09:01:06 Maxim Fomin wrote: The article about slices on this site - http://dlang.org/d-array-article.html is perfectly correct. No, the article is incorrect in vocabulary because it contradicts to

Re: D on next-gen consoles and for game development

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 11:34:20 UTC, Dicebot wrote: On Thursday, 30 May 2013 at 11:31:53 UTC, Manu wrote: Which 'both' cases? OS support for fork+CoW vs no support, own implementation If you can modify the DMD compiler to output a special sequence of instructions whenever you assign

Re: A different tuple syntax

2013-05-30 Thread Diggory
Could also do something in the style of token strings, ie. t{ ... } It's lighter than tup and there's a precedent for it already in the language with q{ ... } which also means there should be no issues parsing it.

Re: The stately := operator feature proposal

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 15:05:40 UTC, monarch_dodra wrote: On Thursday, 30 May 2013 at 14:55:38 UTC, someone wrote: Please think about the huge math and science community. Most of them I came across like D for its speed and efficiency. But D can never replace Matlab/Octave/Ipython/Scipy

Re: A different tuple syntax

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 14:26:11 UTC, watcher wrote: On Thursday, 30 May 2013 at 14:06:15 UTC, Diggory wrote: Could also do something in the style of token strings, ie. t{ ... } It's lighter than tup and there's a precedent for it already in the language with q{ ... } which also means

Re: The stately := operator feature proposal

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 16:59:42 UTC, Timothee Cour wrote: In this: auto: x = 1; y = 2; f = a = a+1 writeln(f(x) + y); where do you delimit the end of the 'auto:' scope? At the end of the current scope - same rules as normal. You can use { ... } to create a new scope where

Re: A different tuple syntax

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 21:40:47 UTC, js.mdnq wrote: On Thursday, 30 May 2013 at 12:32:46 UTC, bearophile wrote: If you don't like to introduce a new keyword, then a different alternative is to use the @ again, a bit like UDAs: @{...} @[10] @{int, string} tup = @{1, hi}; // With UDA.

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 06:50:06 UTC, Timothee Cour wrote: ok, here it is: https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L78 simplified implementation and added missing escape symbols. Any symbol missing? I was basing myself based on

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Diggory
Your suggestion does not work; try for yourself by replacing the $$ by \$ in my code. Is that a bug in std.regex' doc? eg: replace(,regex(``),`\$`); = invalid format string in regex replace However everything works fine with $$, see my code above. Either the doc or the code should probably be

Re: double vs real

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 16:18:44 UTC, Shriramana Sharma wrote: Hello. I like that D exposes to me the real type to maximally utilize the machine's numerical precision. Since I am writing a program (currently in C++ but I am thinking of moving to D) that has to handle lots of fractional

Re: DConf 2013 Day 2 Talk 2: Shared Libraries in D by Martin Nowak

2013-05-29 Thread Diggory
With regard to the last point in the talk where Walter was suggesting not calling finalizers on objects whose code has been unloaded - would it not make more sense to simply call all the finalizers before unloading the library? If the finalizer is not called you will potentially get resource

Re: DConf 2013 Day 2 Talk 2: Shared Libraries in D by Martin Nowak

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 04:00:18 UTC, Steven Schveighoffer wrote: On Wed, 29 May 2013 22:12:54 -0400, Diggory digg...@googlemail.com wrote: With regard to the last point in the talk where Walter was suggesting not calling finalizers on objects whose code has been unloaded - would

Re: [article] Language Design Deal Breakers

2013-05-29 Thread Diggory
On Wednesday, 29 May 2013 at 05:35:14 UTC, Walter Bright wrote: On 5/28/2013 9:55 PM, Diggory wrote: As a last resort there should be a runtime check available such as assertNotNull(T) which does the conversion. The idea is to put the check on assignments to NotNull, not on usage of it. I

Re: I may have found a bug.

2013-05-29 Thread Diggory
On Wednesday, 29 May 2013 at 10:33:32 UTC, deadalnix wrote: On Wednesday, 29 May 2013 at 07:32:42 UTC, Jeremy DeHaan wrote: Thoughts? static variables are thread local. Are you sure the destructor run in the same thread as the constructor ? Either way remove should simply fail not give a

Re: [article] Language Design Deal Breakers

2013-05-29 Thread Diggory
On Wednesday, 29 May 2013 at 16:24:00 UTC, Timon Gehr wrote: On 05/29/2013 06:21 PM, Timon Gehr wrote: On 05/29/2013 07:35 AM, Walter Bright wrote: On 5/28/2013 9:55 PM, Diggory wrote: As a last resort there should be a runtime check available such as assertNotNull(T) which does

Re: The stately := operator feature proposal

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 00:20:00 UTC, MrzlganeE wrote: Hi, Please consider a request for just one piece of syntax sugar in D. In places where I write a bunch of short mathy code, I do not want to use 'auto'. The := operator would allow to declare a variable, deduce its type, and define

Re: The stately := operator feature proposal

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 01:35:58 UTC, MrzlganeE wrote: Diggory: That's very cool -- being able to do that in D. Thanks for showing me :) But it is not even a remotely practical solution. The idea is to write less, and so the solution you've given is to write more mixins all over

Re: The stately := operator feature proposal

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 02:51:47 UTC, Diggory wrote: On Thursday, 30 May 2013 at 01:35:58 UTC, MrzlganeE wrote: Diggory: That's very cool -- being able to do that in D. Thanks for showing me :) But it is not even a remotely practical solution. The idea is to write less, and so

Re: Inability to dup/~ for const arrays of class objects

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 05:41:06 UTC, Maxim Fomin wrote: On Wednesday, 29 May 2013 at 23:45:04 UTC, Ali Çehreli wrote: On 05/29/2013 03:59 PM, Peter Williams wrote: I've been trying to find out how non ref array arguments are passed to functions in D but can't find any documentation on

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread Diggory
On Wednesday, 29 May 2013 at 23:33:30 UTC, timotheecour wrote: something like this, which we should have in std.regex: string escapeRegex(string a){ import std.string; enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+': `\+`, '?': `\?`, '(': `\(`, ')': `\)`]; return

Re: Consume an entire range

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote: On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote: Is there a simple way to consume a range apart from std.array.array? I don't need to result of the range stored in an array, I just need a lazy map to evaluate

Re: Consume an entire range

2013-05-29 Thread Diggory
On Thursday, 30 May 2013 at 04:18:14 UTC, Jonathan M Davis wrote: On Thursday, May 30, 2013 06:12:51 Diggory wrote: On Thursday, 30 May 2013 at 03:53:06 UTC, Brad Anderson wrote: On Thursday, 30 May 2013 at 03:50:52 UTC, Brad Anderson wrote: Is there a simple way to consume a range apart

Re: Template args to UDA's

2013-05-28 Thread Diggory
On Tuesday, 28 May 2013 at 13:41:42 UTC, Manu wrote: So I've run into an expression I need to be able to implement std.simd properly for GDC/LDC. Doesn't work: @attribute(target, T) void func(string T)(...); In this case, currently, the UDA can't receive the template arg that was given to

Re: More on Component Programming

2013-05-28 Thread Diggory
On Tuesday, 28 May 2013 at 17:24:13 UTC, H. S. Teoh wrote: On Tue, May 28, 2013 at 11:37:06AM +0200, bearophile wrote: Timothee Cour: python uses itertools.product which is lexicographic_depth. Like you say, no-one can agrees what the order should be, so let's leave it up to user through a

Re: Why UTF-8/16 character encodings?

2013-05-28 Thread Diggory
On Tuesday, 28 May 2013 at 23:33:47 UTC, Peter Williams wrote: On 28/05/13 19:12, Jacob Carlborg wrote: On 2013-05-28 08:00, Manu wrote: Is there anywhere other than America that doesn't? Canada, Jamaica, other countries in that region? Last time I looked Canada was in America (which is

Re: Template args to UDA's

2013-05-28 Thread Diggory
Yes, that's Kenji's initial suggestion, which I can use for Ah, didn't see it because the forum keeps breaking threads up into little pieces...

Re: Inability to dup/~ for const arrays of class objects

2013-05-28 Thread Diggory
On Wednesday, 29 May 2013 at 01:33:57 UTC, Steven Schveighoffer wrote: On Tue, 28 May 2013 21:19:49 -0400, Ali Çehreli acehr...@yahoo.com wrote: // C is a class const(C) c = new const(C); // c promises that it won't mutate the object. // Why can't it promise to not mutate

Re: [article] Language Design Deal Breakers

2013-05-28 Thread Diggory
On Wednesday, 29 May 2013 at 04:15:52 UTC, Walter Bright wrote: On 5/28/2013 7:40 PM, Jesse Phillips wrote: On Monday, 27 May 2013 at 07:53:05 UTC, Walter Bright wrote: In D, right now (and especially with the beta) you can use the NotNull template. Where is this NotNull template? If it was

Re: Canonical/Idiomatic in memory files

2013-05-28 Thread Diggory
On Wednesday, 29 May 2013 at 04:48:07 UTC, Russel Winder wrote: On Tue, 2013-05-28 at 13:46 -0400, Jonathan M Davis wrote: […] Do you mean something like std.mmfile.MmFile which operates on a file as an array in memory using mmap, or do you mean operating on memory that has no connection to a

Re: iteration over a string

2013-05-28 Thread Diggory
Most algorithms for strings need the offset rather than the character index, so: foreach (i; dchar c; str) Gives the offset into the string for i If you really need the character index just count it: int charIndex = 0; foreach (dchar c; str) { // ... ++charIndex; } If strings were

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-27 Thread Diggory
On Monday, 27 May 2013 at 17:56:10 UTC, Brian Rogoff wrote: On Friday, 24 May 2013 at 19:44:19 UTC, Jonathan M Davis wrote: On Friday, May 24, 2013 20:30:54 Juan Manuel Cabo wrote: I'd like to know if there is interest in a precise garbage collector. There is interest in it, and Rainer

Re: Tuples

2013-05-27 Thread Diggory
On Monday, 27 May 2013 at 03:28:07 UTC, deadalnix wrote: On Monday, 27 May 2013 at 02:31:50 UTC, Jonathan M Davis wrote: On Monday, May 27, 2013 04:24:51 Diggory wrote: It also shouldn't break any code since the only addition to TypeTuple is a check to make sure that the undocumented

Discussion of TypeTuple naming

2013-05-27 Thread Diggory
I gather this has been discussed before and even a potential solution submitted (https://github.com/D-Programming-Language/phobos/pull/780) However it was dismissed due to too much existing code being broken. I'd like to suggest a slightly less severe change which should still fix the

Re: Discussion of TypeTuple naming

2013-05-27 Thread Diggory
On Monday, 27 May 2013 at 13:42:51 UTC, Timon Gehr wrote: It is not that similar, as it automatically expands into any context and hence does not allow a nested structure. The point being? It's true that there is some special behaviour, but that's the same regardless of whether it's called

Re: demangle doesn't work with __ModuleInfoZ __initZ __arrayZ

2013-05-27 Thread Diggory
On Monday, 27 May 2013 at 20:34:30 UTC, Peter Alexander wrote: On Monday, 27 May 2013 at 20:14:35 UTC, Andrei Alexandrescu wrote: At some point Walter and I were talking about generating an MD hash for very long names. That has some disadvantages (i.e. no easy reverse lookup) but it may work.

Re: Why UTF-8/16 character encodings?

2013-05-27 Thread Diggory
On Tuesday, 28 May 2013 at 00:11:18 UTC, Walter Bright wrote: On 5/27/2013 4:28 PM, Hans W. Uhlig wrote: On Monday, 27 May 2013 at 23:05:46 UTC, Walter Bright wrote: I've recently come to the opinion that that's a bad idea, and D should not support it. Why do you think its a bad idea? It

Re: Discussion of TypeTuple naming

2013-05-27 Thread Diggory
Using StaticTuple clearly and unambiguously refers to the alias to a ... template argument. Right now, that's TypeTuple. The fact that Type is in the name means nothing other than the fact that it was poorly named. I'm quite certain that a number of the template-heavy projects out there use

Re: Walter: htod on github?

2013-05-27 Thread Diggory
On Tuesday, 28 May 2013 at 02:32:24 UTC, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to

Re: Why UTF-8/16 character encodings?

2013-05-27 Thread Diggory
On Tuesday, 28 May 2013 at 04:52:55 UTC, Walter Bright wrote: On 5/27/2013 9:27 PM, Manu wrote: I will never write colour without a u, ever! I may suffer the global American cultural invasion of my country like the rest of us, but I will never let them infiltrate my mind! ;) Resistance is

Re: Immutability vs reference types

2013-05-27 Thread Diggory
On Tuesday, 28 May 2013 at 00:24:32 UTC, Francois Chabot wrote: Hello, I'm trying to get back into D again. This time around, I'm playing mostly with concurency and parallism, all the while trying to get my code writen in the D way as much as possible. I've run into a rather major road block

Re: Tuples

2013-05-26 Thread Diggory
On Sunday, 26 May 2013 at 15:48:00 UTC, Russel Winder wrote: I wonder if people coming to D, looking for information about tuples, will get confused by http://dlang.org/tuple.html which seems to tell people they have to roll their own, and http://dlang.org/phobos/std_typecons.html which tells

Re: [article] Language Design Deal Breakers

2013-05-26 Thread Diggory
Bugs occur when two parts of the program make slightly different assumptions about the interface between them. Semantically checking those assumptions will always help, but it will also always be limited. The idea that code will always branch on nullable types and handle both cases is wishful

Re: Tuples

2013-05-26 Thread Diggory
On Monday, 27 May 2013 at 01:36:58 UTC, Jonathan M Davis wrote: On Monday, May 27, 2013 11:21:08 Manu wrote: I have certainly been confused by the term 'tuple' used in D countless times. It seems to exist in a variety of different contexts, and every time I think I understood it, I realise

Re: Tuples

2013-05-26 Thread Diggory
On Monday, 27 May 2013 at 02:31:50 UTC, Jonathan M Davis wrote: On Monday, May 27, 2013 04:24:51 Diggory wrote: It also shouldn't break any code since the only addition to TypeTuple is a check to make sure that the undocumented behaviour of using it with non-types is disallowed

Re: lookup fields struct

2013-05-26 Thread Diggory
On Sunday, 26 May 2013 at 23:37:01 UTC, mimi wrote: Wow! thanks! offsetof will automatically distribute over the arguments so to get the offsets of a tuple you can just do: auto tmp = TP.offsetof; And tmp will be a tuple of the offsets.

Re: Why UTF-8/16 character encodings?

2013-05-25 Thread Diggory
I think you are a little confused about what unicode actually is... Unicode has nothing to do with code pages and nobody uses code pages any more except for compatibility with legacy applications (with good reason!). Unicode is: 1) A standardised numbering of a large number of characters 2) A

Re: Why UTF-8/16 character encodings?

2013-05-25 Thread Diggory
On Saturday, 25 May 2013 at 08:07:42 UTC, Joakim wrote: On Saturday, 25 May 2013 at 07:48:05 UTC, Diggory wrote: I think you are a little confused about what unicode actually is... Unicode has nothing to do with code pages and nobody uses code pages any more except for compatibility

Re: Why UTF-8/16 character encodings?

2013-05-25 Thread Diggory
limited success of UTF-8 Becoming the de-facto standard encoding EVERYWERE except for windows which uses UTF-16 is hardly a failure... I really don't understand your hatred for UTF-8 - it's simple to decode and encode, fast and space-efficient. Fixed width encodings are not inherently fast,

Re: Why UTF-8/16 character encodings?

2013-05-25 Thread Diggory
On Saturday, 25 May 2013 at 19:02:43 UTC, Joakim wrote: On Saturday, 25 May 2013 at 18:09:26 UTC, Diggory wrote: On Saturday, 25 May 2013 at 08:07:42 UTC, Joakim wrote: On Saturday, 25 May 2013 at 07:48:05 UTC, Diggory wrote: I think you are a little confused about what unicode actually

Re: Why UTF-8/16 character encodings?

2013-05-25 Thread Diggory
On Saturday, 25 May 2013 at 20:03:59 UTC, Joakim wrote: I have noted from the beginning that these large alphabets have to be encoded to two bytes, so it is not a true constant-width encoding if you are mixing one of those languages into a single-byte encoded string. But this variable length

Re: Mixin Templates Over-restricted?

2013-05-25 Thread Diggory
On Saturday, 25 May 2013 at 18:05:01 UTC, yaz wrote: Is there a reason for restricting mixin templates to only include declarations? For example, the following code doesn't work. (http://dpaste.dzfl.pl/1582a25e) Looking at the language specification (http://dlang.org/template-mixin.html) this

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-24 Thread Diggory
On Tuesday, 21 May 2013 at 20:08:16 UTC, Leandro Lucarella wrote: I'm interested in what you're describing, but I don't know how can you achieve this without fork()ing (or clone()ing in Linux). What does remap shared memory using COW in a context where fork() doesn't happen? Why do you even

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-24 Thread Diggory
On Friday, 24 May 2013 at 07:48:49 UTC, Vladimir Panteleev wrote: I don't know why you say that. The satellite process would be the same executable file as the main process, but started with a special switch (or environment variable), which will be handled by the D runtime. Since the two

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-24 Thread Diggory
On Friday, 24 May 2013 at 09:56:25 UTC, Diggory wrote: The only time I've been able to get it to not show a console window is when using WinMain... OK, nvm, it seems it's just that the SUBSYSTEM setting in VisualD has no effect, you have to set it through a .def file.

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-24 Thread Diggory
On Friday, 24 May 2013 at 10:20:12 UTC, Vladimir Panteleev wrote: Leandro wasn't using Windows ;) True but assuming windows isn't completely degenerate the overhead of a page fault is going to be pretty close to identical on the same cpu architecture. On Friday, 24 May 2013 at 11:15:21 UTC,

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-24 Thread Diggory
On 64-bit windows there is also the GetWriteWatch function which lets you access the dirty flag in the page table = no page faults = super efficient concurrent generational GC. Just a shame it doesn't exist on 32-bit systems for some reason.

Re: D on next-gen consoles and for game development

2013-05-24 Thread Diggory
On Saturday, 25 May 2013 at 02:41:00 UTC, Brad Anderson wrote: On Friday, 24 May 2013 at 19:44:23 UTC, Jonathan M Davis wrote: We already have stuff like format vs formattedWrite where one allocates and the other takes an output range. We should adopt that practice in general. Where possible,

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-23 Thread Diggory
On Thursday, 23 May 2013 at 12:39:04 UTC, Vladimir Panteleev wrote: On Tuesday, 21 May 2013 at 04:52:25 UTC, Diggory wrote: Either way, at least on windows the separate process would have to be persistent as creating a new process has a lot more overhead attached to it than on posix systems

Re: Ideal D GUI Toolkit

2013-05-23 Thread Diggory
On Thursday, 23 May 2013 at 07:19:46 UTC, Jacob Carlborg wrote: On 2013-05-23 08:27, Peter Williams wrote: An example of how I would envisage gettext being used in D is: writefln(gettext(%s: unknown variable at line %s), filename, linenumber); It is a common practice, to define a macro (or

Re: Ideal D GUI Toolkit

2013-05-23 Thread Diggory
On Thursday, 23 May 2013 at 08:31:46 UTC, Jacob Carlborg wrote: On 2013-05-23 10:29, Jacob Carlborg wrote: Say I have: gettext(%s: unknown variable at line %s) Then I want to change the text to: gettext(%s: not yet known variable at line %s) I have to find all places where this text is

Re: HibernateD and DDBC - ORM and DB abstraction layer for D

2013-05-22 Thread Diggory
On Tuesday, 21 May 2013 at 22:24:06 UTC, Nick Sabalausky wrote: On Mon, 06 May 2013 11:14:56 +0200 Kagamin s...@here.lot wrote: On Monday, 29 April 2013 at 09:38:10 UTC, David wrote: Null blows up your code, doesn't. There's no difference between null and empty string in D. That's not

Re: DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

2013-05-22 Thread Diggory
On Tuesday, 21 May 2013 at 20:08:16 UTC, Leandro Lucarella wrote: I'm interested in what you're describing, but I don't know how can you achieve this without fork()ing (or clone()ing in Linux). What does remap shared memory using COW in a context where fork() doesn't happen? Why do you even

Re: Ideal D GUI Toolkit

2013-05-22 Thread Diggory
On Tuesday, 21 May 2013 at 18:59:08 UTC, Jacob Carlborg wrote: I would expect that the system needs to be designed from the ground up with support for something like internationalization. There are probably other features were this is true as well. Of course, although I think

Re: Ideal D GUI Toolkit

2013-05-22 Thread Diggory
I've been looking at GtkD and it seems very complete and up to date in terms of exposing the Gtk+ API and wrapping it, but there's still a lot of Dification that could be done which would make it much closer to an ideal gui toolkit: - Compile time implementation of GtkBuilder - Instead of

Re: static analysis: how to test code reachability at compile time

2013-05-22 Thread Diggory
On Tuesday, 21 May 2013 at 21:15:58 UTC, Timothee Cour wrote: I'd like to have the following tools to help with static analysis code coverage: 1) test whether code is reachable or not. Of course it only works for executables and may have some caveats (eg: goto), but its still useful

  1   2   >