From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 07C051F5AE for ; Thu, 23 Jul 2020 05:17:07 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 3FB94120B34; Thu, 23 Jul 2020 14:16:36 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id E1209120994 for ; Thu, 23 Jul 2020 14:16:33 +0900 (JST) Received: by filterdrecv-p3iad2-5b55dcd864-n86tl with SMTP id filterdrecv-p3iad2-5b55dcd864-n86tl-21-5F191D4B-C 2020-07-23 05:16:59.298759168 +0000 UTC m=+2290063.064201052 Received: from herokuapp.com (unknown) by ismtpd0012p1iad1.sendgrid.net (SG) with ESMTP id UR7TNR0GQBWQeJALApW7Ig for ; Thu, 23 Jul 2020 05:16:59.194 +0000 (UTC) Date: Thu, 23 Jul 2020 05:16:59 +0000 (UTC) From: shyouhei@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75079 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17043 X-Redmine-Issue-Author: delonnewman X-Redmine-Sender: shyouhei X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?jcfQDMoo=2FMGCmP3uu1SeyLQUxUPXq5PjHpHz3xSFn175KJnyOy7Xfnu8klBoeZ?= =?us-ascii?Q?h5NMk43WvZ0PojVVH6PVdqcLIcwlocPG3x2aPP6?= =?us-ascii?Q?Vl75tGDTpruNKuYV=2Ff=2FdnlpXnpVU6iaNgXx=2FYAi?= =?us-ascii?Q?iIoDVq0J+HpBtChFZtXCJBhAnLgviHm=2FhYROf01?= =?us-ascii?Q?K0OkzuXrbaiPMuQCSagOteixNlh0lTpOUrZc9Zf?= =?us-ascii?Q?fYUclFdtKH7mZwg34=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99290 Subject: [ruby-core:99290] [Ruby master Feature#17043] Invokable module for custom Proc-like objects X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17043 has been updated by shyouhei (Shyouhei Urabe). Status changed from Open to Feedback While your library seems great, what is proposed in this ticket is not that obvious. How can we help? What can we do? ---------------------------------------- Feature #17043: Invokable module for custom Proc-like objects https://bugs.ruby-lang.org/issues/17043#change-86679 * Author: delonnewman (Delon Newman) * Status: Feedback * Priority: Normal ---------------------------------------- Ruby beautifully integrates Functional and Object-Oriented Programming, and there's more moving in the direction of supporting Functional Programming. A generalization of the Proc interface would enable users to integrate a functional approach into their classic OOP design patterns. One of the obvious examples would be "Command" objects. Also, generic structures which Ruby as great support for. Hash now has `to_proc`. But, it'd be great to be able to treat sets as predicate functions. I've put together a prototype that I've found useful in my own work here: https://github.com/delonnewman/invokable. It works like Enumerable, it can be included in any class that implements a `call` method. Then you get `to_proc`, `curry`, `<<` and `>>` for right and left composition, and `memoize`. More could be added. If you include `Invokable::Command` you can treat your "Command" object as an automatically curried function. -- https://bugs.ruby-lang.org/