Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 64574 invoked from network); 20 Feb 2008 06:34:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Feb 2008 06:34:18 -0000 Received: (qmail 52616 invoked by uid 500); 20 Feb 2008 06:34:13 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 52602 invoked by uid 500); 20 Feb 2008 06:34:13 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 52593 invoked by uid 99); 20 Feb 2008 06:34:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2008 22:34:13 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 66.249.82.237 as permitted sender) Received: from [66.249.82.237] (HELO wx-out-0506.google.com) (66.249.82.237) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2008 06:33:37 +0000 Received: by wx-out-0506.google.com with SMTP id i30so2196886wxd.2 for ; Tue, 19 Feb 2008 22:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=+dvO0qrET3KuP77aOi1Z5uP68Tl8oqlN8KZeiFh7XwY=; b=xTK1tlC2kJyTzD0FPpCv7wOzlCi2nyTGAOz1kk7lnNlZPAn7oGDG1nLR7ZwLV7AljGBrNGUeMhxNhpTcmwrjz4q7kV4W+iIs7gXsCvmFaDLC5yqX5sm9rTbsBj5SQRP9IfTRNuGV1Ab1TIVspqtAKBqnxA3L+6HbISPlFkCzde4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=RvljF42TU0R+jl0HEPhbWq9cF7blwF/bUNIG2cs2VJ7TGUECjHIlLCtcxDb+ggd0h9s9FXP+nJ6mgxxQLfOIXJkGO4wB9hI9OhSUfS8Ox2RxhPKqseqLotpZPEPrEOXOLtc+ngzV4ajEWKNwgF1gr3ystohMnuI9glj2CNR2z5c= Received: by 10.142.125.5 with SMTP id x5mr6135745wfc.40.1203489224836; Tue, 19 Feb 2008 22:33:44 -0800 (PST) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id 29sm19870636wfg.9.2008.02.19.22.33.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 19 Feb 2008 22:33:43 -0800 (PST) Message-ID: <47BBC9C5.7020801@roguewave.com> Date: Tue, 19 Feb 2008 23:33:41 -0700 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r628839 - /stdcxx/trunk/tests/self/0.braceexp.cpp References: <47BB356D.3040708@roguewave.com> <15580502.post@talk.nabble.com> In-Reply-To: <15580502.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Travis Vitek wrote: > [...] > The function rw_brace_expand() does brace expansion on whatever string you > pass. There is no special treatment for whitespace [as required by the Bash > Reference Manual]. That is a feature of the shell. The difference is very > significant... Okay, that was an important point I missed. The question then is: which is more useful? Or, if we think both are, we might want to consider implementing both. > > If you pass the string "first {1,2} last" to the shell for expansion, you > will get "first 1 2 last" as output. The shell is brace expanding each of > the three tokens seperately. If you brace expand this as one string, which > you can do by escaping the spaces, you get a different result. You should > get "first 1 last first 2 last". > > I think much of the confusion we are having is because we are testing our > rw_brace_expand() function with the bash test suite. Our function only > implements one of the many features of bash, but the test suite verifies > several of the bash features are working together correctly. You're probably right. My confusion, if you want to call it that, probably does stem from my expectation to use the function the same way I use the shell. In my view, the whole "raison d'etre" for the function is that we don't have a UNIX shell on Windows. If we did, some of the features in the driver, including the locale query, and most of those in the harness (the exec utility) would probably be relegated to it and we wouldn't need to (re)implement it ourselves. I wonder if it would help us move forward to outline the major use cases for the function. Here are the ones at the top of my list: * to help with locale matching in the locale query string, i.e., as part of the mechanism behind the rw_locale_query() function * to help with the matching of platforms in the expected failures project, i.e., again, as one of the essential pieces, along with rw_fnmatch(), behind an rw_match_platform() or some such function to match the platform string from xfail.txt against the actual platform * to help generate input strings for some of our tests (I don't have a clear picture of how to use it here) Are there any others? In the first two cases, I envision using the function pretty much exactly how I would use the shell + grep (e.g., to process the xfail.txt file). In the last case, I can imagine using it a little or maybe even a lot differently, i.e., with various extensions or differences from how the shell behaves. How do you expect to use it? In all cases, I think we will get the biggest bang for our buck if we design and implement rw_brace_expand() in a way that will make coding the bigger features as easy as possible by handling as much of the shared use cases in it instead of duplicating the same thing at the outer layers. Does this make sense? > > [...] > I wish I could get inside the heads of the guys writing this stuff. By > introducing such a change, they are potentially breaking existing user code, > and there appears to be no net benefit for making such a change. As we've > already established, it is quite easy to stick an additional set of braces > in there. I can't help you there, but you can get some insight by reading the archives of the bug-bash list or ask your questions on it: http://lists.gnu.org/archive/html/bug-bash/ But I don't think the corner cases are terribly important to get exactly the same as in Bash or even implemented at all, just as long as we have a solid implementation of the common ones. > [...] > I could, but I think it would be better to implement something on top of > rw_brace_expand() that expands each of the whitespace seperated tokens > seperately, just like bash does. If rw_brace_expand() becomes a private > implementation function, then so be it. Whatever works. It all depends on how we end up using it. We haven't spent much time talking about the top level interface yet. Maybe it would help if we did? What do you expect the rw_locale_query() interface will look like? And how do you envision it to be implemented in terms of rw_brace_expand() and rw_fnmatch()? (I should probably do the same exercise for rw_match_platform().) > [...] > Unfortunately the bash testcases rely heavily on additional behavior > implemented in bash [environment variable expansion, whitespace collapse, > and more. I understand the motivation, I just want to make sure we all > understand that some of the cases don't work because we're not implementing > bash. We're implementing a single feature of bash. Yes, but the only way to use that feature is in conjunction with at least some of the others, such as collapsing whitespace. I do agree that the environment variable expansion can be done separately. I'm not 100% convinced that it necessarily has to be, but I'm not at all opposed to it, certainly not if it makes the implementation cleaner and easier to maintain and enhance. Martin