Boost logo

Boost :

Subject: Re: [boost] [Hana] Formal review for Hana
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-06-17 09:47:37


Paul Fultz II <pfultz2 <at> yahoo.com> writes:

>
> > > If you find the chaining much cleaner, then perhaps you could make it a
> > > pipable function instead:
> > >
> > > int_<10> | times([]{ std::cout << "foo" << std::endl; });
> > >
> > > This way it could still apply to any IntegralConstant.
> > « []
> >
> > That's an interesting idea. However, Hana does not have a concept of
> > pipable function, so that would need to be added somehow.
>
> Well, if you use Fit in the future, then Fit already provides the mechanism
> for that.
>
> > Sure, but a proper library-based Optional allows one to represent failures
> > caused by more than invalid expressions, which I think is more generally
> > useful. For example, you can define a safe division that ret¹Ì¹½Ñ¡¥¹€(ø€øÝ¡•¸å½Ô‘¥Ù¥‘”‰äé•É¼¸UÍ¥¹œM%9™½ÈÑ¡¥ÌÍ••µÌ±¥­”ÕÍ¥¹œ„¡…µµ•È(ø€øÑ¼(ø€øÍÉ•ÜÍ½µ•Ñ¡¥¹œ¸±Í¼°=ÁÑ¥½¹…°…±±½Ý́µ½É”Í½Á¡¥ÍÑ¥…Ñ•½Á•É…Ñ¥½¹Ì±¥­”(ø€ø(ø€ø€€€€ÑÉ…¹Í™½É´¡½Áа˜¤€´ø…ÁÁ±¥•Ì˜Ñ¼Ñ¡”½ÁÑ¥½¹…°Ù…±Õ”¥˜¥Ð¥ÌÑ¡•É”°(ø€ø…¹(ø€ø€€€€€€€€€€€€€€€€€€€€€€€€€É•ÑÕɸ©ÕÍСѡ”É•ÍձФ½È¹½Ñ¡¥¹œ¸(ø€ø€€€€™¥±Ñ•È¡½ÁаÁÉ•¤€´ø­••ÀÑ¡”½ÁÑ¥½¹…°Ù…±Õ”¥˜¥Ð¥ÌÑ¡•É”…¹¥Ð(ø€ø€€€€€€€€€€€€€€€€€€€€€€€€€Í…ѥ͙¥•ÌÑ¡”ÁÉ•‘¥…Ñ”(ø€ø(ø€ø…¹µ…¹äµ½É”¸ ½µÁ½Í¥¹œ½ÁÑ¥½¹…°Ù…±Õ•Ì±¥­”Ñ¡¥ÌÕÍ¥¹œM%9µ¥¡Ð‰”(ø€ø¡…É‘•È°%,¸(ø(ø$‘½¸ÐÍ•”Ý¡ä¥ÐÝ½Õ±‰”¡…ɐ¸A±ÕÌ°Ñ¡•É”¥Ì„½µÁ¥±”µÑ¥µ”Á•É™½Éµ…¹”(ø‰•¹•™¥Ð°Í¥¹”Ñ¡”½µÁ¥±•ÈÝ¥±°ÍѽÀ…Ёѡ”™¥ÉÍЁÍÕ‰ÍÑ¥ÑÕÑ¥½¸™…¥±ÕÉ”¸()$‘½¸Ð­¹½Ü°$©ÕÍЁ½Õ±‘¸ÐÑ¡¥¹¬½˜„Ý…äÑ¼•…Í¥±ä×ÆVÖVçB6öÖWF†–æp¦Æ–¶RF†R6ö×–ÆR×F–ÖR6Æ7VÆF÷"B³ÒW6–ær&r4d”äRâ’F†–æ²—B—2V6–W §Fòw&4d”äR&V†–æBâö&¦V7BæBFòW6R7GVÂgVæ7F–öç2FòÖæ—VÆFRF†—0¦ö&¦V7B&F†W"F†â÷W&F–ærBF†R4d”äRÖÆWfVÂF—&V7FÇ’ÂWfVâF†÷Vv‚F†—0§7W&VÇ’v—fW26ö×–ÆR×F–ÖR&VæVf—Bâ’vÒæ÷B6––ær—Bw2–×÷76–&ÆRÂ’vÒ§W7@§6––ær—BæVVG2Æ÷BÖ÷&R7&VF—f—G’F†âW6–ærâ÷F–öæÂö&¦V7BÀ¦W7V6–ÆÇ’6–æ6R2²²&öw&ÖÖW'2v–ÆÂ&RfÖ–Æ–"v—F‚F†R'VçF–ÖR6öæ6W@§v†Vâ7FC£¦÷F–öæÂvWG2–âà  £à£ââà£âââvW6öÖRâ†fR–÷RF†÷Vv‡B&÷WBW6–ærF–ffW&VçBFö7VÖVçFF–öâFööÀ£âââ–ç7FVBÂÆ–¶RÖ¶Fö72÷"7†–çƒð£ââ *²µÐ£âà£ââ–W2Â’vÒ7W'&VçFÇ’6öç6–FW&–ær7v—F6†–ærv’g&öÒF÷‡–vVââF†÷Vv‚’Föâw@£ââ¶æ÷rv†B’vB7v—F6‚Fòâ’†fRÆÖ÷7BöæÛ™H™\]Z\™[Y[È]BˆˆØÝ[Y[][Ûˆ™HÜš][ˆ[ˆHÛÝ\˜ÙHÛÙK‚‚ˆÙ[H\ÙHZÙØÜț܈š] [™HÜš]H^HØÝ[Y[][Ûˆ[ˆHÛÝ\˜ÙHÛÙKˆ]H]™HHØÜš\]Û\œÈ[H\ ˆ\š\ËZÙØÜÈÛÝ[™H^[™YˆÈÈ\È]]ÛX]XØ[K‚‚’HÛÚÙY][Ý\ˆÙ]\[™Hš[™]]Z]HšXÙKˆÝÙ]™\‹IÛHÛÜœšYYX›Ý]˜HÛÝ\HÙˆ™X]\™\ÈH™YY ˆ›Üˆ^[\K]\ÈÜÜÚX›HÈ[˜ÛYHÛÙBœÛš\]ÈZÙ[ˆœ›ÛHXÝX[š[\ț܈H^[\\ÏÈ[ÛË\È\™HÛÛYB˜Ü›ÜÜË\™Y™\™[˜Ú[™ÈÛÚ[™ÈÛˆ[ˆHÛÝ\˜ÙHÛÙKÛÈ[šÜÈ\™HÙ[™\˜]Y˜]]ÛX]XØ[OÈÝ™\˜[ H[šÈHYXHÙˆ\Ú[™ÈH[\]HÈÙ[™\˜]B˜HÝ]XÈÚ]HZÙH^HÈ\ÈH™\ÝYXH[™] ÜÈH]\™K]IÛBš\ÝÛÜœšYYH›Ú™XÝZYڛݛݚYH[›ÝYÚ™X]\™\È]Ht?

> > > Well, there is several ways it could be formailised, but either `head`
> > and
> > > `tail` do not exist for an empty sequence,
> >
> > I don't want to use SFINAE to determine this. What if we want to support
> > runtime Iterables like std::vector, that only know they're empty at
> > runtime?
>
> Then `is_empty` would be required for runtime sequences.
>
>
> > > or if `tail` always returns an empty sequence even when empty, you just
> > > detect that `seq == tail(seq)`.
> >
> > Well, `tail` will fail when called on an empty sequence. But let's assume
> > this was not the case. You would then be required to implement `==` for
> > your Iterable, which is much more complicated than implementing
> > `is_empty`.
>
> Well you could simply rely on `sèé¥Í}Í…µ•€¸Ё±•…ÍаÑ¡¥Ì½¹±ä…ÁÁ±¥•ÌÑ¼(ø½µÁ¥±”µÑ¥µ”Í•ÅÕ•¹•Ì°¹½ÐÉչѥµ”Í•ÅÕ•¹•Ì¸()µ…­•}ÑÕÁ±”¡¥¹Ñ|ðÄø¤½µÁ…ɕ́•ÅÕ…°Ñ¼µ…­•}ÑÕÁ±”¡±½¹|ðÄø¤°•Ù•¸Ñ¡½Õ Ñ¡•ä)¡…Ù”‘¥™™•É•¹ÐÑåÁ•Ì¸M¼Íѐèé¥Í}Í…µ”Ý½Õ±‘¸Ð‰”•¹•É…°•¹½Õ ¸=Ù•É…±°°$)Ñ¡¥¹¬…Í­¥¹œ™½È¥Í}•µÁÑäÑ¼‰”ÍÁ•¥™¥••áÁ±¥¥Ñ±ä¥ÌÙ•É䁹…ÑÕÉ…°°…¹¥Ð)Í¡½Õ±…±Í¼‰”Ù•É䁕…ÍäÑ¼‘¼¸M…äå½ÔÉ”Ýɥѥ¹œ„±…éäÍÑÉ•…´½ÈÍ½µ”½Ñ¡•È)Í•ÅÕ•¹”•¹•É…Ñ¥¹œÍÑÕ™˜½¸Ñ¡”™±ä¸Ёѡ”µ½ÍЁ‰…Í¥Œ±•Ù•°°Ñ¡•É”…É”Ñ¡É•”)Ñ¡¥¹Ìå½Ô¹••Ñ¼Áɽ٥‘”Ñ¼å½ÕȁÕÍ•ÉÌè(´Ý…äÑ¼•ÐÑ¡”™¥ÉÍЁ•±•µ•¹Ð½˜Ñ¡”ÍÑÉ•…´°¤¹”¸Ñ¡”ÕÉÉ•¹Ð•±•µ•¹Ð¸(€Q¡…Н́ѡ”¡•…‘€™Õ¹Ñ¥½¸¸(´Ý…äÑ¼…‘Ù…¹”Ñ¡”ÍÑÉ•…´‰ä½¹”Á½Í¥Ñ¥½¸°¤¹”¸Ñ¼•ÐÑ¼Ñ¡”¹•áЁ•±•µ•¹Ð¸(€Q¡…Н́ѡ”Ñ…¥±€™Õ¹Ñ¥½¸¸(´Ý…äÑ¼­¹½ÜÝ¡•¸Ñ¡”ÍÑÒ—2FöæR&öGV6–ærfÇVW2à¢F†Bw2F†R—5öV×G–gVæ7F–öâà  £âââââ6öæ6FVæF–ær&ævW2FöW2æ÷BÖ¶R6Vç6Râ†æ&ævR—2£ââ6öçF–wV÷W0£ââââ6WVVæ6Röb6ö×–ÆR×F–ÖR–çFVvW'2âv†B†Vç2v†Vâ–÷P£ââ6öæ6FVæFP£ââââÖ¶U÷&ævRƒö2Â5ö2–v—F‚Ö¶U÷&ævRƒeö2Âö2–ò—Bw2æ÷@£ââââ6öçF–wV÷W2ç–Ö÷&RÂ6ò—Bw2æ÷B&ævRç–Ö÷&Rà£ââà£âââWfVâF†÷Vv‚6öæ6BF¶W2&ævRÂv‡’6âwB—B§W7B&WGW&âGWÆP£ââ–ç7FVCð£ââ *²µÐ£âà£ââ6öæ6Fw26–væGW&R—0£âà£ââÒ…B’‚Ò…B’ÓâÒ…B£âà£ââv†W&RÒ—2ç’ÖöæEÇW2âÖF†VÖF–6ÆÇ’ÂF†—2—26–Ö–Æ"FòF†R÷W&F–öà£ââöbÖöæö–BÂW†6WB—B—2Væ—fW'6ÆÇ’VçF–f–VBöâBâ—Bv÷VÆB&VÆǐ£ââ'&V°£ââF†R6öæ6WGV–çFVw&—G£à£â†÷rFöW2—B'&V²F†R6öæ6WG[YÜš]OÈ\Û‰ÝH\HH[Û˜Y\È\ˆÙ[‚•HH\ÈÈ™HHÚ[™ÛH[™Ëˆ]Ø[‰Ý™HH˜[™ÙH[™H\H]HØ[YB[YKˆ[ˆÝ\ˆÛܙ˂ˆ˜[™ÙJ
H˜[™ÙJ
H Oˆ\J
B‚™Ù\È›ÝX]ÚHÚYÛ˜]\™B‚ˆJ
HJ
H OˆJ
B‚˜]]Ù\ÈX]Ú‚ˆJ
HJ
H OˆJ
B‚‚ˆˆˆÝÈ\È]\ÜÈ\ØX›OÈ]ÙY[\ÈZÙH]ÛÝ[™H[Ü™H\ØX›KÚ[˜ÙHBˆˆˆXœ˜\žHØ[ˆ›ÝÈÝ\ܝÛÛ\[\œÈÚ]›È܈›ZÞH˜\šXX›H[\]\Ë‚ˆˆ0ªÈ×Bˆ‚ˆˆHÚ[\HYX[ˆ][Ï OžßX\È\ÜÈ™]H[ˆ[Ï O˜ ˆ]\ÈÛ™Ù\‚ˆˆžHX›Ý] Ž H[™[ÜÝ[\ܝ[H]Y™X]ÈH[ÜÛÜH]ÙIÜ™BˆˆX[š\[][™ÈØš™XÝË›Ý\\Ë‚‚ˆHÛ‰ÝÙYHÝÈ]œ™XZÜÈH[ÜÛÜKˆ\OŠ
X\È؝š[Ý\ÛH[‚ˆØš™XÝ [™]ÛÚÜÈ]™[ˆ[Ü™HÛÈZÙH[ˆject than a variable template.
> It is only two more characters, and is simpler and cleaner than using the
> variable templates.

I really don't think it's cleaner, but that's subjective.

> > At any rate, compilers other than Clang and GCC are probably missing far
> > too
> > many features (other than variable templates) for them to compile Hana. I
> > don't think variable templates would change much to that.
>
> Well, it might be possible to support compilers such as gcc 4.9 or clang
> 3.4. Obviously, visual studio will be out of the question for at least
> another half of decade.

I have no interest in supporting non-C++14 compilers. Hana is a cutting
edge library, and much of its purpose would be lost if it were to include
workarounds for older compiÉ̸]”É”¥¸€ÈÀÄÔ°…¹½µÁ¥±•É́ݥ±°…э ÕÀ¸()±Í¼°!…¹„ÁɽÁ½Í•Ì„¹•ÜÁ…É…‘¥´¸]”‘½¸Ð­¹½Ü¡½ÜÑ¼™Õ±±äÑ…­”…‘Ù…¹Ñ…”)½˜¥Ð°…¹Ý”‘½¸Ð­¹½ÜÝ¡…Ё…É”¥Ñ́±¥µ¥Ñ́å•Ð¸±½Ð½˜Ñ¥µ”Ý¥±°Á…ÍÌ)‰•™½É”¥ÐÉ•Á±…•ÌÕÍ¥½¸…¹5A0°…¹¥Ðµ¥¡Ð…±Í¼¹•Ù•È¡…ÁÁ•¸¸$ÍÑ¥±°)Ñ¡¥¹¬!…¹„Ý¥±°Íх䁅¸€‰•áÁ•É¥µ•¹Ñ…°ˆ±¥‰É…ÉäÕÍ•µ½Íѱ䁉䁡…É‘½É” ¬¬)ÁɽÉ…µµ•É́™½È…Ё±•…ÍЁ„½ÕÁ±”½˜µ½¹Ñ¡Ì¸Q¡•Í”ÁɽÉ…µµ•É́…É”¹½ÐÍÑՍ¬)½¸ ±…¹œ€Ì¸Ð…¹å݅䰁ͼÍÕÁÁ½ÉÑ¥¹œ¥Ð…‘‘́±¥Ñѱ”Ù…±Õ”%5!<¸()¥¹…±±ä°Ñ¡•É”…É”ÕÍ…•Ì½˜•¹•É¥Œ±…µ‰‘…́…¹•¹•É…±¥é•½¹ÍÑ•áÁȁѡ…Ð)ݽձµ½ÍЁ±¥­•±äµ…­”½±‘•È½µÁ¥±•É͍́ɕ…´¸$‘½¸ÐÑ¡¥¹¬Ù…É¥…‰±”)Ñ•µÁ±…ѕ́…É”Ñ¡”‰¥•ÍЁ…¹Ñ¤µÁ½ÉÑ…‰¥±¥Ñ䁙…Ñ½È¥¸!…¹„¸(((ø€ø€øUÍ¥¹œÁÁ±”Ì±…¹œ€Ø°Ý¡¥ ½ÉÉ•ÍÁ½¹‘́Ѽ±…¹œ€Ì¸Ô½™˜½˜RG'Væ²à£ââ *²µÐ£âà£ââ6ò–÷Rw&Rv—F‚„6öFRÂ2ãbÂ&–v‡CòF†—2—2æ÷B7W÷'FVBÂVæf÷'GVæFVÇ’à£ââ’FöâwB¶æ÷rv†VâÆR'&æ6†VBöb6Æær2ãRÂ÷"v†BF†W’F–BFò—BÀ£ââ'WB—B†–Ç’W‡ÆöFW2öâ×’6ö×WFW"Föòà£à£âvVÆ—G2†6öFRbã"à ¥6÷''’Â’ÖVçBFò6²–b–÷RvW&RW6–ær†6öFRÂbã2†æ÷B2ãb’Âv†–6‚–÷R&Rà¤2Fö7VÖVçFVB–âF†R$TDÔR³%Ò—B—2Væf÷'GVæFVÇ’Vç7W÷'FVBआ÷vWfW"–÷Rw&Röâõ2‚æB–÷R†fR†öÖV'&Wr„’õö¶æ÷uõò–÷RFò¢Ò’à ¢'&WrF†öÖV'&Wr÷fW'6–öç0¢'&Wr–ç7FÆÂÆÇfÓ3` ¤—Bw2fW'’V–6²Fò–ç7FÆÂ&V6W6R—Bw2&÷GFÆRÂ6ò–÷RFöâwB†fRFð¦6ö×–ÆR—B–÷W'6VÆbâæBF†Vâ†æv–ÆÂ&RgVÆÇ’v÷&¶–ærà ¥&Vv&G2À¤Æ÷V—0 ¥³Ó¢‡GG3¢òövöòævÂ÷Ófd¶ ¥³%Ó¢‡GG3¢òöv—F‡V"æ6öÒöÆF–öææRö†æ7&W&WV—6—FW2ÖæBÖ–ç7FÆÆF–ö


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk