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

Possible ADT naming change for more consistency #71

Open
rdaly525 opened this issue Jul 17, 2019 · 4 comments
Open

Possible ADT naming change for more consistency #71

rdaly525 opened this issue Jul 17, 2019 · 4 comments
Assignees

Comments

@rdaly525
Copy link
Collaborator

I think we should rename our adt types to be the following:

(sum types)
Variant
TaggedUnion

(product types)
Tuple
Record

Currently, Sum behaves like Variant, Product behaves like Record, and Tuple behaves like Tuple.

This would mean that there is no class called Sum or Product for constructors.

Thoughts on this? It is a bit weird to currently have 'Sum' refer to the unnamed version of an ADT Sum type whereas 'Product' refer to the named version of an ADT Product type.

@rdaly525
Copy link
Collaborator Author

@leonardt @cdonovick @phanrahan

This is the issue I mentioned about potentially renaming ADT classes.

@phanrahan
Copy link
Collaborator

I like the idea of unifying the system so all variants of tagged vs non-tagged and product vs sum are possible.

Can we add class names to Sum? And support both indexed and named access?

@cdonovick
Copy link
Collaborator

@phanrahan
We currently support named access

Sum[A, B].A == A

But we don't have syntax for having specified names e.g.:

class Foo(TaggedUnion):
   bar = A
   foobar = B
Foo.bar == A

@phanrahan
Copy link
Collaborator

I thought about this some more. I personally don't think we need a tagged variant of Sum types. There is no need to access an instance of a sum type except via match. Product types are different in that we have to access the fields of an instance.

@rdaly525 rdaly525 mentioned this issue Feb 7, 2020
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

3 participants