typeof on protected field

2018-06-16 Thread DigitalDesigns via Digitalmars-d-learn
mixin(`foo!(typeof(T.`~m~`)); gives me an error about m being protected. Error: class `X` member `name` is not accessible. this also happens when using __traits(getMember, T, m); X is in another module. Works fine when X is in the same module. I need to get the protected and private members

Re: Can't start application on heroku

2018-06-16 Thread crimaniak via Digitalmars-d-learn
On Saturday, 16 June 2018 at 09:00:21 UTC, Jacob Shtokolov wrote: On Saturday, 16 June 2018 at 01:24:04 UTC, crimaniak wrote: Hi all! The first try to host application on Heroku provider. The application is started and starts to listen in 3 seconds on the port, provided by

Re: Storing temp for later use with ranges

2018-06-16 Thread Timoses via Digitalmars-d-learn
On Saturday, 16 June 2018 at 01:53:15 UTC, DigitalDesigns wrote: Does ranges have the ability to store a temp value in a "range like way" that can be used later? The idea is to avoid having to create temp variables. A sort of range with "memory" I believe that if the range is a forward

Re: Class qualifier vs struct qualifier

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 07:13:28 Timoses via Digitalmars-d-learn wrote: > On Thursday, 14 June 2018 at 17:07:09 UTC, Jonathan M Davis wrote: > > Sure, it would save you a little bit of typing when you do > > something like > > > > auto foo = new Foo; > > > > if makes it immutable for you, but

Re: Get static fields!

2018-06-16 Thread Bauss via Digitalmars-d-learn
On Saturday, 16 June 2018 at 05:05:19 UTC, DigitalDesigns wrote: tupleof does not return static fields as does not Fields. Currently the only method seems to be use allMembers, but that returns members requiring filtering, which there is no good filtering checks. I'd simply like to get all the

Re: Get static fields!

2018-06-16 Thread DigitalDesigns via Digitalmars-d-learn
On Saturday, 16 June 2018 at 07:56:22 UTC, Bauss wrote: On Saturday, 16 June 2018 at 05:05:19 UTC, DigitalDesigns wrote: tupleof does not return static fields as does not Fields. Currently the only method seems to be use allMembers, but that returns members requiring filtering, which there is

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Bauss via Digitalmars-d-learn
On Saturday, 16 June 2018 at 08:52:20 UTC, DigitalDesigns wrote: On Saturday, 30 July 2016 at 13:04:56 UTC, Ali Çehreli wrote: On 07/30/2016 05:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > I'm writing some serialization code where I need to skip static variables. > So, I have a

Re: Class qualifier vs struct qualifier

2018-06-16 Thread Timoses via Digitalmars-d-learn
On Thursday, 14 June 2018 at 17:07:09 UTC, Jonathan M Davis wrote: Sure, it would save you a little bit of typing when you do something like auto foo = new Foo; if makes it immutable for you, but it's at the cost of code clarity. Why should it even? Isn't immutable class C {

Re: Can't start application on heroku

2018-06-16 Thread Jacob Shtokolov via Digitalmars-d-learn
On Saturday, 16 June 2018 at 01:24:04 UTC, crimaniak wrote: Hi all! The first try to host application on Heroku provider. The application is started and starts to listen in 3 seconds on the port, provided by heroku-buildpack-d. But the server doesn't detect listening and stops the

Re: foreach DFS/BFS for tree data-structure?

2018-06-16 Thread Timoses via Digitalmars-d-learn
On Thursday, 14 June 2018 at 11:31:50 UTC, Robert M. Münch wrote: I have a simple tree C data-structure that looks like this: node { node parent: vector[node] children; } I would like to create two foreach algorthims, one follwing the breadth first search pattern and one the

Re: typeof on protected field

2018-06-16 Thread bauss via Digitalmars-d-learn
On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: mixin(`foo!(typeof(T.`~m~`)); gives me an error about m being protected. Error: class `X` member `name` is not accessible. this also happens when using __traits(getMember, T, m); X is in another module. Works fine when X is in

Re: How do you test whether a variable is static or not?

2018-06-16 Thread DigitalDesigns via Digitalmars-d-learn
On Saturday, 30 July 2016 at 13:04:56 UTC, Ali Çehreli wrote: On 07/30/2016 05:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > I'm writing some serialization code where I need to skip static variables. > So, I have a symbol from a struct, and I'd like to test whether it's static > or

Re: typeof on protected field

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 13:12:13 bauss via Digitalmars-d-learn wrote: > On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: > > mixin(`foo!(typeof(T.`~m~`)); > > > > gives me an error about m being protected. > > > > Error: class `X` member `name` is not accessible. > > > > this

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via Digitalmars-d- learn wrote: > On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > > I'm writing some serialization code where I need to skip static > > variables. So, I have a symbol from a struct, and I'd like to test

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 16 June 2018 at 21:41:37 UTC, Jonathan M Davis wrote: On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via Digitalmars-d- learn wrote: On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > I'm writing some serialization code where I need to skip > static

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: I'm writing some serialization code where I need to skip static variables. So, I have a symbol from a struct, and I'd like to test whether it's static or not. Ideally, I'd be able to do something like is(field == static)

Re: Create an Algebraic type at compile time and more

2018-06-16 Thread uknys via Digitalmars-d-learn
On Friday, 15 June 2018 at 12:03:28 UTC, Simen Kjærås wrote: On Friday, 15 June 2018 at 10:53:35 UTC, uknys wrote: On Friday, 15 June 2018 at 07:27:22 UTC, Simen Kjærås wrote: [snip] Yeah I saw that Algebraic doesn't work at compile time, then I thought of using an Interface with one

Re: What is the point of nothrow?

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 18:45:53 wjoe via Digitalmars-d-learn wrote: > What you said earlier: > > On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > > [...] > > > > 2. If the compiler knows that a function can't throw an > > Exception, then it doesn't have to insert any of the

Re: Quick Refresher book?

2018-06-16 Thread arturg via Digitalmars-d-learn
On Saturday, 16 June 2018 at 23:33:18 UTC, Aedt wrote: Hello, I was wondering if there's any quick refresher resource to brush up on my D after a long time? Is there a short and quick language reference book like "A Tour of C++"? if you havent seen it yet, there is the dlang tour

How to list all the manifest constants in a class or struct

2018-06-16 Thread Heromyth via Digitalmars-d-learn
Here is a struct named S: struct S { enum X = 10; enum Y { i = 10 } enum Z = "str"; struct S {} class C {} static int sx = 0; __gshared int gx = 0; shared void g(); } I want list all then the

Re: typeof on protected field

2018-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: I need to get the protected and private members for serialization. This breaks encapsulation. A better design would be to have a class know how to serialize itself via a serializable interface.

Re: How to list all the manifest constants in a class or struct

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 17, 2018 02:44:38 Heromyth via Digitalmars-d-learn wrote: > Here is a struct named S: > > struct S > { > enum X = 10; > enum Y > { > i = 10 > } > enum Z = "str"; > struct S {} > class C {} > > static int sx = 0; > __gshared int gx = 0; > > shared void

multiqualifier

2018-06-16 Thread sclytrack via Digitalmars-d-learn
I'm going to post this in learn in order not to disturb "the guys". Multiqualifiers --- Warning: Stop reading if you don't have time. Tail-const rant in disguise. (1) Going from immutable to mutable, one layer deep. --- In the D programming

Re: What is the point of nothrow?

2018-06-16 Thread wjoe via Digitalmars-d-learn
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: On Thursday, June 14, 2018 18:11:20 wjoe via Digitalmars-d-learn wrote: On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis wrote: > On Wednesday, June 13, 2018 10:56:41 wjoe via > The idea is that because your program

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 22:11:09 Steven Schveighoffer via Digitalmars-d- learn wrote: > On Saturday, 16 June 2018 at 21:41:37 UTC, Jonathan M Davis wrote: > > On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via > > > > Digitalmars-d- learn wrote: > >> On 7/30/16 8:47 AM, Jonathan M

Re: How do you test whether a variable is static or not?

2018-06-16 Thread DigitalDesigns via Digitalmars-d-learn
On Saturday, 16 June 2018 at 21:41:37 UTC, Jonathan M Davis wrote: On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via Digitalmars-d- learn wrote: On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > I'm writing some serialization code where I need to skip > static

Re: How do you test whether a variable is static or not?

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 22:56:38 DigitalDesigns via Digitalmars-d-learn wrote: > On Saturday, 16 June 2018 at 21:41:37 UTC, Jonathan M Davis wrote: > > On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via > > > > Digitalmars-d- learn wrote: > >> On 7/30/16 8:47 AM, Jonathan M Davis via

Quick Refresher book?

2018-06-16 Thread Aedt via Digitalmars-d-learn
Hello, I was wondering if there's any quick refresher resource to brush up on my D after a long time? Is there a short and quick language reference book like "A Tour of C++"?