From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 74B5819A0A06 for ; Tue, 15 Sep 2015 18:44:12 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id D83ACB5D87F for ; Tue, 15 Sep 2015 19:06:31 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 0C07B97A826 for ; Tue, 15 Sep 2015 19:06:34 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id CCBCA95241E for ; Tue, 15 Sep 2015 19:06:31 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id CA0DA12060A; Tue, 15 Sep 2015 19:06:30 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id B130B1204B9 for ; Tue, 15 Sep 2015 19:06:27 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=WgbebRj+zxnMOGy/9b7VREUQPvk=; b=y+Jx9kd0gimA2/YsY9 eW23q+ee8pZI7+ksP3ykkzyPlMZ5rrzdWdvIlaK8KkIJI9zs/rgMz6CxF2Bra8ce +qyfCC9FNgoQtSFbAz878ak+KNdZPStI8TCZgJ0zGUJeDX33/Y23lIqVFeYCgPyd hV980tWP2XFnkJoj/qPhORIps= Received: by filter0857p1mdw1.sendgrid.net with SMTP id filter0857p1mdw1.24063.55F7ED9A13 2015-09-15 10:06:18.405590011 +0000 UTC Received: from herokuapp.com (ec2-54-163-92-178.compute-1.amazonaws.com [54.163.92.178]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id M2fmXgljTtWb4T6GdP45QA Tue, 15 Sep 2015 10:06:18.197 +0000 (UTC) Date: Tue, 15 Sep 2015 10:06:18 +0000 From: eregontp@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 45425 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10594 X-Redmine-Issue-Author: findchris X-Redmine-Sender: Eregon 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6yXh+GTyuLL9OOeUT7XsFMldko1SkKKDv+TC fn8gjGuHC6yR4EtNMuvz969gUahqM4FcucYfExEvWf0x2BkX52TIIjAq9/50ziLYwv41BVvD55H+M1 ibKX2Buduzij0kyquGlL6bEzpF/S4Vvuf05N X-ML-Name: ruby-core X-Mail-Count: 70813 Subject: [ruby-core:70813] [Ruby trunk - Feature #10594] Comparable#clamp 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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #10594 has been updated by Benoit Daloze. It's just that String#<=> is not consistent with String#succ but indeed it's not so much of a problem here. ---------------------------------------- Feature #10594: Comparable#clamp https://bugs.ruby-lang.org/issues/10594#change-54195 * Author: Chris Johnson * Status: Open * Priority: Normal * Assignee: ---------------------------------------- This is basically a re-opening of the feature request of issue#4573 (https://bugs.ruby-lang.org/issues/4574), which was closed due a naming debate. It seems the standard naming for restricting a number to a specified range is indeed 'clamp'. (1)(2)(3) As such, can we use Yusuke Endoh's original patch with the naming adjustments? If so, I can provide accordingly. Cheers. (1) http://www.rubydoc.info/github/epitron/epitools/Numeric:clamp (2) http://stackoverflow.com/questions/12020787/is-there-a-limit-clamp-function-in-ruby (3) https://developer.gnome.org/glib/stable/glib-Standard-Macros.html#CLAMP:CAPS ---Files-------------------------------- num_clamp.c (427 Bytes) comparable-clamp.diff (2.52 KB) -- https://bugs.ruby-lang.org/