Re: LDC2 with -fxray-instrument

2019-01-15 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 14:32:03 UTC, Márcio Martins wrote: Anyone has any idea how to build with LDC and -fxray-instrument? I am running LDC 1.13 on Linux (x64) The XRay section is in the binary, and the compiler-rt is linked in, but when I run the binary with

Re: problem extracting data from GtkSourceView using Gtkd

2019-01-15 Thread Mike Wey via Digitalmars-d-learn
On 14-01-2019 23:52, Chris Bare wrote: I would have posted this in the Gtkd forum, but it has been down for a while. I'm porting a GTK2/C program to Gtkd. I'm trying to read the data from a GtkSourceView, but when I try to get the bounds, it's always zero. Here's the c version that works:  

Re: Has anyone tried making a QtCreator plugin for D and what is your experience?

2019-01-15 Thread Laurent Tréguier via Digitalmars-d-learn
On Saturday, 12 January 2019 at 20:10:40 UTC, Enjoys Math wrote: On Saturday, 12 January 2019 at 16:09:22 UTC, Laurent Tréguier wrote: On Saturday, 12 January 2019 at 15:16:25 UTC, Laurent Tréguier wrote: QtCreator 4.8.0 introduced support for the LSP last month :

Re: What's that 'q' before '{' in this code?

2019-01-15 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote: https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75 https://dlang.org/spec/lex.html#token_strings :)

Re: What's that 'q' before '{' in this code?

2019-01-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote: https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75 It is a string literal that must be made out of D code tokens. In my blog this week, I talked about some code that uses them:

Re: What's that 'q' before '{' in this code?

2019-01-15 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 17:56:10 UTC, SrMordred wrote: On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote: https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75 https://dlang.org/spec/lex.html#token_strings :) I had just infered from the commend in the code

What's that 'q' before '{' in this code?

2019-01-15 Thread Machine Code via Digitalmars-d-learn
https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75

LDC2 with -fxray-instrument

2019-01-15 Thread Márcio Martins via Digitalmars-d-learn
Anyone has any idea how to build with LDC and -fxray-instrument? I am running LDC 1.13 on Linux (x64) The XRay section is in the binary, and the compiler-rt is linked in, but when I run the binary with XRAY_OPTIONS="patch_premain=true verbosity=1" in the environment, and I get nothing. No

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-15 Thread John Burton via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 12:15:41 UTC, rikki cattermole wrote: On 16/01/2019 1:05 AM, John Burton wrote: On Tuesday, 15 January 2019 at 11:26:50 UTC, rikki cattermole wrote: Longer term, you're better off with the builder. Thanks for your reply. But what is the builder?

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-15 Thread rikki cattermole via Digitalmars-d-learn
On 16/01/2019 1:05 AM, John Burton wrote: On Tuesday, 15 January 2019 at 11:26:50 UTC, rikki cattermole wrote: Longer term, you're better off with the builder. Thanks for your reply. But what is the builder? https://en.wikipedia.org/wiki/Builder_pattern One of the few OOP design patterns

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-15 Thread John Burton via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 11:26:50 UTC, rikki cattermole wrote: Longer term, you're better off with the builder. Thanks for your reply. But what is the builder? Creating windows is a very complex task that can balloon in scope. Well that was mostly just an example that I thought

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-15 Thread rikki cattermole via Digitalmars-d-learn
Longer term, you're better off with the builder. Even with named parameters (2 DIP's are in the queue for adding it). Creating windows is a very complex task that can balloon in scope. Being able to hide it away in a separate type can be quite desirable if you want your windowing library to be

Re: Destructor for struct invoked many times

2019-01-15 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 10:49:17 UTC, rikki cattermole wrote: Because you passed it by value to writeln, which goes on to pass it to many other functions. Thanks Rikki! I was thinking about something like that. Antonio

Is there a nice syntax to achieve optional named parameters?

2019-01-15 Thread John Burton via Digitalmars-d-learn
As an example let's say I have a type 'Window' that represents a win32 window. I'd like to be able to construct an instance of the type with some optional parameters that default to some reasonable settings and create the underlying win32 window. I'd ideally like some syntax like this :-

Destructor for struct invoked many times

2019-01-15 Thread Antonio Corbi via Digitalmars-d-learn
Hi, In this simple example, the destructor for the struct is invoked four more times than expected: import std.stdio; struct Person { string name; int age; ~this() { writefln("%s is gone (0x%x)", name, ); } } int main(string[] args) { Person* p = new Person; writefln

Re: Destructor for struct invoked many times

2019-01-15 Thread rikki cattermole via Digitalmars-d-learn
Because you passed it by value to writeln, which goes on to pass it to many other functions.

Re: Design by Introspection - Looking for examples

2019-01-15 Thread Tony A via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 07:14:22 UTC, Petar Kirov [ZombineDev] wrote: Basically, look for `static if`s in Phobos. A couple of rich modules/packages: ... Hi Petar, Thanks for the links, especially the checkint which was one example Andrei gave in the presentation. Tony.

Re: Design by Introspection - Looking for examples

2019-01-15 Thread Tony A via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 07:14:22 UTC, Petar Kirov [ZombineDev] wrote: Basically, look for `static if`s in Phobos. A couple of rich modules/packages: Hi Petar