Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 27, 2018 16:28:56 Russel Winder via Digitalmars-d-learn wrote: > On Sun, 2018-05-27 at 13:10 +, Adam D. Ruppe via Digitalmars-d-learn > > wrote: > > On Sunday, 27 May 2018 at 13:02:23 UTC, loloof64 wrote: > > > What's the purpose of this 'in' keyword ? I could not process a > >

Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread loloof64 via Digitalmars-d-learn
On Sunday, 27 May 2018 at 13:04:54 UTC, rikki cattermole wrote: On 28/05/2018 1:02 AM, loloof64 wrote: Hello everyone, I've just completed the language tour, and I am starting a tutorial in order to use Gtk binding. But somewhere, they use the 'in' keyword for the constructor :

Re: Code repetition

2018-05-27 Thread Malte via Digitalmars-d-learn
On Sunday, 27 May 2018 at 06:47:38 UTC, IntegratedDimensions wrote: A string mixin is too messy since it treats the code as a string losing all syntax highlighting, etc. I'd love to have something like a template mixin where I can just do mixin template fooSetup(ret) { // setup stuff

Re: Code repetition

2018-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 May 2018 at 06:47:38 UTC, IntegratedDimensions wrote: Putting the code in a template/function/lambda does not work because of the scopes which will be called when the main function exists. I think you might just be using the wrong kind of function. --- import std.stdio; // the

Why 'getSymbolsByUDA' filters private members?

2018-05-27 Thread Sobaya via Digitalmars-d-learn
I'd like to get symbols that have an UDA. But when the member is private, it is not obtained. And I found a comment saying "Filtering inaccessible members" in the source. Why is it necessary to filter out private members?

Naming conventions for export and import members of a struct

2018-05-27 Thread Per Nordlöw via Digitalmars-d-learn
The integer type in gmp-z just got export (binary serialization) support at https://github.com/nordlow/gmp-d/pull/8 Next up is import (binary deserialization). What's the preferred D-style naming convention for wrapping exporting and exporting to binary formats? I'm thinking

Re: Code repetition

2018-05-27 Thread IntegratedDimensions via Digitalmars-d-learn
I guess I should have mentioned that basically this is like a C macro.

Code repetition

2018-05-27 Thread IntegratedDimensions via Digitalmars-d-learn
I have some code like void foo() { // setup stuff int x; scope(exit) something; // x = 34; } void foon() { // setup stuff int x; scope(exit) something; // } All the setup stuff is virtually identical in each foo. There are slight differences such

Re: Remove closure allocation

2018-05-27 Thread Malte via Digitalmars-d-learn
On Saturday, 26 May 2018 at 18:10:30 UTC, Neia Neutuladh wrote: On Saturday, 26 May 2018 at 15:00:40 UTC, Malte wrote: This compiles with DMD, however it returns random numbers instead of the value I passed in. Looks like a bug to me. Should that work or is there any other pattern I could use

Re: Getter an lvalue and cannot be modified

2018-05-27 Thread Mike Franklin via Digitalmars-d-learn
On Sunday, 27 May 2018 at 09:23:09 UTC, IntegratedDimensions wrote: C[] c; @property C[] get() { return c; } get ~= something; errors out, yet auto q = get; q ~= something; is fine. Why is D thinking that ~= is being applied to get, the function, rather than what it returns? Also When

Getter an lvalue and cannot be modified

2018-05-27 Thread IntegratedDimensions via Digitalmars-d-learn
C[] c; @property C[] get() { return c; } get ~= something; errors out, yet auto q = get; q ~= something; is fine. Why is D thinking that ~= is being applied to get, the function, rather than what it returns? Also When I converted a field in to a property, an AA, it is returning null

Re: Getter an lvalue and cannot be modified

2018-05-27 Thread IntegratedDimensions via Digitalmars-d-learn
On Sunday, 27 May 2018 at 09:28:36 UTC, Mike Franklin wrote: On Sunday, 27 May 2018 at 09:23:09 UTC, IntegratedDimensions wrote: C[] c; @property C[] get() { return c; } get ~= something; errors out, yet auto q = get; q ~= something; is fine. Why is D thinking that ~= is being applied to

Re: Why 'getSymbolsByUDA' filters private members?

2018-05-27 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 27 May 2018 at 17:42:15 UTC, Sobaya wrote: I'd like to get symbols that have an UDA. But when the member is private, it is not obtained. And I found a comment saying "Filtering inaccessible members" in the source. Why is it necessary to filter out private members? Since the

Re: Getter an lvalue and cannot be modified

2018-05-27 Thread Mike Franklin via Digitalmars-d-learn
On Sunday, 27 May 2018 at 23:21:05 UTC, IntegratedDimensions wrote: I came across a few posts mentioning this after the fact. It's been this way since at least 2012 so... It's now may so not sure how much longer we'll have to wait. That pull seems to have stalled. So close but so far away ;/

Re: Code repetition

2018-05-27 Thread IntegratedDimensions via Digitalmars-d-learn
On Sunday, 27 May 2018 at 13:20:08 UTC, Adam D. Ruppe wrote: On Sunday, 27 May 2018 at 06:47:38 UTC, IntegratedDimensions wrote: Putting the code in a template/function/lambda does not work because of the scopes which will be called when the main function exists. I think you might just be

using wkhtmltopdf with D

2018-05-27 Thread Dr.No via Digitalmars-d-learn
I'm trying to use wkhtmltopdf[1] with D. I converted this header[2] with little modification using htod tool which resulted in this[3]. The libray is passed to link using: pragma(lib, "wkhtmltox.lib"); (that file is in wkhtmltopdf\lib folder) and the module imported with: import pdf; but it

Re: using wkhtmltopdf with D

2018-05-27 Thread sarn via Digitalmars-d-learn
On Monday, 28 May 2018 at 01:28:10 UTC, Dr.No wrote: What's likely the reason of the crash? mismatch between D and C memory alignment? From an ABI point of view, the raw pointers won't care about the memory structure they point to. The function call is the only thing that depends on the

Re: using wkhtmltopdf with D

2018-05-27 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 28 May 2018 at 01:28:10 UTC, Dr.No wrote: I'm trying to use wkhtmltopdf[1] with D. I converted this header[2] with little modification using htod tool which resulted in this[3]. The libray is passed to link using: pragma(lib, "wkhtmltox.lib"); (that file is in wkhtmltopdf\lib

Re: Naming conventions for export and import members of a struct

2018-05-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 27, 2018 21:54:42 Per Nordlöw via Digitalmars-d-learn wrote: > The integer type in gmp-z just got export (binary serialization) > support at > > https://github.com/nordlow/gmp-d/pull/8 > > Next up is import (binary deserialization). > > What's the preferred D-style naming convention

Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread rikki cattermole via Digitalmars-d-learn
On 28/05/2018 1:02 AM, loloof64 wrote: Hello everyone, I've just completed the language tour, and I am starting a tutorial in order to use Gtk binding. But somewhere, they use the 'in' keyword for the constructor : (https://sites.google.com/site/gtkdtutorial/#chapter2 : in section 3 for

Re: Any way to override base type with dervived in derived type

2018-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/25/18 4:02 PM, IntegratedDimensions wrote: So, I upgraded everything, tried to add the setter and get an compile time access violation: override @property T t(T v) { _t = v; return v; } Changing T v to TT v gives the violation override @property T t(TT v) { _t = v; return v; }

What's the purpose of the 'in' keyword ?

2018-05-27 Thread loloof64 via Digitalmars-d-learn
Hello everyone, I've just completed the language tour, and I am starting a tutorial in order to use Gtk binding. But somewhere, they use the 'in' keyword for the constructor : (https://sites.google.com/site/gtkdtutorial/#chapter2 : in section 3 for Buttons and Callbacks, main.d snippet).

Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2018-05-27 at 13:10 +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Sunday, 27 May 2018 at 13:02:23 UTC, loloof64 wrote: > > What's the purpose of this 'in' keyword ? I could not process a > > good Google request to get an answer. > > It means you are taking the parameter in to

Re: What's the purpose of the 'in' keyword ?

2018-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 May 2018 at 13:02:23 UTC, loloof64 wrote: What's the purpose of this 'in' keyword ? I could not process a good Google request to get an answer. It means you are taking the parameter in to look at, but not modify or store. Basically "const". (well, for now, literally "const"

Re: Conditionally set nothrow: for a block of code.

2018-05-27 Thread Uknown via Digitalmars-d-learn
On Thursday, 24 May 2018 at 18:51:31 UTC, Mike Franklin wrote: I'm trying to find a way to declare a block of code `nothrow:` when compiling with -betterC, but not `nothrow` when not compiling with -betterC. The solution is needed for this PR: