Re: fast string searching

2010-12-12 Thread bearophile
Andrei Alexandrescu: > This looks promising. We could adopt it for Phobos. Oh, sorry, you have posted it already :-) Bye, bearophile

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Jonathan M Davis
On Sunday 12 December 2010 23:20:36 bearophile wrote: > I was away for few days and then partially busy for several more days, I am > sorry and I will try to get up to date. > > Gary Whatmore: > > Guys, I made several sockpuppet reddit accounts to mod down the two guys > > criticising this thread.

Fast string search

2010-12-12 Thread bearophile
Found through Reddit, it may be useful for Phobos: http://volnitsky.com/project/str_search/ A possible partial D2 translation: const(char)* volnitsky(string haystack, string needle) { enum size_t wSize = ushort.sizeof; enum size_t hSize = 64 * 1024; immutable char* S = haystack.ptr;

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread bearophile
I was away for few days and then partially busy for several more days, I am sorry and I will try to get up to date. Gary Whatmore: > Guys, I made several sockpuppet reddit accounts to mod down the two guys > criticising this thread.< That's worse than desiring to add some examples of D code to

Re: fast string searching

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 11:01 PM, Robert Jacques wrote: On Sun, 12 Dec 2010 23:11:03 -0500, Andrei Alexandrescu wrote: This looks promising. We could adopt it for Phobos. http://www.reddit.com/r/programming/comments/ekfct/efficient_substring_search_not_a_boyermoore/ The code has no license though...

Re: fast string searching

2010-12-12 Thread Robert Jacques
On Sun, 12 Dec 2010 23:11:03 -0500, Andrei Alexandrescu wrote: This looks promising. We could adopt it for Phobos. http://www.reddit.com/r/programming/comments/ekfct/efficient_substring_search_not_a_boyermoore/ The code has no license though... Andrei Have you e-mailed the author? Leoni

Re: Problems with dmd inlining

2010-12-12 Thread Jason House
Andrei Alexandrescu Wrote: > On 12/12/10 5:06 PM, Simen kjaeraas wrote: > > If no-one else has stepped up, I'm willing to have a look. > > That would be a great help to the community. I did look at that code and > nothing jumped at me. But then I didn't have enough time to profile it > properly

Re: Inlining Code Test

2010-12-12 Thread Andrej Mitrovic
Ye that's better: Sorting with Array.opIndex: 2859 Sorting with pointers: 1765 38.2651 percent faster And it only took 2 seconds. With profile it takes a full minute. On 12/13/10, Craig Black wrote: > Try it without -profile. That tends to slow everything down to a halt. > > -Craig > > "Andrej

Re: Problems with dmd inlining

2010-12-12 Thread Jason House
Simen kjaeraas Wrote: > Jason House wrote: > > > I wish I had your problems. I ported a sizable set of C++ code to D2 and > > discovered D2 with dmd was 50x slower than C++ with gcc! I've been to > > busy/disappointed to track down the bug(s) causing such a slowdown. If > > anyone is suffi

Re: Inlining Code Test

2010-12-12 Thread Craig Black
Try it without -profile. That tends to slow everything down to a halt. -Craig "Andrej Mitrovic" wrote in message news:mailman.948.1292198993.21107.digitalmar...@puremagic.com... My crappy old Pentium 4 has gone totally mad: Sorting with Array.opIndex: 45080 Sorting with pointers: 45608 4.09

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 9:50 PM, Hemanth Kapila wrote: Hi, Thanks for sharing the doc. I changed one of the "cool things" from threading to operator overloading. May I know the reason behind the change? Is it that you intend to pick different "3 cool things" at different talks? or do you think ope

fast string searching

2010-12-12 Thread Andrei Alexandrescu
This looks promising. We could adopt it for Phobos. http://www.reddit.com/r/programming/comments/ekfct/efficient_substring_search_not_a_boyermoore/ The code has no license though... Andrei

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Hemanth Kapila
Hi, Thanks for sharing the doc. > I changed one of the "cool things" from threading to operator overloading. May I know the reason behind the change? Is it that you intend to pick different "3 cool things" at different talks? or do you think operator overloading is 'cooler' than concurrency?

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 8:56 PM, Gary Whatmore wrote: Simen kjaeraas Wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Compared to the talk at Google, I changed one of the "cool things" from threading to operator overloading. Didn't manage to talk about that - there were a million questions - alth

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
Ary Borenszweig wrote: > D should provide a yield keyword that basically > rewrites the body of the method into the first code. Don't need to change the language for that. = string yield(string what) { return `if(auto result = dg(`~what~`)) return result;`; } class Foo { uint arra

Re: Inlining Code Test

2010-12-12 Thread Craig Black
If the problem is not inlining, then why does the same code in C++ does not suffer from this performance limitation (when compiled with Visual C++ 2008)? #include #include #include template T min(T a, T b) { return a < b ? a : b; } template T max(T a, T b) { return a > b ? a : b; } inlin

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Gary Whatmore
Simen kjaeraas Wrote: > Walter Bright wrote: > > > Andrei Alexandrescu wrote: > >> Compared to the talk at Google, I changed one of the "cool things" from > >> threading to operator overloading. Didn't manage to talk about that - > >> there were a million questions - although I think it's a

Re: Why Ruby?

2010-12-12 Thread Ary Borenszweig
On 12/12/2010 02:03 PM, Adam D. Ruppe wrote: foobar wrote: D basically re-writes foreach with opApply into the ruby version which is why Ruby is *BETTER* You missed the point: there is no "Ruby version". They are the same thing. foreach to me is a redundant obfuscation How can it be redund

Re: Problems with dmd inlining

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 5:06 PM, Simen kjaeraas wrote: Jason House wrote: Craig Black Wrote: > One more thing - to clarify, Craig, are you implying that it's acceptable > for performance to be within 20%? If not, there are tweaks on the > algorithmic side we can do to improve sorting. 20% slower would

Re: SWIG 4 D2 How To : namespace, friend, operator()

2010-12-12 Thread Jimmy Cao
On Sun, Dec 12, 2010 at 2:13 PM, BLS wrote: > > Last question is about : operator() > > f.i.bool operator()(HWND const a, const HWND b) const > > Klickverbot suggests to use the SWIG's %rename. But how that would look > like in practice ? > > Beside, I guess this is what opImplicitCast shoul

Re: Inlining Code Test

2010-12-12 Thread Andrej Mitrovic
My crappy old Pentium 4 has gone totally mad: Sorting with Array.opIndex: 45080 Sorting with pointers: 45608 4.092e+16 percent faster (??) Compiled with dmd -profile -O -release -inline -noboundscheck On 12/13/10, Iain Buclaw wrote: > == Quote from Craig Black (craigbla...@cox.net)'s article >>

Re: Inlining Code Test

2010-12-12 Thread Iain Buclaw
== Quote from Craig Black (craigbla...@cox.net)'s article > The following program illustrates the problems with inlining in the dmd > compiler. Perhaps with some more work I can reduce it to a smaller test > case. I was playing around with a simple Array template, and noticed that > similar C++ c

Re: Problems with dmd inlining

2010-12-12 Thread Simen kjaeraas
Jason House wrote: Craig Black Wrote: > One more thing - to clarify, Craig, are you implying that it's acceptable > for performance to be within 20%? If not, there are tweaks on the > algorithmic side we can do to improve sorting. 20% slower would be acceptable if I didn't have to do my ow

Re: Problems with dmd inlining

2010-12-12 Thread Walter Bright
Jason House wrote: Walter Bright Wrote: Jason House wrote: I wish I had your problems. I ported a sizable set of C++ code to D2 and discovered D2 with dmd was 50x slower than C++ with gcc! I've been to busy/disappointed to track down the bug(s) causing such a slowdown. If anyone is sufficien

Inlining Code Test

2010-12-12 Thread Craig Black
The following program illustrates the problems with inlining in the dmd compiler. Perhaps with some more work I can reduce it to a smaller test case. I was playing around with a simple Array template, and noticed that similar C++ code performs much better. This is due, at least in part, to o

Re: Why Ruby?

2010-12-12 Thread foobar
Andrei Alexandrescu Wrote: [snip] > Control flow inside the delegate can be addressed through a slightly > more complicated lowering (the kind foreach already does). Probably > break and continue should not be accepted because generally you can't > expect all user-defined constructs to do iter

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
Andrei Alexandrescu wrote: And one consequence of that is that contrary to what has been said, this would *not* allow foreach to be implemented as a library function. I can appreciate the difficulty of getting the delegate's flow control to be handled as expected, but I think going ahead wi

Re: Verbose checking of range category

2010-12-12 Thread Gerrit Wichert
Hello, maybe the template resolver can provide some kind of buffer where the constrains can emit their messages to. If finally a match is found the buffer can be discarded. If not the messages can be printed. So we only get messages for failed template instantiations. Am 11.12.2010 1

Re: Why Ruby?

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 2:50 PM, Nick Sabalausky wrote: "Andrei Alexandrescu" wrote in message news:ie341e$br...@digitalmars.com... On 12/12/10 6:44 AM, Jacob Carlborg wrote: [snip] Conclusion: D needs a better and nicer looking syntax for passing delegates to functions. Suggestion: If a function takes

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:ie341e$br...@digitalmars.com... > On 12/12/10 6:44 AM, Jacob Carlborg wrote: > [snip] >> Conclusion: >> >> D needs a better and nicer looking syntax for passing delegates to >> functions. >> >> Suggestion: >> >> If a function takes a delegate as its las

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Simen kjaeraas" wrote in message news:op.vnl77cjyvxi...@biotronic-pc.lan... > Nick Sabalausky wrote: > >>> void myfun(void delegate(string) lol) { >>>lol("say it "); >>> } >>> >>> void main() { >>>myfun = (string what) { >>>assert(0, what ~ " lol"); >>>};

Re: Why Ruby?

2010-12-12 Thread spir
On Sun, 12 Dec 2010 12:23:03 -0600 Andrei Alexandrescu wrote: > Going now > back to D, we can imagine the following lowering: > > fun (a, b ; c) stmt > > => > > fun(c, (a, b) { stmt }) It seems to me that lowering is analog to redefine "shallow" syntax (in fact, syntactic sugar) into a de

SWIG 4 D2 How To : namespace, friend, operator()

