These are chat archives for boostorg/hana

8th
Apr 2017
Louis Dionne
@ldionne
Apr 08 2017 17:31
Omg, the complexity of these pair and tuple classes is MINDBLOWING. I so wish we had a language construct for those instead.
Jason Rice
@ricejasonf
Apr 08 2017 18:28
does any language do that?
Louis Dionne
@ldionne
Apr 08 2017 18:41
I think so, yeah. D, Haskell, Ocaml?
Python
Think of (a, b, c) in Python. It’s a tuple.
Jason Rice
@ricejasonf
Apr 08 2017 18:42
ah I see
Louis Dionne
@ldionne
Apr 08 2017 18:44
Essentially, we need a compile-time list of values to be implemented in the compiler. Like parameter packs, but with more functionality (we can barely do anything with parameter packs beyond unpacking them).
Jason Rice
@ricejasonf
Apr 08 2017 21:58
The inverse operation of __type_pack_element as a builtin would be really interesting for maps. something like constexpr size_t i = __type_pack_index<T, Pack...>
kind of like the proposed index_of that takes a key instead of a predicate
Jason Rice
@ricejasonf
Apr 08 2017 22:09
I might take a stab at it.. but probably after May
Jason Rice
@ricejasonf
Apr 08 2017 22:20
even better would be to use an actual map like using Value = __type_map_lookup(Key, Pairs...)
but that would be just a friendlier interface and then you have to create pairs
Louis Dionne
@ldionne
Apr 08 2017 22:54
Hmm. In the future, actually, we should be able to write those primitives using constexpr metaprogramming on types.
Basically find_if on a constexpr std::vector of meta::types. That would be neat.