« first day (1687 days earlier)      last day (3275 days later) » 

user1804599
10:00 PM
I want roof tiles made out of white phosphorous coated in alkali metals.
 
Xeo
@sehe Maybe you know. What's the point of polymorphic[_{relaxed, strict}]_get for variant?
 
I rant woof
 
Xeo
Is that just some old naming retained for compatibility?
 
@Xeo nah. They're pretty new, right. I just read about that in a glance recently
 
Xeo
The docs don't tell me anything :/
They seem like they're just another name for get
 
10:02 PM
Trying to remember my understanding doesn't really work.
 
Xeo
> boost::polymorphic_strict_get — Retrieves a value of a specified type from a given variant.
> boost::strict_get — Retrieves a value of a specified type from a given variant.
 
:D
Great docs, lol.
 
Xeo
I have no clue what the difference is supposed to be, if there's any
also, lol the relaxed versions
why the fuck do those even exist.
 
Pointing at the build directories instead of install directories helped a bit. Now I have different problems (`cannot open file clangFrontend.lib`, also lotsa compiler errors)
, but for now I think I may have built Clang wrong, so I'll try investigating Clang next.
 
@Xeo I suppose the strict versions get only if the type exactly match, polymorphic could e.g. get a MoreDerived& when you ask for Base&, and maybe if you ask for a Base& and the variant contains value elements Derived1, Derived2 it'll work?
 
10:04 PM
did you build as x64
 
Xeo
@sehe Oh yeah, now that you mention that. Maybe.
I guess I remember reading something like that?
Fuck those docs, though.
 
@Puppy I'm not quite sure, I also suspect this may be the issue.
 
> Recomendation: Use polymorphic_get in new code without defining BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT. In that way polymorphic_get provides more compile time checks and it's behavior is closer to std::get from C++ Standard Library. boost.org/doc/libs/1_58_0/doc/html/boost/polymorphic_get.html
 
@milleniumbug LLVM's build system is a bit dodgy when it comes to building as x64 and I don't know if I ever got around to accounting for all of the kinks.
 
Anyhoops. I reckon it's not really required interface. (In git terms, the plumbing?)
 
10:06 PM
I know that for ... some reason ... I pretty much never even attempt to build Wide as x64 on Windows.
 
Xeo
@sehe It's part of the public interface anyways :/
template<class T>
boost::optional<T&> optional_pointer(T* pointer)
{
    if (pointer != nullptr)
        return *pointer;
    return boost::none;
}
better names welcome
 
I wish I could tell godbolt to stop autocompiling... so annoying
 
@Xeo make_optional_ref?
 
@Xeo pointer_maybe_not
 
I think that the output they use does not account for all the settings you can use in the build, so you can't have LLVM built for several targets on Windows, or something like that.
 
10:09 PM
@Xeo optional_pointer sounds like a pointer that's optional, optional_from_pointer is more clear.
 
Today's unnecessary gendered product #everydaysexism http://t.co/bCGeKHW2B1
Wow. "Politisches Kartenbild" lel
 
I don't like the _pointer part because it does not construct a pointer
 
Xeo
@milleniumbug but so long! :P
 
it's not misleading
 
Xeo
I also had simply to_optional in mind.
 
10:10 PM
I don't see why you'd want boost::optional<T&> . T* serves that role well.
 
that does not communicate the pointer -> reference transformation though
 
@Xeo as_optional (to_optional implies a conversion)
 
Xeo
@sehe hm, good point.
I like my as_ functions. (as_lvalue, as_const, etc)
 
ass_optional
 
Ell
@StackedCrooked nor me
 
Xeo
10:11 PM
Yeah, ass is an optional requirement for me
 
as_optional suggests you're just boxing the thing inside an optional object
 
Instead of naming functions x_to_y, I do y_from_x
 
Ell
I guess T* is also (mis)used as many other things though
 
there's a transformation going on here
 
@Xeo I sometimes use that prefix as well.
 
10:13 PM
@Xeo not for me
 
Xeo
@StackedCrooked Semantic intentions
 
Ok. I'll stop asking then :)
 
@AndyProwl which is what you do. The pointer->ref thing is a convention already in place
 
Xeo
template<class T, class... Ts>
boost::optional<T&> get_optional(boost::variant<Ts...>& variant)
{
    return as_optional(boost::get<T>(&variant));
}
also, that ^
 
@StackedCrooked T* is "interacting with legacy code" or "interacting with C API" for me.
 
10:13 PM
@Xeo Better
 
Xeo
@milleniumbug It's just "non-owning pointer" for me.
or "nullable reference", if you will.
 
Ven
@FilipRoséen-refp uh -- then, I'm not sure why it compiled?
 
@Ven what did compile?
@Ven I think you constructed your testcase backwards
 
Ven
@FilipRoséen-refp the example
oh
 
@Ven remove the template that takes a T const&, and it fails to compile (since you cannot construct a T* from an int) - that is what that particular sentence is saying
 
Ven
10:16 PM
oooh. I probably did then, thanks for the precision :).
Great read as expected.
 
@Ven no worries
@Ven and thanks
 
The asm generated between aggregate init and manually assigning members is different. I am going ignore my complete lack of knowledge in asm and conclude aggregate init is more effecient
https://goo.gl/GXsX6Q
 
Xeo
@sehe And the naming is consistent with ptree::get_optional :D
 
@sehe I'm not sure what "convention already in place" means. It's a non-trivial transformation, as_ functions should not do that IMO
 
@Xeo That's never a good sign
 
Xeo
10:17 PM
@AndyProwl It's very trivial, I find.
 
My interfaces return T* to indicate they can be null. Otherwise they would return T&. Codebase improved soo much once we started applying this rule consistently.
 
@AndyProwl It's a convention in place in Boost Optional (and I believe in std::optional proposals).
 
@sehe Oh
well, in that case I understand why one would want it, but I still don't think it's correct
 
Xeo
boost::optional<T&> might be seen as simply another view of T*
So as_optional just changes the viewpoint
 
@AndyProwl I agree it's slightly odd. But it's not very dissimilar from dynamic_cast<T*> vs dynamic_cast<T&>
 
10:19 PM
nvm i think its the same
 
@Prismatic They're not equivalent- in the second one you inserted more members into the vector. If you make them actually equivalent then the assembly output looks the same to me.
 
Xeo
There's also get_pointer(opt). get_optional is for subobject access, though, I feel.
 
Does it really need to return boost::optional<T&> or can it be another type as long as the behavior is the same?
 
@Xeo Yes that's true, but I feel it's on a different level than as_const or as_rvalue aka std::move
 
Xeo
@StackedCrooked I just want it to return boost::optional.
 
10:21 PM
@sehe then how would you call the operation that given a T, creates an optional<T>? I feel that should be as_optional
 
so the optional is non-negotiable?
 
Xeo
@AndyProwl make_optional (really, it should be return or pure :D)
@StackedCrooked Yeah, pretty much. :P
I just like optional<T&> more to show the intention.
 
@Xeo make_optional would then create an optional from T, while as_optional would create an optional<T&> from a T*. This is not very intuitive
 
@Xeo that
 
@Xeo oh, I definitely concur on return and pure
 
10:23 PM
@AndyProwl Nothing here is. References and pointers are historically abused too much. I feel
@AndyProwl that
 
ok I agree on make_optional as a C++-ish name for pure, but I still don't like as_optional for T* -> optional<T&>. OTOH if it's a Boost/TS convention, I'll go dislike it in a corner :)
 
Xeo
Dunno about a convention
as_ functions, for me, changes the view on something. And I consider optional-ref as another view of pointers, so that. Not that I'm completely happy with the name, to be fair.
But optional_from_pointer is so long. :<
 
Uh
 
@Xeo Boost does have optional<T> boost::get<T>(variant*) AFAIR
 
make_optional doesn't turn T* to T&.
the std::optional anyway
 
10:27 PM
@Rapptz we were not claiming that
 
Xeo
@sehe It does?
 
> AFAIR
 
@AndyProwl not sure what you guys are talking about then
what convention in place?
I don't see anything that turns T* to optional<T&>
or vice versa
 
@Xeo Am I mixing things up now that we have seen so many alternative forms... :(
 
Xeo
@sehe Because that's the thing I want, and I couldn't find it
all get{stuff} variants for variant return U& or U* :<
 
10:29 PM
@Xeo Yeah. Lemme look again. No definitely mixing stuff up. Prolly meant Tn* boost::get<Tn>(variant<T1,T2,... Tn>*)
 
user1804599
Covalent bonds are like shared pointers.
 
@Rapptz The question was how to name a function that takes a T* and turns it into an optional<T&>, with none being returned if the pointer is null. Xeo suggested as_optional, which I disliked. To explain why, I suggested as_optional should just take a T and wrap it in an optional<T> (basically the equivalent of monadic return), but then Xeo claimed make_optional is a better name for that, and I agreed with that
 
@Rapptz not with that attitude
2
 
I still like make_optional_ref
 
why would you turn T* to optional<T&> though
 
10:30 PM
or no wait, as_optional_ref
 
Ell
@rightfold a shared pair of electrons? :v
 
Xeo
@AndyProwl oh, that's not too bad
 
@Rapptz hi
 
user1804599
@Ell :(
 
hi
 
10:30 PM
Nice of you to drop by
 
Xeo
@Rapptz Because I want an optional, but boost::get<T>(&variant) only gives me a pointer.
 
Ell
@rightfold :)
 
@Xeo I agree the make_ in my original suggestion was inappropriate, based on what you wrote further on
 
Xeo
I could live with as_optional_ref
 
@Xeo I see.
 
10:31 PM
I like the boost::get api.
It's quite clever and simple to use.
 
Xeo
Well I don't! Anymore.
 
Name it optional_ref.
 
Xeo
I doesn't have what I want :P
 
@StackedCrooked I don't. The problem is it's way overused (property maps, boost graph, optional, tuple etc.)
@StackedCrooked I like the concept. And the power it brings (free functions for the win). But it's really hard to know what get<X>(y) is actually doing in a given context
 
You will know eventually!
 
10:33 PM
And given ADL it's very hard (sometimes impossible) to control what it should be doing
 
At runtime :)
 
