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

Documentation missing crucial information #3019

Open
gugolple opened this issue May 11, 2024 · 0 comments · May be fixed by #3108
Open

Documentation missing crucial information #3019

gugolple opened this issue May 11, 2024 · 0 comments · May be fixed by #3108

Comments

@gugolple
Copy link

gugolple commented May 11, 2024

Hello, new guy trying to learn how to program scala2. For that purpose I have been completing the challenges from AOC.

My issue with scala starts when I need a set to operate with a custom data type. The 2 core references are: old web laguange reference and the library reference. In neither is specified how or what specific traits (personal assumption) must be implemented by the type for it to work correctly with the collection.

For example in ADA the set has this small definition where it defines all the methods expected from the class used in the set.

generic
   type Element_Type is private;
   with function "<" (Left, Right : Element_Type) return Boolean is <>;
   with function "=" (Left, Right : Element_Type) return Boolean is <>;

To put another example, in C++ the set has the definitions for a class/method to provide the functionality.

template<
    class Key,
    class Hash = std::hash<Key>,
    class KeyEqual = http://en.cppreference.com/w/cpp/utility/functional/equal_to<Key>,
    class Allocator = http://en.cppreference.com/w/cpp/memory/allocator<Key>
> class unordered_set;

To not go so far away, in java defines the set as follows:

A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.

I would like the inclusion of a clear way of utilization of collections with custom types, even better if it was also provided with examples.

Thank you and kind regards,

Gugo

@gkepka gkepka linked a pull request Nov 18, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant