[cfe-dev] The state of Concepts in Clang

Hubert Tong via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 9 15:05:12 PST 2017


On Thu, Feb 9, 2017 at 4:59 PM, Hannes Hauswedell <h2+lists2017 at fsfe.org>
wrote:

> Hi Hubert,
>
> > At this time, I have been working on Concepts in Clang.
>
> Ah, great to know!
>
> >  I am not sure how
> > "people" are using concepts in GCC, but my experience on unit testing
> > produced a number of internal compiler errors
>
> Up until now it has worked ok for me, but I have mostly used rather
> basic concepts and only mild "specialization" of concepts.
>
> > (and I have not found the error messages to be helpful in general).
>
> True, but that's something where clang had to lead the way before, too,
> or not? :)
>
> > Some cases of those internal
> > compiler errors stem from the cases being underspecified in the TS.
> >
>
> Haven't had any of those because of concepts, yet.
>
> > I am not sure an ETA makes sense if the shape of what is going to be
> > delivered is changing. For example, the TS has a one-size-fits-all
> > normalization process which can be overly eager; part of the Clang
> > implementation effort would be to implement (in consultation with the
> > committee) the intended behaviour for each of the uses of normalization.
>
> TBH honest I have no real clue of the scope of implementing the TS fully
> in Clang (or what the current progress is) so I am not *suggesting*
> anything, but maybe if there was a preliminary usable release in Clang
> it would get in more testers and help diagnose issues and corner cases?
> I thought this was what the committee wanted and why so many things
> didn't make it into C++17, i.e. getting people to use TSes early so that
> issues can be found and solved before integration into the proper
> standard...
> Then again, maybe you already know the rough edges well and would rather
> figure them out first?
>
I'm hoping that the roughest of the edges in what the TS is would be
smoothed out before too much effort is spent on things which do not
translate (in terms of reusability or implementation/usage experience) to
later versions.
In some cases, like with concept definitions being also variable or
function templates, extra baggage comes from the existing parts of the
language.

The goal, of course, is to have something available for feedback so that we
know if the decisions made are ones which work for users.
The take away from that though, is that early adopters are, in a sense,
beta testing.

My inclination for writing concepts code (for use, not testing) right now
would be to use function concepts only, limit overloading concept names,
avoid abbreviated function template syntax, and avoid template
introductions.
I would also be very conservative in how I form constraints which are
intended to be "more specific" or "more general" than other constraints.

As for the Clang implementation, we have (at least a sketch of) a plan, but
no idea how difficult it is to execute.
I think there is at least one feature missing from the current TS which is
needed: a way to refer to template parameters which are being specialized
in a specialization.


>
> Thanks for the info and of course for working on this,
> Hannes
>
>
> >
> > On Thu, Feb 9, 2017 at 3:17 PM, Hannes Hauswedell <h2+lists2017 at fsfe.org
> >
> > wrote:
> >
> >> Hi Hubert,
> >>
> >> thanks for the reply and the "warning sign". I am aware that the
> >> discussion on Concepts is ongoing, but there is the published ISO/IEC TS
> >> 19217:2015 that GCC implements and it has been rather stable from my
> >> knowledge.
> >> In any case my original question still remains: is there an ETA for
> >> concepts in Clang? Is there a person responsible for it right now that
> >> could have more details?
> >>
> >> Thanks,
> >> Hannes
> >> --
> >> pgp-key: https://hannes.hauswedell.net/hannes_hauswedell_public_key.asc
> >> fingerprint: FC35 7547 7916 DA55 DC42 27EA 1D57 8E18 A109 60BF
> >>
> >> On 05.02.2017 18:57, Hubert Tong wrote:
> >>> The Concepts TS implementation for Clang is occurring on trunk; so you
> >> are
> >>> looking in the right place.
> >>> Regardless of the implementation status in Clang, the TS remains an
> >>> experimental design, which may be subject to change.
> >>> So, I think that using relying on the Concepts TS in production carries
> >>> some risks: even if the support is there, it might not be the same as
> GCC
> >>> or the current version of the TS.
> >>>
> >>> -- HT
> >>>
> >>> On Sun, Feb 5, 2017 at 8:43 AM, Hannes Hauswedell via cfe-dev <
> >>> cfe-dev at lists.llvm.org> wrote:
> >>>
> >>>> Hi everyone,
> >>>>
> >>>> I wanted to ask what the current state of the Concepts TS is in
> Clang. I
> >>>> saw some older list threads last year, but also didn't see much in
> >>>> regard of commits, but maybe I am also looking in the wrong places.
> >>>>
> >>>> The status page lists it as WIP, but from my own experience I know
> that
> >>>> WIP can me anything from "we are running the last tests before
> release"
> >>>> to "I have put it on the TODO list".
> >>>>
> >>>> The background is that we are currently redesigning a large template
> >>>> library and would really like to make use of concepts. Working with
> GCC
> >>>> during development is not a problem, but when we start distributing
> >>>> first release candidates maybe a year from now, it would be important
> to
> >>>> have Clang support, too.
> >>>>
> >>>> If someone could shed light on the current status and whether there is
> >>>> an ETA that would help us a lot. Note that I am not implying that
> anyone
> >>>> should do anything for us, it's just important for us to know whether
> >>>> it's something we can likely expect for e.g. clang-6 or "definetely
> not
> >>>> in the next two years".
> >>>>
> >>>> Thank you,
> >>>> Hannes
> >>>> --
> >>>> pgp-key: https://hannes.hauswedell.net/hannes_hauswedell_public_key.
> asc
> >>>> fingerprint: FC35 7547 7916 DA55 DC42 27EA 1D57 8E18 A109 60BF
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> cfe-dev mailing list
> >>>> cfe-dev at lists.llvm.org
> >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >
>
>
> --
> pgp-key: https://hannes.hauswedell.net/hannes_hauswedell_public_key.asc
> fingerprint: FC35 7547 7916 DA55 DC42 27EA 1D57 8E18 A109 60BF
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170209/bc9dd07e/attachment.html>


More information about the cfe-dev mailing list