JustQuestion: Are 'D' had a browser library?

2017-02-19 Thread dummy via Digitalmars-d-learn
Hello! I need are functions for clawing... 1. Working javascript(curl didn't) 2. Get HTML code 3. GET/POST Request So, I'm searched about the headless browser for using with D before writing a this question. * Derelict-CEF Looks like dead and didn't have a document(or tutorial). * Webkit

Re: How to get the type of a derived class in a method of its base class?

2017-02-19 Thread aberba via Digitalmars-d-learn
On Sunday, 19 February 2017 at 07:52:13 UTC, Max Samukha wrote: class B { } auto b = new B; Here, T becomes A, which may be reasonable but is completely useless. Is there a way to obtain the type of the class (or class instance reference) the method is called on? is B not supposed to inhe

Re: JustQuestion: Are 'D' had a browser library?

2017-02-19 Thread aberba via Digitalmars-d-learn
On Sunday, 19 February 2017 at 08:01:56 UTC, dummy wrote: Hello! I need are functions for clawing... 1. Working javascript(curl didn't) 2. Get HTML code 3. GET/POST Request So, I'm searched about the headless browser for using with D before writing a this question. * Derelict-CEF Looks l

Re: JustQuestion: Are 'D' had a browser library?

2017-02-19 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 February 2017 at 08:01:56 UTC, dummy wrote: * Derelict-CEF Looks like dead and didn't have a document(or tutorial). It's a binding to the C API of CEF, so you shouldn't expect much documentation or any tutorials with it beyond the binding specific functionality in the README. I

Re: How to get the type of a derived class in a method of its base class?

2017-02-19 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 February 2017 at 07:52:13 UTC, Max Samukha wrote: class A { this(T = this)() { static assert(is(T == B)); } } class B { } auto b = new B; Here, T becomes A, which may be reasonable but is completely useless. Is there a way to obtain the type of the class (or cla

Re: How to get the type of a derived class in a method of its base class?

2017-02-19 Thread biozic via Digitalmars-d-learn
On Sunday, 19 February 2017 at 07:52:13 UTC, Max Samukha wrote: class A { this(T = this)() { static assert(is(T == B)); } } class B { } auto b = new B; Here, T becomes A, which may be reasonable but is completely useless. Is there a way to obtain the type of the class (or cla

segmentation fault with Object.factory()

2017-02-19 Thread berni via Digitalmars-d-learn
I get a segmentation fault, when I run this program: void main() { A bar = cast(A)Object.factory("AA"); bar.foo(); } class A{ abstract void foo(); } class AA:A { override void foo() {} } The call of bar.foo() is, where the segmentation fault occurs. When I use A bar = new AA(); ins

Re: segmentation fault with Object.factory()

2017-02-19 Thread rikki cattermole via Digitalmars-d-learn
On 19/02/2017 11:06 PM, berni wrote: I get a segmentation fault, when I run this program: void main() { A bar = cast(A)Object.factory("AA"); bar.foo(); } class A{ abstract void foo(); } class AA:A { override void foo() {} } The call of bar.foo() is, where the segmentation fault occ

Re: segmentation fault with Object.factory()

2017-02-19 Thread berni via Digitalmars-d-learn
On Sunday, 19 February 2017 at 10:15:49 UTC, rikki cattermole wrote: What's wrong here? void main() { A bar = cast(A)Object.factory(__MODULE__ ~ ".AA"); bar.foo(); } Oops. I overdid when trying to create a small example. With the module it works, but my original program had the module

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread timmyjose via Digitalmars-d-learn
On Saturday, 18 February 2017 at 22:17:30 UTC, berni wrote: I'm new here too (never heard of D before 2017). Glad to meet someone else new here! :-) c). The whole community seems infused with both the Feminism/SJW I didn't tried out Rust, but that would draw me away too. (Incidentally it w

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread timmyjose via Digitalmars-d-learn
On Saturday, 18 February 2017 at 21:51:34 UTC, Daniel Kozak wrote: Dne 18.2.2017 v 21:15 timmyjose via Digitalmars-d-learn napsal(a): [...] Hi, welcome in D community Thank you! I'm glad to be part of this excellent community! [...] Yes, by default D use GC. And yes there is a some part

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread timmyjose via Digitalmars-d-learn
On Saturday, 18 February 2017 at 21:58:15 UTC, ketmar wrote: timmyjose wrote: Thanks for the very comprehensive response! I think most of my doubts are cleared now. You're right though that I'm probably worrying too much about GC with my current use case. i can tell you that i'm doing things

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread timmyjose via Digitalmars-d-learn
On Sunday, 19 February 2017 at 11:51:02 UTC, timmyjose wrote: On Saturday, 18 February 2017 at 21:58:15 UTC, ketmar wrote: [...] No, you're quite right indeed! First of all, those sound like very interesting project! :-), and you're right about the GC part. I have some experience in systems

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread ag0aep6g via Digitalmars-d-learn
On 02/19/2017 12:51 PM, timmyjose wrote: a). So the GC is part of the runtime even if we specify @nogc Yup. @nogc is per function, not per program. Other functions are allowed to use the GC. b). Do we manually trigger the GC (like Java's System.gc(), even though that's not guaranteed), or d

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote: My rudimentary knowledge of the D ecosystem tells me that there is a GC in D, but that can be turned off. Is this correct? Also, some threads online mention that if we do turn off GC, some of the core std libraries may not fully wo

Re: segmentation fault with Object.factory()

2017-02-19 Thread ag0aep6g via Digitalmars-d-learn
On 02/19/2017 12:13 PM, berni wrote: And here is what I get when compiling: $> rdmd test.d segmentation fault $> rdmd --extra-file=test2.d test.d segmentation fault $> rm -rf /tmp/.rdmd-1000/ $> rdmd --extra-file=test2.d test.d A $> rdmd -version rdmd build 20170122 [...] Should I report this

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread ketmar via Digitalmars-d-learn
timmyjose wrote: a). So the GC is part of the runtime even if we specify @nogc yes. GC is basically just a set of functions and some supporting data structures, it is compiled in druntime. @nogc doesn't turn it off, if says that compiler must ensure that *your* *code* doesn't allocate, at comp

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread ketmar via Digitalmars-d-learn
timmyjose wrote: I can't help here because I am using D for a long time, so I do not remember how I have learned it. Hahaha! Yes, thanks for the honesty. It does make sense because once you've been working in some field for some time, it does make it harder to explain how exactly you reached th

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-02-19 13:45, ketmar wrote: nogc doesn't turn it off, if says that compiler must ensure that *your* *code* doesn't allocate, Just to clarify, allocate using the GC. It's perfectly fine to allocate using malloc in a @nogc function. -- /Jacob Carlborg

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread bachmeier via Digitalmars-d-learn
On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote: 4. I have heard good reports of D's metaprogramming capabilities (ironically enough, primarily from a thread on the Rust user group), and coming from a Common Lisp (and some Racket) background, I am deeply interested in this aspect

Force inline

2017-02-19 Thread berni via Digitalmars-d-learn
Is it possible to force a function to be inlined? Comparing a C++ and a D program, the main difference in speed (about 20-30%) is, because I manage to force g++ to inline a function while I do not find any means to do the same on D.

Re: Force inline

2017-02-19 Thread Daniel Kozak via Digitalmars-d-learn
Dne 19.2.2017 v 20:19 berni via Digitalmars-d-learn napsal(a): Is it possible to force a function to be inlined? Comparing a C++ and a D program, the main difference in speed (about 20-30%) is, because I manage to force g++ to inline a function while I do not find any means to do the same on

Re: Force inline

2017-02-19 Thread Daniel Kozak via Digitalmars-d-learn
Dne 19.2.2017 v 20:19 berni via Digitalmars-d-learn napsal(a): Is it possible to force a function to be inlined? Comparing a C++ and a D program, the main difference in speed (about 20-30%) is, because I manage to force g++ to inline a function while I do not find any means to do the same on

Re: Force inline

2017-02-19 Thread ag0aep6g via Digitalmars-d-learn
On Sunday, 19 February 2017 at 19:19:25 UTC, berni wrote: Is it possible to force a function to be inlined? https://dlang.org/spec/pragma.html#inline

Re: Force inline

2017-02-19 Thread Satoshi via Digitalmars-d-learn
On Sunday, 19 February 2017 at 19:19:25 UTC, berni wrote: Is it possible to force a function to be inlined? Comparing a C++ and a D program, the main difference in speed (about 20-30%) is, because I manage to force g++ to inline a function while I do not find any means to do the same on D.

Create doc simultaneously with compilation

2017-02-19 Thread Satoshi via Digitalmars-d-learn
Why is not possible to create documentation, compile code and generate header files simultaneously? When I pass -D and -Dd flags to ldc2 command it won't create doc until I don't pass -o- flag too.