Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id r6ULOax3004621 for ; Tue, 30 Jul 2013 23:24:37 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx104) with ESMTPS (Nemesis) id 0M8KAo-1U9r6T0Tkw-00w013 for ; Tue, 30 Jul 2013 23:24:31 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6ULLcnC013670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Jul 2013 23:21:38 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6UGL7LY006537; Tue, 30 Jul 2013 23:21:37 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10355926 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 30 Jul 2013 23:21:37 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6ULLbFr007749 for ; Tue, 30 Jul 2013 23:21:37 +0200 Received: from mail-oa0-f42.google.com (mail-oa0-f42.google.com [209.85.219.42]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r6ULLNq2013560 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 30 Jul 2013 23:21:26 +0200 Received: by mail-oa0-f42.google.com with SMTP id i18so9130249oag.29 for ; Tue, 30 Jul 2013 14:21:23 -0700 (PDT) X-Received: by 10.182.72.170 with SMTP id e10mr59046907obv.62.1375219282950; Tue, 30 Jul 2013 14:21:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.68.99 with HTTP; Tue, 30 Jul 2013 14:21:02 -0700 (PDT) References: Content-Type: text/plain; charset=UTF-8 X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id r6ULLbFr007750 Message-ID: Date: Tue, 30 Jul 2013 23:21:02 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Michiel Helvensteijn Subject: Re: Request for argument specifiers which generate unique csnames To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by relay2.uni-heidelberg.de id r6ULLcnC013670 Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:1yBHImdQuEM=:ML63awRtgW2VYgqHNCohgQSNmG 7/FEjMiVyyVQ4Cgs8W8LydyPyC6xl2bCeYq50NypRXSVuHPgzfRjF6EjNOkWAESQxE8TM62KC zrowCPi/LxvQQyTAHa72Dyas1CZMnN+Ry9syxkIQRcJY2VaVXqXupt7X2PolrH+thWnIEHDHu 7I0XBb/YZZ+rHQx394HaPExHvJoCrYCETshVJB4o5vRpvXCnqMgp2HOKPwEPLYu5Vocg3eEHM sz9Cy15jgz9Q/AhqUpRTCRTq4Bi5VxPevytxEL6n44ZaK+oePqJqVG9FuR991yATBoh+DU9RU IYoQAttajBaVWq7YY1DfBjYvawNzh7rq3ZnjqWjHgP0VfhcXDtvrnMkU8eEABgarbScQ0axKC DliWuEyr77sMFxBbWO7MFUpGD8p/B7NNJFhA1AABJczEUtVQrRVD/nZ3+zkdYQiTRVcKsKA4K S3hqXCTRBaMWPFE5TdsfwEj58Lcrzowotw2luE6yevSOVWh5LZ9XHJrFgGrqthJSblvzSHc14 gU6psYSSpWFRZyPob59pb4jrbwI9A+Ned1U+Qt7ib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Loop:V01:oh9X0p8mD5w=:7Ub3UQhJjEXKmV0v6khTjHLjj4PtxP+G7DKyft0XooA= Status: R X-Status: X-Keywords: X-UID: 7278 On Wed, Jul 17, 2013 at 2:45 AM, Bruno Le Floch wrot= e: > A "type" is defined by setting up a property list (two actually) > matching a word (new:N, put_right:Nn, tail:n, ...) with a function > which implements it for that type (\seq_new:N, \seq_put_right:Nn, > \ERROR, ...). An "object" of that type is simply a token list > starting with a specific marker \s__ and ending with \s_stop. > This means that one can manipulate such objects (props, seqs, etc.) as > n-type arguments, rather than the current constraint that they be of > N-type always. This makes sense. A type contains method implementations, an object contains data. > Functions to manipulate the object can still be called directly as > they are right now, with no overhead. They can also be called through > an \obj:Nn function, which takes care of finding the type of the first > argument. E.g., perhaps, > > \prop_new:N \l_my_prop > \prop_put:Nnn \l_my_prop { key } { value } > > \iow_term:x { \obj:Nn \l_my_prop { get:Nn =3D { key } , head:n } } > > \obj:Nn \l_my_prop > { > pop:NnN =3D { key } , > tail:N , > map_inline:Nn =3D { \iow_term:n {#1} } > } There's more going on here than a shorter syntax and type-derivation for the first argument. You're chaining method calls. In a typical object oriented language it might look like this: my_prop .pop(key) .tail() .map_inline( =CE=BB x, iow_term(x) ); A few notes: (1) Implementation wise, the link between pop and tail is quite different from the link between tail and map_inline. The former is through a temporary variable, the latter is through the value of the expression itself (i.e. the input stream). You'll want to be clear and consistent on this. (2) Your earlier description suggests that "methods" are not automatically derived from existing functions. If that's the case, I suggest you drop the argument specifiers that are not explicitly used, so: \obj:Nn \l_my_prop { pop:n =3D { key } , tail:, map_inline:n =3D { \iow_term:n {#1} } } (3) And while we're at it, why stick to the key/value notation with the "{}", "," and "=3D"? A feature this fundamental deserves a dedicated syntax. You could probably make the following syntax work: \obj:Nn \l_my_prop . pop:n { key } . tail: . map_inline:n { \iow_term:n {= #1} } It doesn't look like \obj:Nn is going to be expandable anyway. The above version scans ahead. It first expects a variable, then a dot, then a method name. Based on the method name, it will retrieve the expected parameters. It then scans for another dot. Lather, rinse, repeat. > Now, in principle many of the operations performed on a given type can > be built from very few building blocks. One such important block for > objects over which we can map extracts the first item, and the > remainder of the object (as an object of the same type), and leaves > the two parts as brace groups. Specifically, we want a > "\something_split:nNF" function which takes as arguments an object #1 > of type , a two-argument function #2, and some tokens #3, > and outputs #2 followed by the two groups obtained from #1 if > extracting the head was successful (the was non-empty) or > #3 if the was empty. From such a function, one can derive > mapping functions, a get_left function, a get_right function, and all > sorts of jolly things. You're suggesting a possible layout for the data in an object, allowing easier recursion. For some types this will make a lot of sense. For others it may not. I would support =E2=80=94but not enforce=E2=80=94 something like this. > In practice, this would be done by letting a type defer to another for > unknown methods. There would be a built-in type, from > which the type could derive. This is just a specific example of how objects might be used, yes? Not a fundamental part of them? You'll want to make sure that all of this can work together seamlessly with existing expl3 functions. You'll still have to make the choice of whether to support nominal subtyping or structural subtyping: http://en.wikipedia.org/wiki/Subtyping#Subtyping_schemes --=20 www.mhelvens.net