@sehe Ah, ADL.
 
@StackedCrooked At runtime, things are even harder to tell
 
@Xeo this doesn't actually happen fyi
but yeah I chuckled
fuck that quest too
I hate it
 
10:34 PM
you checkled
 
Xeo
@Rapptz I guessed as much. Would be kinda weird to do it.
 
using Work = std::vector<std::function<void()>>;
void begin(Work&); // begins the work

void test(Work work) {
    begin(work); // dammit why don't it start the work
}
 
Xeo
hahaha
 
@StackedCrooked erm. yeah. that
std::get(it)
@StackedCrooked in fairitude, wouldn't that be "ambiguous call"?
 
Oh.
 
Xeo
10:36 PM
@StackedCrooked Discarded result warnings would be neat sometimes.
 
std::get reads like std get.
I feel slow
 
@sehe Afaik, no.
ADL precedes name lookup IIRC.
 
Xeo
> fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\ehexcept.c', line 1077)
:(
 
sehexcept.c
 
Xeo
memo: Don't std::make_exception_ptrs inside list-init.
 
10:39 PM
hey guys, do I describe this kind of interface as API or ABI?: an IC is communicated by 8-bit commands through serial interface.
 
@milleniumbug I take exception with that
@user14042 neither. It's protocol.
 
cool. I see thanks
 
@sehe Hm, maybe std::begin uses some kind of anti-adl mechanism?
  template<class _Container>
  inline auto begin(_Container& __cont) -> decltype(__cont.begin())
  { return __cont.begin(); }
Doesn't seem like it does.
 
hmm.. what are you talking about?
 
10:45 PM
@StackedCrooked Nah. It's more subtle, as usual: coliru.stacked-crooked.com/a/2ca65dab6f333de2
 
@FilipRoséen-refp Why adl was not trigged in @sehe's sample
 
Find the simple difference!
non-const& is a better match than const&
 
@StackedCrooked see what @sehe just wrote, it is all about which function is the best match
 
@sehe const
 
what the fuck
 
10:47 PM
@StackedCrooked This is the same pitfall that makes univ-reference constructor templates overrule a copy constructor, even if it exists
 
C++ I hate you
 
@StackedCrooked ADL just adds function to the list overload resolution goes through, it doesn't disregard other functions
 
Xeo
Oh wait
no
 
Make ADL explicit :D
 
:23606076 that is not correct
 
Xeo
10:48 PM
Yep
 
std::sort(@begin(array), @end(array)); :P
 
Xeo
std::begin(Cont&) is a template, so it's a worse match than begin(Work&)
 
@Xeo unless the instantiation ends up being the same but for the const& vs &
 
Xeo
@sehe Yeah.
 
In which case std::begin is the best match :)
I love C++
 
Xeo
10:49 PM
The "is one a template" is a tie-breaker
there's no tie to break if a qualification conversion is involved in one of the overloads.
 
well.. I wouldn't really say that though
 
:23606072 ADL usually beats the normal name lookup rules in my experience.
 
anyone, time to make me some coffee
@StackedCrooked your experience seems rather weird
 
Xeo
nope, no time to make you coffee
 
@FilipRoséen-refp weird, but fun!
 
10:51 PM
@StackedCrooked it seems to disregard the rules of the language, but heck yes - C++ is fun weird
blargh, I am writing a section on direct-initialization and I'm struggling to explain it without also explaining other forms of initialization.. I mean, I can't write about all of them
it would be so much easier if one could just say; "here is the standard, read it"
@Xeo well played.
 
@Xeo Ah. Now I get it.
 
Xeo
@FilipRoséen-refp You kinda have to explain direct-initialisation and copy-initialisation in tandem, I feel.
list-init can be left out for now, since it piggy-backs on the other two
 
@Xeo what do you think of something such as this?
the current grammar is quite crappy, but I will get around to fixing that.. later
 
what's your audience?
people who don't know, or just people who need a refresher?
 
@AndyProwl people who kind of knows, like the contents of the other articles
 

« first day (1687 days earlier)      last day (3275 days later) »