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

Alias Proc#[] to #call #11133

Open
postmodern opened this issue Aug 25, 2021 · 2 comments
Open

Alias Proc#[] to #call #11133

postmodern opened this issue Aug 25, 2021 · 2 comments
Labels
good first issue This is an issue suited for newcomers to become aquianted with working on the codebase. kind:feature status:discussion topic:stdlib

Comments

@postmodern
Copy link
Contributor

I think it would be useful to alias Proc#[] to #call.

  1. Allows using procs interchangeably with Hashes. This is useful for when you wish to cache the results of a calculation when the key-space is rather small, or "call" a proc directly when the key-space is too large to be efficiently cached. In both instances the calling code would simply be proc_or_cache[key].
  2. Emulates the idea that procs are mathematical functions which map input values to associated output values.
  3. Provides compatibility with Ruby.
@Blacksmoke16
Copy link
Member

I remember seeing another issue related to this, but can't seem to find it...

@nobodywasishere
Copy link
Contributor

Potentially similar to #2162

@Blacksmoke16 Blacksmoke16 added the good first issue This is an issue suited for newcomers to become aquianted with working on the codebase. label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This is an issue suited for newcomers to become aquianted with working on the codebase. kind:feature status:discussion topic:stdlib
Projects
None yet
Development

No branches or pull requests

5 participants