Re: A little project

2010-02-04 Thread torhu
superretard, is it?

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Michel Fortin
On 2010-02-04 18:16:55 -0500, Andrei Alexandrescu said: Rainer Deyke wrote: Don wrote: I suspect that string, wstring should have been the primary types and had a .codepoints property, which returned a ubyte[] resp. ushort[] reference to the data. It's too late, of course. The extra value yo

Re: Array operation for computing the dot product?

2010-02-04 Thread Stewart Gordon
Trass3r wrote: I wonder if an array operation could be reasonably included. It's a quite common case and there are direct SSE instructions for it since SSE 4.1. This would be achieved by adding array aggregate properties, an idea that has cropped up a few times, though I can't seem to find an

Re: It's interesting how many old bugzilla issues are still open though they're done

2010-02-04 Thread Stewart Gordon
Nick Sabalausky wrote: "Trass3r" wrote in message Some date back to dmd 0.164 and one even is for gdc! Shouldn't those be closed to keep the system clean? Just because there's a patch submitted doesn't mean it's been accepted and incorporated into DMD. That depends on whether by "closed

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Andrei Alexandrescu
Rainer Deyke wrote: Andrei Alexandrescu wrote: One idea I've had for a while was to have a universal string type: struct UString { union { char[] utf8; wchar[] utf16; dchar[] utf32; } enum Discriminator { utf8, utf16, utf32 }; Discriminator kind; Inte

Re: It's interesting how many old bugzilla issues are still open though they're done

2010-02-04 Thread Nick Sabalausky
"Trass3r" wrote in message news:op.u7molquq3nc...@hoenir.fem.tu-ilmenau.de... >I just searched for the keyword patch to see how many tickets are still >open with submitted patches: > http://d.puremagic.com/issues/buglist.cgi?keywords=patch&query_format=advanced&keywords_type=allwords&order=Last%

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Rainer Deyke
Andrei Alexandrescu wrote: > One idea I've had for a while was to have a universal string type: > > struct UString { > union { > char[] utf8; > wchar[] utf16; > dchar[] utf32; > } > enum Discriminator { utf8, utf16, utf32 }; > Discriminator kind; > Inter

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread grauzone
Andrei Alexandrescu wrote: Rainer Deyke wrote: Don wrote: I suspect that string, wstring should have been the primary types and had a .codepoints property, which returned a ubyte[] resp. ushort[] reference to the data. It's too late, of course. The extra value you get by having a specific type

Re: A thought for template alias parameters?

2010-02-04 Thread Trip Volpe
Joel Anderson Wrote: > > That's one of the reasons I've wished D had a nicer syntax for the > string mixin format. This one kinda scares people away :p What kind of syntax do you have in mind? Making mixins less obtrusive might ease aggravation when they're being used as boilerplate, but mak

Why does std.intrinsic contain nothrow?

2010-02-04 Thread Trass3r
Right at the beginning of the file there is: module std.intrinsic; nothrow: Nevertheless some functions are pure nothrow int bsf(uint v); some not: int btc(uint *p, uint bitnum); So either those nothrows are obsolete or the nothrow: is a mistake, right?

Re: A little project

2010-02-04 Thread Ellery Newcomer
I'll volunteer if no one else has On 02/03/2010 09:01 PM, Andrei Alexandrescu wrote: I'd like to propose a small project suggested by Walter. If anyone could take this up, it would be great. The project is a small utility program that could be a good complement to the likes of rdmd. The program

It's interesting how many old bugzilla issues are still open though they're done

2010-02-04 Thread Trass3r
I just searched for the keyword patch to see how many tickets are still open with submitted patches: http://d.puremagic.com/issues/buglist.cgi?keywords=patch&query_format=advanced&keywords_type=allwords&order=Last%20Changed&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED Some date back t

Re: OT: I'm back

2010-02-04 Thread BCS
Hello Joel, PPS: Riot is looking for some strong senior engineers (3years+ experienced) so if your looking for work you may check out www.riotgames.com. Well I'm in the market, but I rater suspect that I don't have enough experience (~3 year, but none in that domain). Oh, well. (OTOH if anyon

Re: Virtual methods

2010-02-04 Thread Walter Bright
dsimcha wrote: == Quote from Walter Bright (newshou...@digitalmars.com)'s article Believe it or not, you can do profile guided optimizations with the dmd profiler and optlink. The profiler will emit a file to be passed to the linker which will set the layout of functions to minimize paging. Is

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Andrei Alexandrescu
Rainer Deyke wrote: Don wrote: I suspect that string, wstring should have been the primary types and had a .codepoints property, which returned a ubyte[] resp. ushort[] reference to the data. It's too late, of course. The extra value you get by having a specific type for 'this is a code point fo

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Andrei Alexandrescu
Don wrote: Andrei Alexandrescu wrote: Michel Fortin wrote: On 2010-02-04 12:19:42 -0500, Andrei Alexandrescu said: bearophile wrote: Simen kjaeraas: Of the above, I feel (b) is the correct solution, and I understand it has already been implemented in svn. Yes, I presume he was mostly lo

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Justin Johansson
Andrei Alexandrescu wrote: Has any thought been given to foreach? Currently all these work for strings: foreach (c; "abc") { } // typeof(c) is 'char' foreach (char c; "abc") { } foreach (wchar c; "abc") { } foreach (dchar c; "abc") { } I'm concerned about the first case where t

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread dsimcha
== Quote from Jerry Quinn (jlqu...@optonline.net)'s article > Don Wrote: > > We seem to be approaching the point where char[], wchar[] and dchar[] > > are all arrays of dchar, but with different levels of compression. > > It makes me wonder if the char, wchar types actually make any sense. > > If c

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Rainer Deyke
Don wrote: > I suspect that string, wstring should have been the primary types and > had a .codepoints property, which returned a ubyte[] resp. ushort[] > reference to the data. It's too late, of course. The extra value you get > by having a specific type for 'this is a code point for a UTF8 string

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Jerry Quinn
Don Wrote: > We seem to be approaching the point where char[], wchar[] and dchar[] > are all arrays of dchar, but with different levels of compression. > It makes me wonder if the char, wchar types actually make any sense. > If char[] is actually a UTF string, then char[] ~ char should be > permi

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Daniel Keep
Ali Çehreli wrote: > ... > > The change sounds ok and hasLength should yield true. Or... can it > return an enum { no, kind_of, yes } ;) > > ... > > Ali I believe what you're after is this: enum Bool { True, False, FileNotFound }

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Don
Andrei Alexandrescu wrote: Michel Fortin wrote: On 2010-02-04 12:19:42 -0500, Andrei Alexandrescu said: bearophile wrote: Simen kjaeraas: Of the above, I feel (b) is the correct solution, and I understand it has already been implemented in svn. Yes, I presume he was mostly looking for a

Re: Virtual methods

2010-02-04 Thread BCS
Hello dsimcha, == Quote from Walter Bright (newshou...@digitalmars.com)'s article Believe it or not, you can do profile guided optimizations with the dmd profiler and optlink. The profiler will emit a file to be passed to the linker which will set the layout of functions to minimize paging.

Re: OT: I'm back

2010-02-04 Thread Denis Koroskin
On Thu, 04 Feb 2010 14:29:41 +0300, Bill Baxter wrote: I imagine a lot of people here don't remember me when I left a few years ago to focus on a free game called league of legends (www.leagueoflegends.com). Its been released however we're still working on making it even better. Just out

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread bearophile
Andrei Alexandrescu: > I am ready to throw away the implementation as soon as a better idea > comes around. As other times, I operated the change to see how things > feel with the new approach. And just to be sure: you are better than me because you actually implement things, while I am here ju

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Ali Çehreli
bearophile wrote: > Time ago you (Andrei) told me that you don't like a function like len() to have a different computational complexity, like O(n) or O(1), according to the input. This reminds me of an excellent talk by Matt Austern on STL's singly-linked lists. One of the interesting poin

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-02-04 12:19:42 -0500, Andrei Alexandrescu said: bearophile wrote: Simen kjaeraas: Of the above, I feel (b) is the correct solution, and I understand it has already been implemented in svn. Yes, I presume he was mostly looking for a justification of his ideas h

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Michel Fortin
On 2010-02-04 12:19:42 -0500, Andrei Alexandrescu said: bearophile wrote: Simen kjaeraas: Of the above, I feel (b) is the correct solution, and I understand it has already been implemented in svn. Yes, I presume he was mostly looking for a justification of his ideas he has already accepted

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Andrei Alexandrescu
bearophile wrote: Simen kjaeraas: Of the above, I feel (b) is the correct solution, and I understand it has already been implemented in svn. Yes, I presume he was mostly looking for a justification of his ideas he has already accepted and even partially implemented :-) I am ready to throw aw

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread bearophile
Simen kjaeraas: > Of the above, I feel (b) is the correct solution, and I understand it > has already been implemented in svn. Yes, I presume he was mostly looking for a justification of his ideas he has already accepted and even partially implemented :-) Bye, bearophile

Re: Virtual methods

2010-02-04 Thread bearophile
Trass3r: > What about C++ code? I think D classes are not compatible with C++ ones. And even if that becomes possible you can use the safest approach when a C++-compiled opaque module uses classes and doesn't have that required data structure that all D modules must have. Anyway, Walter has no

Re: Virtual methods

2010-02-04 Thread bearophile
dsimcha: > Is that still a relevant optimization? It probably made sense circa 1995 when > computers had much less memory, but now I would think that binaries are so > much > smaller than a typical computer's memory that they almost never get paged out. It's useful still, but just a little, ther

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Simen kjaeraas
Andrei Alexandrescu wrote: What can be done about that? I see a number of solutions: (a) Do not operate the change at all. (b) Operate the change and mention that in range algorithms you should check hasLength and only then use "length" under the assumption that it really means "elements

Re: Virtual methods

2010-02-04 Thread dsimcha
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > bearophile wrote: > > Partially unrelated note: LLVM plans to add a profile guided > > optimization level too, to be used with -O6, as GCC too does. LLVM > > also plans to do something that GCC is not currently able to do, the > >

Re: Virtual methods

2010-02-04 Thread Trass3r
Let's try again. I think there can be two types of opaque binary only modules: - Ones compiled from C code, or with a C interface. Such modules can't contain classes, so there is no problem with virtual functions. - Ones compiled from D code, or that use the D code interface, that can contain

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Jason House
Andrei Alexandrescu Wrote: > It's no secret that string et al. are not a magic recipe for writing > correct Unicode code. However, things are pretty good and could be > further improved by operating the following changes in std.array and > std.range: > > These changes effectively make UTF-8 an

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread bearophile
> The String structs can cache inside themselves the length and hash value the > first time such > values are computed (so each String is a struct 4 words long). So it's not really immutable. It contains an immutable dynamic array that can be called "str", plus two mutable words. To access the u

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread bearophile
I'd like D to give the right results and to be not bug-prone by default (even if it's a bit slower) and do something more optimized but maybe faster when I want it and I know what I am doing. So I like the idea of making strings more correct. I liked the idea of D strings acting like normal arr

Re: Array operation for computing the dot product?

2010-02-04 Thread retard
Wed, 03 Feb 2010 20:55:46 +0100, Don wrote: > Trass3r wrote: >> I wonder if an array operation could be reasonably included. It's a >> quite common case and there are direct SSE instructions for it since >> SSE 4.1. > > Indeed. The difficult question is, what would the syntax be? a · b

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Chad J
Michel Fortin wrote: > ... > > As for .length, I'll say that removing this property would make it hard > to write low-level code. For instance, if I copy a string into a buffer, > I need to know the length in bytes (array.length * sizeof(array[0])), > not the number of characters. So it doesn't ma

Re: Array operation for computing the dot product?

2010-02-04 Thread Trass3r
Before we solve the difficult problem of naming the thing could we first go through the trivial part of optimizing it under its current name. http://www.digitalmars.com/d/2.0/phobos/std_numeric.html#dotProduct it's not like it couldn't be done in parallel :)

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Simen kjaeraas
grauzone wrote: Change the type of string literals from char[] (or whatever the string type is in D2) to a wrapper struct defined in object.d: struct string { char[] raw; } Now string.length is invalid, and you don't have to do weird stuff as in (b) or (c). From here on, you coul

Re: OT: I'm back

2010-02-04 Thread Bill Baxter
> I imagine a lot of people here don't remember me when I left a few years ago > to focus on a free game called league of legends (www.leagueoflegends.com). >  Its been released however we're still working on making it even better. Just out of curiosity, what's the business model? Is there in-gam

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Trass3r
Am 04.02.2010, 04:05 Uhr, schrieb grauzone : Andrei Alexandrescu wrote: What can be done about that? I see a number of solutions: (a) Do not operate the change at all. (b) Operate the change and mention that in range algorithms you should check hasLength and only then use "length" under the

Re: Making all strings UTF ranges has some risk of WTF

2010-02-04 Thread Ben Hanson
Andrei Alexandrescu Wrote: > Walter Bright wrote: > > Andrei Alexandrescu wrote: > >> Oh, one more thing: doing mixed-width searches would require decoding. > > > > Or a conversion before the loop starts of the search term. > > That triggers memory allocation plus the same cost. It's not likely

Re: Virtual methods

2010-02-04 Thread Walter Bright
bearophile wrote: Partially unrelated note: LLVM plans to add a profile guided optimization level too, to be used with -O6, as GCC too does. LLVM also plans to do something that GCC is not currently able to do, the level -O7 lifelong optimization. This is like in Java, the profile guided optimiza

Re: Virtual methods

2010-02-04 Thread bearophile
Walter Bright: > Not impossible, and a "pseudo-link" could be done after the semantic > phase of compilation, but these things would be a lot of work to implement. OK. People can live with a compiler that doesn't perform all possible optimizations from its first version 1.0, but I think it's imp

Re: Array operation for computing the dot product?

2010-02-04 Thread bearophile
Chad J: > This reminds me of a discussion we had a year or more ago about offering > abstract operators purely for the purpose of overloading. We can use > things like (+), (*), (-), (&), and so on. It'd probably be fine to use > one for dot product. This looks acceptable as dot product: x (*) y