From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Generators (iterators) for Gnu Emacs Date: Fri, 05 Dec 2014 17:26:03 -0500 Message-ID: <548230FB.40307@dancol.org> References: <877fy77zhp.fsf@web.de> <87k326d4ww.fsf@gmail.com> <877fy6rp2o.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xVUlepq7dVK4Cpw2X7Ul9sRuI7ulqb9qo" X-Trace: ger.gmane.org 1417818384 32266 80.91.229.3 (5 Dec 2014 22:26:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2014 22:26:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier , Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 05 23:26:18 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xx1KL-0006sZ-R3 for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 23:26:17 +0100 Original-Received: from localhost ([::1]:52715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx1KL-0004FL-Bn for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 17:26:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx1KG-0004F1-Qk for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:26:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xx1KF-0003xV-LA for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:26:12 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:40184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx1KF-0003xN-Ah for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:26:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=FcS1HFhvHgtAX7NKOf6hcwNyITaGWdUdz7fa+Iq0Zno=; b=aoYKRs5omhWHRAFyPECBcS2pY7cOR4d589fhjeq9Kt6EjC7rJ90C3b/rb8UCnCwVXWYTGgLnIq8TwcVO41S25LYA9QFJkZ01piKjTxWocF5QXtqWvOUx8KTFY07VsO9pCY0aR1pQJGsEk8KuBMTSsWFzx9UyquqgBg1TouEn1UXO+vJn29j7HHb6va/IHVSNjS5HruK2glP38230jdvWi1W04ytVmadF3HkxojUwYVTl0sBF2UVILJ7oJx7bJNGog5LRdU9rwlxemIFrOF9jhqq+DYGV0KOg3b0uhehvIn/YkW5Ch6LwyVBbmWZV32onKcfuOCXtU+WfaAMuhfpWvA==; Original-Received: from [2620:10d:c0a3:1003:2ab2:bdff:fe1c:db58] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1Xx1KE-0007ev-G9; Fri, 05 Dec 2014 14:26:10 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:179045 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xVUlepq7dVK4Cpw2X7Ul9sRuI7ulqb9qo Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 12/05/2014 02:16 PM, Stefan Monnier wrote: >> I think we could do so, though, apart from the definition, our package= s >> seem quite disjoint. >=20 > I prefer to look at it as "complementary". >=20 >> Anyway, it would be good if Daniel's generators would then be valid >> iterators in terms of the new iterator.el. >=20 > Indeed, that would be nice. Can you try and work that out? Assuming both packages are suitable for inclusion into core, we can defin= itely make them work together. I'd still very much like to use nonlocal c= ontrol flow instead of a sentinel for enumeration termination, however. = That aside, I'm not sure I agree with your namespace preferences. `yield'= is fundamentally a lexically-scoped macro. Making it defer to some prior= definition makes no sense, since any code that can see this macro is alr= eady written with generators in mind. I'd also strongly prefer using `next' as the iter-get function. If we're = going to make the iteration protocol a core part of the environment, it d= eserves a prominent place in the global namespace. Using `funcall' is ina= dequate: first, it doesn't signal iteration in calling code, which can le= ad to confusion, and second, `funcall' doesn't work if we want to extent = `next' to support things like lists, for which `next' would be equivalent= to `pop'. AFAICT, nothing is already squatting on `next', so binding the= symbol's function slot would be harmless for a compatibility perspective= =2E I'd also prefer using `iterating' as the cl-loop keyword. Because the key= word is only active in the lexical scope of a cl-loop construct, there's = an even lower risk of collision, and the word "iterating" is exactly the = right thing in the cl-loop language: (cl-loop for x iterating y collect x= ) reads very well. --xVUlepq7dVK4Cpw2X7Ul9sRuI7ulqb9qo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUgjD7AAoJEN4WImmbpWBl0DcP/1m58wtr+2H92dD5RpT7Ls5z uQLdVvCpE02a9GwtyjMa7/WNJjvKzVo1jaeGVHp9WiLYFzITBuN4YHObTCayhyYU 0cu7qlUu1NRjQ0QEwCreGoeInAtF+ao73IyL1ST07Gn7kX1fP/OQctVwy0B3ULcC sKCJIygQL4f3lMawfpxtdleni0xh38tcWRKsY88L/5qsA3a+AkN5qSPM0/Njt3lr qUbJyqBmH10I0WGRZQLmoKJQs58RSsD9S9R0TUu9emo8Yx2sNmrSPA25yWw+FqkB 0WOEUfBzVywst2rK9h2WDigy3cVyhPovRb1CNALSIWba2iQqm4oTdurDraRxt3V7 HDUD6GhPiDbDvLi2fNVC39kQhFDe6DfOpnjzHdIt2R4LpGvW0El595YM6WCIwzhj eYvZX1hNf6qTE8iN2LTqAAXRBSiCeNgSBL/AME0bd6Lw8rFFqsdsPHGBz9CHcRBn i8x4KVfJ5RHQQDtBUi06Rt2PjDSkq5CdNTlIQ2OnaBybc7LXXDKAZAsyCcTBwDDd W3mi4hWZs7EIOJ2r6yszLP8KBuZN8lth6Tg/1/D4GIPuP2CdHqTfg2eqAqYdx5rJ YpnkQuUr93O6dYQeJ9qXJ4AYsB5vQP2zao6VL32LggKTywrFug3ahtlpUXHuShAY OPgoiMfo5fuMM4RbGwZV =WsA6 -----END PGP SIGNATURE----- --xVUlepq7dVK4Cpw2X7Ul9sRuI7ulqb9qo--