Return-Path: X-Original-To: apmail-groovy-dev-archive@minotaur.apache.org Delivered-To: apmail-groovy-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBA881742C for ; Fri, 22 May 2015 15:00:39 +0000 (UTC) Received: (qmail 89894 invoked by uid 500); 22 May 2015 15:00:39 -0000 Delivered-To: apmail-groovy-dev-archive@groovy.apache.org Received: (qmail 89853 invoked by uid 500); 22 May 2015 15:00:39 -0000 Mailing-List: contact dev-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.incubator.apache.org Delivered-To: mailing list dev@groovy.incubator.apache.org Received: (qmail 89842 invoked by uid 99); 22 May 2015 15:00:39 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 May 2015 15:00:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id DC85F1A30D6 for ; Fri, 22 May 2015 15:00:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.001 X-Spam-Level: * X-Spam-Status: No, score=1.001 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id KorGxmsv21G1 for ; Fri, 22 May 2015 15:00:26 +0000 (UTC) Received: from nschwmtas06p.mx.bigpond.com (nschwmtas06p.mx.bigpond.com [61.9.189.152]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id EAE9F20B86 for ; Fri, 22 May 2015 15:00:24 +0000 (UTC) Received: from nschwcmgw07p ([61.9.190.167]) by nschwmtas06p.mx.bigpond.com with ESMTP id <20150522150015.PIQL15095.nschwmtas06p.mx.bigpond.com@nschwcmgw07p> for ; Fri, 22 May 2015 15:00:15 +0000 Received: from [127.0.0.1] ([124.185.246.55]) by nschwcmgw07p with BigPond Outbound id X30E1q00L1CSq3g0130Eaf; Fri, 22 May 2015 15:00:14 +0000 X-Authority-Analysis: v=2.0 cv=Os7NOlDt c=1 sm=1 a=1/yBMblUadcsIHiGJfTEWA==:17 a=2VfcibfJTP8A:10 a=IkcTkHD0fZMA:10 a=v5IiRebxAAAA:8 a=ArF2hGY1AAAA:8 a=L0F79Gm0AAAA:8 a=ZM57tvEHAAAA:8 a=_6GpL_ENAAAA:8 a=Q2ddSPPPT-mcqDFpLp0A:9 a=QEXdDO2ut3YA:10 a=JtlYfb0Lncu1SRwT:21 a=D4nRpGj25QD_HqKx:21 a=1/yBMblUadcsIHiGJfTEWA==:117 Message-ID: <555F447D.3040507@asert.com.au> Date: Sat, 23 May 2015 01:00:13 +1000 From: Paul King User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: dev@groovy.incubator.apache.org Subject: Re: CharSequence.count(Closure) References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 150522-0, 22/05/2015), Outbound message X-Antivirus-Status: Clean There is certainly nothing stopping useful library classes from being worked on outside Groovy core. There are big (GPars, Spock) and small (e.g. http://grengine.ch/) examples of this. We should certainly make this as easy as possible to do. There are certainly some things on our TODO list which would make this easier such as some additional metadata around minimum Groovy/Java versions that an extension module supports for instance. But within the community it would be great to lower all the other barriers to making such libraries easily deployable and findable. Having said, we still want Groovy bundled with some base useful libraries and we want those to be consistent. So, in this instance I would probably just recommend adding a few extra methods. Cheers, Paul. On 23/05/2015 12:19 AM, David Dawson wrote: > Apols for hijacking this a little, but it's related! (honest) > > I've been thinking recently about the setup of Groovy and particularly the extension methods. For questions like this, it would seem sensible to build an extension method to do it, but currently the expected place is to put it into Groovy itself. Therefore needing a release of Groovy to incorporate it. > > Now that the extension method API is well understood and seemingly stable, would it be feasible to separate the lifecycle of the extension methods/ GDK out from the Groovy runtime itself? > > That way Peters proposed extension could be implemented there without needing an upgrade of Groovy itself, and could then be usable on older versions of the language. > > Sound sane at all? > > > > On 22 May 2015 at 15:13, Peter Ledbrook > wrote: > > Hi, > > One of the things I really like about Groovy is how strings can be treated as sequences of characters. Unfortunately this seems to break down in some cases. For example, there is no `count()` method that takes a closure. In my case I'm trying to count vowels, but you might want to count upper case letters or anything else like that. > > Does it make sense to extend all the Iterable methods and properties to CharSequence as well? Or should developers turn a string into a list, perform the processing and then convert it back? Either way, the current setup seems a bit inconsistent. > > Peter > > > > > -- > David Dawson > CEO > Simplicity Itself Limited > Tel +44 7866 011 256 > Skype: davidadawson > david.dawson@simplicityitself.com > http://www.simplicityitself.com --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com