These are chat archives for boostorg/hana

20th
Jun 2016
Barrett Adair
@badair
Jun 20 2016 01:06
@ldionne I used Hana to answer a StackOverflow question about reflection. I'm sure it's a duplicate question, but I wanted the Internet points. Then I tried to address the "big scary dependency" myth.
Louis Dionne
@ldionne
Jun 20 2016 01:21
@badair Good answer.
Barrett Adair
@badair
Jun 20 2016 01:22

In fact, I believe this example doesn't even require Boost at all (so you can use Hana without Boost in this case).

Was this accurate?

Louis Dionne
@ldionne
Jun 20 2016 01:23
Yes, it is.
Unless mistake, of course.
Barrett Adair
@badair
Jun 20 2016 01:25
I didn't add BOOST_ROOT when I compiled, so I think it's good.
Louis Dionne
@ldionne
Jun 20 2016 02:03
Then it’s good.
Alternatively, you could try compiling with boost/hana.hpp. If it works, it does not need boost.
Hana sees the rest of Boost as “an external library”, and the master header only includes what’s in Hana per-se.
Barrett Adair
@badair
Jun 20 2016 05:03
@ldionne (off-topic?) I had an interesting argument about pointer arithmetic UB in the comments of the top answer from the SO link earlier. If you happen to go back and read it, I'd be curious to know your interpretation of the standard for this situation. Don't upvote me -- I probably went a little overboard with the FUD anyway :)
Louis Dionne
@ldionne
Jun 20 2016 05:21
I don’t have time to read the relevant standard sections right now, and it would be irrelevant IMO as the spirit of the question is not that anyway. Alf gave a shitty answer, no matter the way you look at it. That’s just my opinion.
Or rather; the question was really about only string fields, but an appropriate answer would not have taken that into account. The OP is most likely a poor student (or an even more poor beginning programmer), and the last thing that person needs is what Alf gave him; a half baked ready-to-break solution.
His answer would have been perfect for a language lawyer that’s only interested into knowing that you can reinterpret_cast a struct as you wish, but clearly that’s not what the OP was. The OP was just trying to get a sane solution to his problem, and going the reinterpret_cast way is not that.
All that, IMO.
Barrett Adair
@badair
Jun 20 2016 05:27

it would be irrelevant IMO as the spirit of the question is not that anyway

True. I kinda regret getting into that discussion, since it was extremely pedantic.

an appropriate answer would not have taken that into account

I agree. I always like the generic answers, since that's often what future readers want. Thanks for the feedback. Do you prefer private Gitter messages for off-topic stuff? I just realized Gitter has them

Louis Dionne
@ldionne
Jun 20 2016 05:29
I think private Gitter would be more appropriate, but no worries. And don’t regret getting into the pedantic discussion; I would have done the same, but after the fact I can say that it was probably beside the point.