Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Tolga Cakiroglu via Digitalmars-d-learn
On Friday, 16 May 2014 at 04:59:46 UTC, Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5; public int getvalue(){ return value; } } int main(string[] args) { GC.disable; static fruit myfruit; return

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 15/05/14 23:27, Tom Browder via Digitalmars-d-learn wrote: I am a volunteer developer with the well-known 3D CAD FOSS project BRL-CAD: http://brlcad.org I have wanted to use D for a long time but I hadn't taken the plunge. Yesterday I advertised to the BRL-CAD community my new project to

Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/15/2014 09:59 PM, Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5; public int getvalue(){ return value; } } int main(string[] args) { GC.disable; static fruit myfruit; return

Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 16/05/14 06:59, Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5; public int getvalue(){ return value; } } int main(string[] args) { GC.disable; static fruit myfruit; return

Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/05/2014 4:59 p.m., Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5; public int getvalue(){ return value; } } int main(string[] args) { GC.disable; static fruit myfruit; return

Re: Disabling SSL Verification on std.net.curl

2014-05-16 Thread Mengu via Digitalmars-d-learn
On Friday, 16 May 2014 at 04:58:47 UTC, Jack wrote: A follow up from : http://forum.dlang.org/thread/nsdomtdbqqlylrmgo...@forum.dlang.org I discovered that it was not a C::B issue as I already compiled it with Xamarin Studio and it was still spewing out the error:

Re: Any chance to avoid monitor field in my class?

2014-05-16 Thread Daniel Murphy via Digitalmars-d-learn
Yuriy wrote in message news:klosrzuxwmvilupzz...@forum.dlang.org... Ok, i can understand that, but what about this one: http://dpaste.dzfl.pl/6a9961e32e6d It doesn't use d arrays in function interfaces. Should it work? Similar problem, D arrays cannot be mangled correctly with C++ mangling.

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread John Colvin via Digitalmars-d-learn
On Friday, 16 May 2014 at 06:17:47 UTC, Jacob Carlborg wrote: On 15/05/14 23:27, Tom Browder via Digitalmars-d-learn wrote: I am a volunteer developer with the well-known 3D CAD FOSS project BRL-CAD: http://brlcad.org I have wanted to use D for a long time but I hadn't taken the plunge.

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread bearophile via Digitalmars-d-learn
John Colvin: Any plans to get any preprocessor stuff working? Do you mean in D? Bye, bearophile

Re: [Rosettacode] Growable slices

2014-05-16 Thread bearophile via Digitalmars-d-learn
There are of course ways to implement a really efficient ZLW compressor in D, and such implementation could be added as third D entry if it manages to be not too much long, Third version added: http://rosettacode.org/wiki/LZW_compression#More_Efficient_Version I have tried to make it

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Thu, May 15, 2014 at 9:56 PM, FrankLike via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ... And use VisualD. Thanks for the suggestion, Frank, but I don't do windows. Best, -Tom

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Fri, May 16, 2014 at 1:17 AM, Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ... On 15/05/14 23:27, Tom Browder via Digitalmars-d-learn wrote: ... I have been looking for specific information on creating D bindings from C headers for which there seems to be

Re: Disabling SSL Verification on std.net.curl

2014-05-16 Thread Jack via Digitalmars-d-learn
On Friday, 16 May 2014 at 07:37:33 UTC, Mengu wrote: hi Jack curl has an option called SSL_VERIFYPEER which is supported by etc.c.curl: CurlOption. you can simply do the following: import std.stdio; import etc.c.curl : CurlOption; import std.net.curl; void main() { auto conn = HTTP();

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Mengu via Digitalmars-d-learn
On Friday, 16 May 2014 at 09:44:11 UTC, bearophile wrote: John Colvin: Any plans to get any preprocessor stuff working? Do you mean in D? Bye, bearophile i think he means in dstep.

Re: [Rosettacode] Growable slices

2014-05-16 Thread Artur Skawina via Digitalmars-d-learn
On 05/16/14 11:47, bearophile via Digitalmars-d-learn wrote: There are of course ways to implement a really efficient ZLW compressor in D, and such implementation could be added as third D entry if it manages to be not too much long, Third version added:

Re: Seg fault when calling C code

2014-05-16 Thread Kagamin via Digitalmars-d-learn
For example, windows headers do use C++ -references in function signatures and msdn provides code examples using that convention, the equivalent in D is ref.

Re: [Rosettacode] Growable slices

2014-05-16 Thread bearophile via Digitalmars-d-learn
Artur Skawina: So how does it perform wrt the D version that I wrote for you last time? [1] [1] http://forum.dlang.org/post/mailman.2132.1353592965.5162.digitalmar...@puremagic.com) From your answer: First, the code above is practically a textbook example on how /not/ to write readable and

Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 02:31:18 -0400, Jacob Carlborg d...@me.com wrote: On 16/05/14 06:59, Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5; public int getvalue(){ return value; } } int main(string[] args)

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 16/05/14 11:19, John Colvin wrote: Any plans to get any preprocessor stuff working? Presumably libclang can make this feasible. Yes, eventually. Although, currently libclang doesn't really provide an API for the preprocessor, so that needs to be added. -- /Jacob Carlborg

Re: Seg fault when calling C code

2014-05-16 Thread via Digitalmars-d-learn
On Friday, 16 May 2014 at 11:42:35 UTC, Kagamin wrote: For example, windows headers do use C++ -references in function signatures and msdn provides code examples using that convention, the equivalent in D is ref. But that's extern(C++), not extern(C)...

Re: [Rosettacode] Growable slices

2014-05-16 Thread bearophile via Digitalmars-d-learn
Artur Skawina: Ugh. So how does it perform wrt the D version that I wrote for you last time? [1] I have done a benchmark with the various version (the first 3 are the ones on the Rosettacode site, and the #4 is yours): lzw1: 0.39 lzw2: 0.17 lzw3: 0.21 lzw4: 0.17 I think your comment was

Re: Seg fault when calling C code

2014-05-16 Thread Andrew Brown via Digitalmars-d-learn
On Friday, 16 May 2014 at 14:52:17 UTC, Marc Schütz wrote: On Friday, 16 May 2014 at 11:42:35 UTC, Kagamin wrote: For example, windows headers do use C++ -references in function signatures and msdn provides code examples using that convention, the equivalent in D is ref. But that's

Re: Seg fault when calling C code

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 08:15 AM, Andrew Brown wrote: I guess my confusion came about because in the page about interfacing with C, there's a static array example where parameters are given in terms D understands: extern (C) { void foo(ref int[3] a); // D prototype } I guess D has no problem

Re: Seg fault when calling C code

2014-05-16 Thread Andrew Brown via Digitalmars-d-learn
I guess my confusion came about because in the page about interfacing with C, there's a static array example where parameters are given in terms D understands: extern (C) { void foo(ref int[3] a); // D prototype } I guess D has no problem translating that into a simple pointer that C can

Re: Seg fault when calling C code

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 08:24 AM, Ali Çehreli wrote: On 05/16/2014 08:15 AM, Andrew Brown wrote: void foo(ref int[3] a); // D prototype Since we know that references are implemented as pointers, 'ref int[3] a' is passed as a.ptr. Sorry, that's confusing. Yes, it ends up being equal to a.ptr

Re: [Rosettacode] Growable slices

2014-05-16 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 16 May 2014 at 15:20:04 UTC, bearophile wrote: Artur Skawina: Ugh. So how does it perform wrt the D version that I wrote for you last time? [1] I have done a benchmark with the various version (the first 3 are the ones on the Rosettacode site, and the #4 is yours): lzw1: 0.39

Re: Array!T and find are slow

2014-05-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thu, 15 May 2014 08:04:59 -0300 Ary Borenszweig via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Isn't there a way in D to just expand: enforce(cond, failure); (or something with a similar syntax) to this, at compile-time: if(!cond) throw new Exception(failure); I

Re: [Rosettacode] Growable slices

2014-05-16 Thread bearophile via Digitalmars-d-learn
monarch_dodra: Arguably, your code allocates a lot. What version (1-2-3) do you mean? I'll give it a shot (next week). I think the LZW entries are OK :) So if you want to work on Rosettacode it's better to write an entry that is missing in D. Bye, bearophile

Re: Array!T and find are slow

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 11:36:44 -0400, Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thu, 15 May 2014 08:04:59 -0300 Ary Borenszweig via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Isn't there a way in D to just expand: enforce(cond,

Re: Disabling SSL Verification on std.net.curl

2014-05-16 Thread Jon Giddy via Digitalmars-d-learn
On Friday, 16 May 2014 at 07:37:33 UTC, Mengu wrote: On Friday, 16 May 2014 at 04:58:47 UTC, Jack wrote: std.net.curl.CurlException@std\net\curl.d(3592): problem with the SSL CA cert (path? access rights?) on handle 22D3D68 And since I am only using the program by myself for personal

Re: [Rosettacode] Growable slices

2014-05-16 Thread Artur Skawina via Digitalmars-d-learn
On 05/16/14 17:20, bearophile via Digitalmars-d-learn wrote: Artur Skawina: Ugh. So how does it perform wrt the D version that I wrote for you last time? [1] I have done a benchmark with the various version (the first 3 are the ones on the Rosettacode site, and the #4 is yours): lzw1:

Re: [Rosettacode] Growable slices

2014-05-16 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 16 May 2014 at 15:49:10 UTC, bearophile wrote: monarch_dodra: Arguably, your code allocates a lot. What version (1-2-3) do you mean? Any of the versions where you can see [c] or [b] where c/b is a char/byte

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 15 May 2014 at 22:25:47 UTC, Tom Browder via Digitalmars-d-learn wrote: I am a volunteer developer with the well-known 3D CAD FOSS project BRL-CAD: http://brlcad.org I have wanted to use D for a long time but I hadn't taken the plunge. Yesterday I advertised to the BRL-CAD

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Alex Herrmann via Digitalmars-d-learn
On Friday, 16 May 2014 at 10:10:17 UTC, Tom Browder via Digitalmars-d-learn wrote: Thanks for the suggestion, Frank, but I don't do windows. Monodevelop (open source C# dev platform) has a plugin for D by Alexander Bothe called Mono-D which is absolutely fantastic and integrates okay with dub

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Fri, May 16, 2014 at 1:19 PM, Alex Herrmann via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 16 May 2014 at 10:10:17 UTC, Tom Browder via ... Thanks for the suggestion, Frank, but I don't do windows. ... Monodevelop (open source C# dev platform) has a plugin for D

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Fri, May 16, 2014 at 1:05 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thursday, 15 May 2014 at 22:25:47 UTC, Tom Browder via .. What I have not seen yet is the exact way to build a D program which uses D bindings and its matching C library. I have

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Fri, May 16, 2014 at 1:05 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ... Then take a look at one of my projects in which i've ported C headers to D. https://github.com/nomad-software/tcltk I notice your binding source files have a .d suffix. Is

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Dicebot via Digitalmars-d-learn
On Friday, 16 May 2014 at 19:05:25 UTC, Tom Browder via Digitalmars-d-learn wrote: On Fri, May 16, 2014 at 1:05 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ... Then take a look at one of my projects in which i've ported C headers to D.

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Tom Browder via Digitalmars-d-learn
On Fri, May 16, 2014 at 2:31 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 16 May 2014 at 19:17:05 UTC, Dicebot wrote: Using .di is more idiomatic as those are supposed to denote declaration-only interface files (with no implementation). In

idup class

2014-05-16 Thread Joshua Niehus via Digitalmars-d-learn
trying to follow: http://ddili.org/ders/d.en/class.html //--- OSX 10.9 DMD 2.065 module test; class Foo { int num; this(int num) { this.num = num; } Foo dup() const { return new Foo(this.num); } immutable(Foo) idup() const { return new

Re: idup class

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 16:28:41 -0400, Joshua Niehus jm.nie...@gmail.com wrote: trying to follow: http://ddili.org/ders/d.en/class.html //--- OSX 10.9 DMD 2.065 module test; class Foo { int num; this(int num) { this.num = num; } Foo dup() const {

Re: idup class

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 16:36:36 -0400, Ali Çehreli acehr...@yahoo.com wrote: Beat you by 8 seconds :) -Steve

Re: idup class

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 01:28 PM, Joshua Niehus wrote: trying to follow: http://ddili.org/ders/d.en/class.html //--- OSX 10.9 DMD 2.065 module test; class Foo { int num; this(int num) { this.num = num; } Foo dup() const { return new Foo(this.num);

Re: idup class

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 01:37 PM, Steven Schveighoffer wrote: On Fri, 16 May 2014 16:36:36 -0400, Ali Çehreli acehr...@yahoo.com wrote: Beat you by 8 seconds :) -Steve I am happy to be within one minute. :) Ali

Re: idup class

2014-05-16 Thread Joshua Niehus via Digitalmars-d-learn
On Friday, 16 May 2014 at 20:36:37 UTC, Ali Çehreli wrote: My apologies. The code was written for an older version of dmd. The simplest fix is to define the constructor as pure: pure this(int num) { this.num = num; } Ali Ahh great thanks guys. No worries Ali, great

string-ish range/stream from curl ubyte[] chunks?

2014-05-16 Thread Vlad via Digitalmars-d-learn
Hello D programmers, I am toying with writing my own HTML parser as a pet project, and I strive to have a range API for the tokenizer and the parser output itself. However it occurs to me that in real-life browsers the advantage of this type of 'streaming' parsing would be given by also

Re: string-ish range/stream from curl ubyte[] chunks?

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 16:57:41 -0400, Vlad b100d...@gmail.com wrote: Hello D programmers, I am toying with writing my own HTML parser as a pet project, and I strive to have a range API for the tokenizer and the parser output itself. However it occurs to me that in real-life browsers the

Re: string-ish range/stream from curl ubyte[] chunks?

2014-05-16 Thread Vlad via Digitalmars-d-learn
On Friday, 16 May 2014 at 21:35:04 UTC, Steven Schveighoffer wrote: On Fri, 16 May 2014 16:57:41 -0400, Vlad b100d...@gmail.com wrote: Q: Is anything like this already in use somewhere in the standard library or a project you know? There is an effort by myself and Dmitry Olshansky to

Re: Objects(from classes) at Compile time? no gc

2014-05-16 Thread Taylor Hillegeist via Digitalmars-d-learn
On Friday, 16 May 2014 at 14:13:28 UTC, Steven Schveighoffer wrote: On Fri, 16 May 2014 02:31:18 -0400, Jacob Carlborg d...@me.com wrote: On 16/05/14 06:59, Taylor Hillegeist wrote: The subject says it all really. i have this example: import core.memory; class fruit{ int value=5;

Re: D Newbie Trying to Use D with Major C Libraries

2014-05-16 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 16 May 2014 at 20:28:31 UTC, Tom Browder via Digitalmars-d-learn wrote: On Fri, May 16, 2014 at 2:31 PM, Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 16 May 2014 at 19:17:05 UTC, Dicebot wrote: Using .di is more idiomatic as those are

Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Alexandre L. via Digitalmars-d-learn
Hello, I was playing around with indexOf when I noticed that the parameter CaseSensitive seems to have a weird behavior. Let's say the following code: string str = Les chemises sont sèches; write(std.string.indexOf(str, Les)); // Returns 0, as expected write(std.string.indexOf(str, les,

Re: Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 04:52 PM, Alexandre L. wrote: Hello, I was playing around with indexOf when I noticed that the parameter CaseSensitive seems to have a weird behavior. Let's say the following code: string str = Les chemises sont sèches; write(std.string.indexOf(str, Les)); // Returns 0, as

Re: Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Alexandre L. via Digitalmars-d-learn
On Saturday, 17 May 2014 at 00:31:14 UTC, Ali Çehreli wrote: On 05/16/2014 04:52 PM, Alexandre L. wrote: Hello, I was playing around with indexOf when I noticed that the parameter CaseSensitive seems to have a weird behavior. Let's say the following code: string str = Les chemises sont

Re: Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Alexandre L. via Digitalmars-d-learn
I'll try to fetch git head and get everything working. Alexandre L. Nevermind that. For some reasons, the bug was happening when my main.d file looked like this: import std.stdio; //import std.string; // will work when imported int main() { string str = Les chemises; // doesnt work

Re: Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Ali Çehreli via Digitalmars-d-learn
On 05/16/2014 05:55 PM, Alexandre L. wrote: I'll try to fetch git head and get everything working. Alexandre L. Nevermind that. For some reasons, the bug was happening when my main.d file looked like this: import std.stdio; //import std.string; // will work when imported int main()

Re: Bug with std.string.indexOf and case sensivity

2014-05-16 Thread Alexandre L. via Digitalmars-d-learn
On Saturday, 17 May 2014 at 01:08:47 UTC, Ali Çehreli wrote: On 05/16/2014 05:55 PM, Alexandre L. wrote: I'll try to fetch git head and get everything working. Alexandre L. Nevermind that. For some reasons, the bug was happening when my main.d file looked like this: import std.stdio;

Re: string-ish range/stream from curl ubyte[] chunks?

2014-05-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 16 May 2014 18:36:02 -0400, Vlad b100d...@gmail.com wrote: On Friday, 16 May 2014 at 21:35:04 UTC, Steven Schveighoffer wrote: On Fri, 16 May 2014 16:57:41 -0400, Vlad b100d...@gmail.com wrote: Q: Is anything like this already in use somewhere in the standard library or a project