2010-12-12 Thread BLS
Hi, this is my first attempt to use SWIG for D2, So in case that my questions are stupid simple.. Sorry. questions are included in swig file wincore.i /* wincore.i */ %module(directors="1") wincore %{ #include "wincore.h" %} %include "std_string.i" %include /* turn on director wrapping for C

Re: Why Ruby?

2010-12-12 Thread foobar
Adam D. Ruppe Wrote: > foobar wrote: > > D basically re-writes foreach with opApply into the ruby version > which is why Ruby is *BETTER* > > You missed the point: there is no "Ruby version". They are the > same thing. > By "ruby version" I meant the syntax. I agreed already that they are imple

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Simen kjaeraas
Walter Bright wrote: Andrei Alexandrescu wrote: Compared to the talk at Google, I changed one of the "cool things" from threading to operator overloading. Didn't manage to talk about that - there were a million questions - although I think it's a great topic. http://erdani.com/tdpl/2010-1

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
On Sun, 12 Dec 2010 19:34:10 +0100, Nick Sabalausky wrote: "Simen kjaeraas" wrote in message news:op.vnl1katxvxi...@biotronic-pc.lan... so wrote: If we take a look at the very first code example from the talk it looks like this: account.people.each do |person| puts person.name end

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Andrej Mitrovic
Looks like someone did: http://www.reddit.com/r/programming/comments/eklq0/andrei_alexandrescus_talk_at_accu_silicon_valley/ On 12/12/10, Walter Bright wrote: > Andrei Alexandrescu wrote: >> Compared to the talk at Google, I changed one of the "cool things" from >> threading to operator overloadi

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
Andrei Alexandrescu wrote: fun (a, b ; c) stmt => fun(c, (a, b) { stmt }) This could and should be generalized for more parameters, which I'm sure is very useful: fun (a, b ; c, d) stmt => fun(c, d, (a, b) { stmt }) Of course "fun" could be actually "obj.method". With this we have a

Re: Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Walter Bright
Andrei Alexandrescu wrote: Compared to the talk at Google, I changed one of the "cool things" from threading to operator overloading. Didn't manage to talk about that - there were a million questions - although I think it's a great topic. http://erdani.com/tdpl/2010-12-08-ACCU.pdf Anyone ca

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
Nick Sabalausky wrote: void myfun(void delegate(string) lol) { lol("say it "); } void main() { myfun = (string what) { assert(0, what ~ " lol"); }; } I'm sure that's going to disappear when D's properties get implemented as intended. I'm not. Co

Re: Why Ruby?

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 12:36 PM, Nick Sabalausky wrote: "Adam D. Ruppe" wrote in message news:ie2sv2$2th...@digitalmars.com... We already have a D block syntax! = void myfun(void delegate() lol) { lol(); } void main() { myfun = { assert(0, "lol"); }; } =

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
Nick Sabalausky wrote: > And FWIW, it looks like operator-overload-abuse to me. Probably because that's what it is :)

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:ie34p4$dg...@digitalmars.com... > "Adam D. Ruppe" wrote in message > news:ie2sv2$2th...@digitalmars.com... >> We already have a D block syntax! >> >> = >> >> void myfun(void delegate() lol) { >>lol(); >> } >> >> void main() { >>myfun =

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Adam D. Ruppe" wrote in message news:ie2sv2$2th...@digitalmars.com... > We already have a D block syntax! > > = > > void myfun(void delegate() lol) { >lol(); > } > > void main() { >myfun = { >assert(0, "lol"); >}; > } > > == > > Totally compiles. :

Re: Why Ruby?

2010-12-12 Thread Lutger Blijdestijn
Andrei Alexandrescu wrote: > On 12/12/10 6:44 AM, Jacob Carlborg wrote: > [snip] >> Conclusion: >> >> D needs a better and nicer looking syntax for passing delegates to >> functions. >> >> Suggestion: >> >> If a function takes a delegate as its last parameter allow the delegate >> literal to be pa

Slides from my ACCU Silicon Valley talk

2010-12-12 Thread Andrei Alexandrescu
Compared to the talk at Google, I changed one of the "cool things" from threading to operator overloading. Didn't manage to talk about that - there were a million questions - although I think it's a great topic. http://erdani.com/tdpl/2010-12-08-ACCU.pdf Andrei

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Simen kjaeraas" wrote in message news:op.vnl1katxvxi...@biotronic-pc.lan... > so wrote: > >>> If we take a look at the very first code example from the talk it looks >>> like this: >>> >>> account.people.each do |person| >>> puts person.name >>> end >>> >>> You could translate this in two

Re: Why Ruby?

2010-12-12 Thread Nick Sabalausky
"Jacob Carlborg" wrote in message news:ie2g72$1sf...@digitalmars.com... > On 2010-12-11 18:21, Andrei Alexandrescu wrote: >> On 12/11/10 11:05 AM, so wrote: >>> Not to hijack this one but on the other thread i asked why this is >>> needed. >>> I am not here asking for syntax or commanding phobos

Re: Why Ruby?

2010-12-12 Thread Andrei Alexandrescu
On 12/12/10 6:44 AM, Jacob Carlborg wrote: [snip] Conclusion: D needs a better and nicer looking syntax for passing delegates to functions. Suggestion: If a function takes a delegate as its last parameter allow the delegate literal to be passed outside the parameter list, after the function ca

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
Lutger Blijdestijn wrote: > You can't compare freach to code blocks [..] whereas code block syntax is available to every function in ruby. Meh, foreach covers the majority of its use anyway, and plain delegate syntax works just as well for the rest of it. I can't get worked up over typing parenthe

Re: ByToken Range

2010-12-12 Thread Matthias Walter
On 12/12/2010 02:04 AM, Christopher Nicholson-Sauls wrote: > On 12/11/10 22:41, Matthias Walter wrote: >> Hi all, >> >> I wrote a ByToken tokenizer that models Range, i.e. it can be used in a >> foreach loop to read from a std.stdio.File. For it to work one has to >> supply it with a delegate, taki

Re: Please vote on std.datetime

2010-12-12 Thread Kagamin
Steven Schveighoffer Wrote: > I think 100-nsecs is a good choice for tick resolution. My concern is millisecond is a SI unit, but hectonanosecond isn't, so I don't think, it's a good choice: it's hardly comprehensible. > It gives a very generous range for working > with, plus is fine-grained

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
foobar wrote: > D basically re-writes foreach with opApply into the ruby version which is why Ruby is *BETTER* You missed the point: there is no "Ruby version". They are the same thing. > foreach to me is a redundant obfuscation How can it be redundant? It's got the same elements the same number

Re: Why Ruby?

2010-12-12 Thread spir
On Sun, 12 Dec 2010 16:29:29 + (UTC) "Adam D. Ruppe" wrote: > so wrote: > > Am i alone thinking D one better here? > > No, I find foreach to be significantly better than the ruby > blocks too. I recently argued on the gentoo forums that > they are virtually equivalent too: > http://forums.ge

Re: Why Ruby?

2010-12-12 Thread Lutger Blijdestijn
Adam D. Ruppe wrote: > so wrote: >> Am i alone thinking D one better here? > > No, I find foreach to be significantly better than the ruby > blocks too. I recently argued on the gentoo forums that > they are virtually equivalent too: > http://forums.gentoo.org/viewtopic-p-6500059.html#6500059 >

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
so wrote: If we take a look at the very first code example from the talk it looks like this: account.people.each do |person| puts person.name end You could translate this in two ways when translating into D. First way: foreach (person ; account.people) writeln(person.name); Am

Re: Problems with dmd inlining

2010-12-12 Thread Michel Fortin
On 2010-12-12 11:09:24 -0500, so said: Normally, yes, I'd agree. But in this case, it's merely a port of the C++ source code, so all algorithms are identical. The only change I did initially was to use ranges, but even after replacing those with mixins, the performance was equally as bad.

Re: Why Ruby?

2010-12-12 Thread foobar
Adam D. Ruppe Wrote: > so wrote: > > Am i alone thinking D one better here? > > No, I find foreach to be significantly better than the ruby > blocks too. I recently argued on the gentoo forums that > they are virtually equivalent too: > http://forums.gentoo.org/viewtopic-p-6500059.html#6500059 >

Re: Casting functions to delegates

2010-12-12 Thread Matthias Walter
On 12/12/2010 06:15 AM, Dmitry Olshansky wrote: > On 12.12.2010 7:25, Matthias Walter wrote: >> Hi all, >> >> there was a discussion in 2006 but w/o a result, and I didn't find any >> bugs about implicitely casting functions to delegates. It seems to be >> impossible as long as function-pointer cal

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
so wrote: > Am i alone thinking D one better here? No, I find foreach to be significantly better than the ruby blocks too. I recently argued on the gentoo forums that they are virtually equivalent too: http://forums.gentoo.org/viewtopic-p-6500059.html#6500059 opApply is implemented with a delegat

Re: Why Ruby?

2010-12-12 Thread so
If we take a look at the very first code example from the talk it looks like this: account.people.each do |person| puts person.name end You could translate this in two ways when translating into D. First way: foreach (person ; account.people) writeln(person.name); Am i alone think

Re: Why Ruby?

2010-12-12 Thread Adam D. Ruppe
We already have a D block syntax! = void myfun(void delegate() lol) { lol(); } void main() { myfun = { assert(0, "lol"); }; } == Totally compiles. :-P It works with delegate arguments too! void myfun(void delegate(string) lol) {

Re: Problems with dmd inlining

2010-12-12 Thread so
Normally, yes, I'd agree. But in this case, it's merely a port of the C++ source code, so all algorithms are identical. The only change I did initially was to use ranges, but even after replacing those with mixins, the performance was equally as bad. There's also no memory allocations, so t

Re: Problems with dmd inlining

2010-12-12 Thread Jason House
Walter Bright Wrote: > Jason House wrote: > > I wish I had your problems. I ported a sizable set of C++ code to D2 and > > discovered D2 with dmd was 50x slower than C++ with gcc! I've been to > > busy/disappointed to track down the bug(s) causing such a slowdown. If > > anyone > > is sufficientl

Re: Why Ruby?

2010-12-12 Thread Simen kjaeraas
Lutger Blijdestijn wrote: Simen kjaeraas wrote: Ary Borenszweig wrote: Code is read many more times than it is written and so it is of huge important that code is as readable as possible. Of course this is a subjective matter, but I don't understand why some people think __traits or __gs

Re: String to boolean inconsistency

2010-12-12 Thread Simen kjaeraas
spir wrote: On Sun, 12 Dec 2010 04:00:36 +0100 "Simen kjaeraas" wrote: So likely, idup on an empty string returns an array with null ptr and 0 length, while "" is 'allocated' in the data segment, and thus given a ptr value. .dup & .idup should not change a string's truth value. For sure, _

Re: Why Ruby?

2010-12-12 Thread Lutger Blijdestijn
Jacob Carlborg wrote: ... > > If we have a look at the next code example from the talk there is no > clear and natural way to translate it into D, first the Ruby code: > > class PeopleController < ActionController::Base > before_filter :authenticate > > def index > @people =

Re: Why Ruby?

2010-12-12 Thread foobar
I agree with Jacob Carlborg regarding the problem. It would indeed be nice to have better delegates syntax. But, why are we trying so hard to force the same syntax that's used for 'regular' function calls? I'm unconvinced that the suggestions provided are clearer to either the programmer or the

Re: Why Ruby?

2010-12-12 Thread Jacob Carlborg
On 2010-12-11 18:21, Andrei Alexandrescu wrote: On 12/11/10 11:05 AM, so wrote: Not to hijack this one but on the other thread i asked why this is needed. I am not here asking for syntax or commanding phobos team to implement something, I just want to know about technical limitations and license

Re: Casting functions to delegates

2010-12-12 Thread Dmitry Olshansky
On 12.12.2010 7:25, Matthias Walter wrote: Hi all, there was a discussion in 2006 but w/o a result, and I didn't find any bugs about implicitely casting functions to delegates. It seems to be impossible as long as function-pointer calls work differently than delegate calls in the ABI. Will this

Re: Why Ruby?

2010-12-12 Thread Lutger Blijdestijn
Simen kjaeraas wrote: > Ary Borenszweig wrote: >> Code is read many more times than it is written and so it is of huge >> important that code is as readable as possible. Of course this is a >> subjective matter, but I don't understand why some people think __traits >> or __gshared are ok. > > __

Re: ldc2: Current State?

2010-12-12 Thread Iain Buclaw
== Quote from Jordi (jo...@rovira.cat)'s article > On 12/08/2010 09:18 PM, Jordi wrote: > > On 12/08/2010 06:13 AM, Iain Buclaw wrote: > >> == Quote from Robert Clipsham (rob...@octarineparrot.com)'s article > >>> On 06/12/10 18:27, dsimcha wrote: > Apparently LDC2 is being actively worked on

empty string & array truth values& comparisons to null

2010-12-12 Thread spir
Hello, After the thread on "String to boolean inconsistency", here is a little comparison. I think it speaks by itself. unittest { auto form = "%s %s %s %s %s %s"; int[] a0; int[] a1 = []; writefln(form, a0?true:false, a1?true:false, a0 == null,

Re: String to boolean inconsistency

2010-12-12 Thread spir
On Sun, 12 Dec 2010 04:00:36 +0100 "Simen kjaeraas" wrote: > So likely, idup on an empty string returns an array with null ptr and > 0 length, while "" is 'allocated' in the data segment, and thus given a > ptr value. .dup & .idup should not change a string's truth value. For sure, _this_ is a

Re: String to boolean inconsistency

2010-12-12 Thread spir
On Sun, 12 Dec 2010 03:47:02 +0100 Andrej Mitrovic wrote: > The first one should fail since the string has length 0. If you use an > .idup you would get the correct results: > > void main() > { > string s = "".idup; > assert(s); // fails > assert(s != null); // ok > } > > So I guess it's a bu

Re: ldc2: Current State?

2010-12-12 Thread Jordi
On 12/08/2010 09:18 PM, Jordi wrote: On 12/08/2010 06:13 AM, Iain Buclaw wrote: == Quote from Robert Clipsham (rob...@octarineparrot.com)'s article On 06/12/10 18:27, dsimcha wrote: Apparently LDC2 is being actively worked on (http://bitbucket.org/prokhin_alexey/ldc2/) and is up to date with t