[cfe-dev] Concepts status
Hubert Tong via cfe-dev
cfe-dev at lists.llvm.org
Tue Jun 14 11:21:39 PDT 2016
Hi Andrew,
I have an idea of the dependencies behind the various part of the work and
could hopefully help coordinate the implementation effort.
Brain dump follows; please let me know what part of the implementation you
are interested in. Note that Nathan may already have plans to work on
certain things.
The implementation is still in its early stages. As Nathan mentioned, it is
currently controlled by a cc1 flag -fconcepts-ts.
Broadly, there are various sides to the "core concepts" implementation.
One is allowing for constrained templates. Another is allowing for concept
definitions. A third is requires-expressions.
Nathan Wilson has been implementing concept definitions.
The acceptance of "concept" as a specifier for that purpose has been
implemented, as have various diagnostics associated with its use.
The last I know of, Nathan noted that there are still a few things that
need to be completed on that front (such as 7.1.7 p3). The tests are under
the tests/CXX/concepts.ts directory.
The presence of concept definitions lends itself to adding an
implementation of constrained-parameters (at least the parsing is safe to
do for now--see below for the state of representing constrained templates).
I'm not a fan of template-introducers, but those are also in a similar
state.
I suggest avoiding abbreviated function template syntax for now.
Since require-expressions are allowed in limited contexts, and a concept
definition is one of them, it is also a great time to start work on
requires-expressions.
I believe Nathan is planning to work on this.
For constrained templates, the idea is to first allow for requires-clauses
in template-declarations.
The parsing for that is complete.
We still need to attach the parsed constraint-expression to the declaration.
I submitted patches to add a field to TemplateParameterList to allow the
constraint-expression to flow from the Parser to the point where we create
the declaration.
My next step is to attach constraints to declarations properly.
At this stage, the associated constraint (which is used for matching
declarations) for the template would still be the same as the
constraint-expression; however, as additional forms of constraining
templates is added, this will change (and so different declarations of the
same templated entity may syntactically have their constraints expressed
differently). The canonical representation of the associated constraint is
that specified by the TS (a single expression).
When we have the canonical representation attached to a declaration of the
template, we can move forward with several things immediately.
The resolution of declarations to prior declarations will need to be done
(which will involve comparison of template-dependent expressions)--this is
the part I'm working towards.
Implementing mangling for the associated constraints is another.
Determining whether the associated constraint is satisfied is yet another.
This will involve normalizing the constraint into a form which, in terms of
the implementation, will be conducive to doing the as-needed template
argument substitution.
Once this is implemented, then triggering substitution failure when
appropriate could be considered "cutting the ribbon".
There is more to do for the partial ordering and subsumption determination.
Those work upon the normalized constraint. A theorem prover would be useful.
-- Hubert Tong
On Tue, Jun 14, 2016 at 9:59 AM, Nathan Wilson <nwilson20 at gmail.com> wrote:
> Hi Andrew,
>
> There isn't a branch devoted to Concepts; patches are created and merged
> into trunk (master). If you look through the logs you'll see some commits
> with [Concepts] or [CONCEPTS] in the subject.
>
> Currently there is a front end only (cc1 only)
> -fconcepts-ts flag which may be specified with -Xclang -fconcepts-ts as
> well.
>
> Thanks,
> Nathan
> Thanks Hubert.
>
> Is there a public branch available? I'd be interested in getting involved.
>
> On Tue, Jun 14, 2016 at 1:40 PM Hubert Tong <
> hubert.reinterpretcast at gmail.com> wrote:
>
>> Hi Andrew,
>>
>> Concepts support is still ongoing in Clang. There is no published
>> roadmap, but the goal is to have a full implementation (at least using the
>> *requires-clause* syntax) in Spring of 2017.
>>
>> -- HT
>>
>> On Tue, Jun 14, 2016 at 8:03 AM, Andrew Marshall via cfe-dev <
>> cfe-dev at lists.llvm.org> wrote:
>>
>>> What is the status of adding support for Concepts in Clang? Is there any
>>> kind of roadmap for this?
>>>
>>> Thanks,
>>> Andrew.
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>>
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160614/219e39ad/attachment.html>
More information about the cfe-dev
mailing list