Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concept primitives? #3

Open
rnburn opened this issue Dec 2, 2014 · 13 comments
Open

concept primitives? #3

rnburn opened this issue Dec 2, 2014 · 13 comments

Comments

@rnburn
Copy link

rnburn commented Dec 2, 2014

Have you thought of including some basic primitive concepts? like those defined in "Elements of Programming" and similar to what will be in concepts-lite

@pfultz2
Copy link
Owner

pfultz2 commented Dec 2, 2014

It seems like a good idea, especially the concepts used in C++ here. Of course there is no need to define them for concepts like DefaultConstructible since it is already provided by C++ standard library.

@jeremy-murphy
Copy link

I wonder if the OP was referring to the algebraic concepts, which Peter Gottschling also detailed in TR638 back in 2006. I stayed started playing around with algebraic traits for Boost.Math but perhaps this is a more logical place to try it out.

@viboes
Copy link

viboes commented May 8, 2016

I believe that the concepts must be added by the library that use them. Adding concepts that no library use is a lost of time IMHO. Another this is having some of those concepts implemented as examples to check the usability of the library.

@jeremy-murphy
Copy link

Sure, that makes sense, assuming you mean things like graph concepts are in the Boost.Graph library, etc? What do we consider as 'standard' concepts, i.e. deserving of being in the C++ standard library or at least built-in to a concept-checking library? E.g. iterator concepts, algebraic concepts, etc.

@viboes
Copy link

viboes commented May 9, 2016

I admit that the library could provide the C++ standard library requirements as Tick constraints as we can not have them on the C++ standard library.

What algebraic concepts would you like to have?

@jeremy-murphy
Copy link

The ones defined in Elements of Programming and also in TR638, which I mentioned above: magma, monoid, ring, field, group, module, etc.

On a side note, I would also like algebraic traits of types in a similar style to std::numeric_traits, e.g. algebraic_traits<BinaryOp>::is_commutative() and algebraic_traits<BinaryOp>::zero_element(), but I'm not sure if that's a separate conversation. The traits seem like a building block of the concepts, though, right?

@jeremy-murphy
Copy link

Any more thoughts on this? I'm quite interested in following it up.

@pfultz2
Copy link
Owner

pfultz2 commented Jun 28, 2016

The tick library is focused on syntactic-based concepts like the ones defined in the Concepts TS. To support the algebraic_traits the library would need more semantic-based concepts, and a framework for handling those type of concepts.

I think semantic-based concepts would be very useful. The library could definitely grow to support them, which the library would expand beyond just a concepts traits library to supporting a full-range of concepts. Although, I haven't fully thought about the best way to define semantic-based concepts in a library and how they interact with syntactic concepts, but I imagine it would be close to how hana defines its type classes. This is definitely an interesting area to explore.

@viboes
Copy link

viboes commented Jun 28, 2016

I agree that semantic-based concepts needs either well established practice or explicit mapping, as Hana does. I believe that this is out of the scope of the library.

@jeremy-murphy
Copy link

I made a primitive implementation of algebraic traits here just as a proof-of-concept. I'm no expert on template metaprogramming so please don't be horrified by any egregious shortcomings in my code. But the basic example is accumulate_if, which terminates if the binary operation being applied results in the zero element for that operation. Which in the case of gcd is 1.

@pfultz2
Copy link
Owner

pfultz2 commented Jan 29, 2017

So initial documentation for the traits provided by the library has been added here. This should cover the basic concept primitives.

@robertramey
Copy link

The document includes a nice page for documenting is_forward_iterator. That page suggests that the header exists:

#include <tick/traits/is_forward_iterator.h>

But I find no such header in the package. What's up with this?

@pfultz2
Copy link
Owner

pfultz2 commented Aug 6, 2017

But I find no such header in the package. What's up with this?

The file is here. I am not sure why it missing for you. Its there when I clone it from github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants