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

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Jun 16 22:23:59 UTC 2018


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 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)
> >>
> >> std.traits.hasStaticMember ?
> >>
> >> https://dlang.org/phobos/std_traits.html#hasStaticMember
> >
> > Yeah. I wrote that, and it got added to Phobos. If you'll note,
> > my post in this thread was from almost two years ago.
>
> Haha! I usually don’t get caught with these old threads!

It's _really_ obvious in my e-mail reader, since I have threading turned on,
and it the threads are sorted by the date of the first post in the thread,
so the thread is way up in the list such that I'm only likely to even notice
that such a post has been made if I tell my client to filter out read
e-mails so that I can find the e-mails that I haven't read yet which aren't
at the bottom where all of the recent stuff is. Someone could have replied
in an old thread and really want me to respond, and I could easily not
notice the message for weeks if I'm not trying to get the unread count down
to zero and notice that once I've caught up with all of the recent messages,
the number is still greater than zero.

I kind of wish that the forum software discouraged against necro-ing threads
like this, since they're easy for many of us to miss, and once someone
replies to them and brings them to the front of the list in the forum
software, folks tends to reply as if the thread were recent without noticing
how old it is.

- Jonathan M Davis




More information about the Digitalmars-d-learn mailing list