Authentication-Results: mail-b.sr.ht; dkim=pass header.d=mht.wtf header.i=@mht.wtf; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mail-b.sr.ht (Postfix) with ESMTPS id E890411EF37 for <~andrewrk/ziglang@lists.sr.ht>; Sat, 10 Sep 2022 21:59:23 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C42845C0037 for <~andrewrk/ziglang@lists.sr.ht>; Sat, 10 Sep 2022 17:59:23 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute2.internal (MEProxy); Sat, 10 Sep 2022 17:59:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mht.wtf; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1662847163; x= 1662933563; bh=309hJBcSD36LprMBzVrjy8dDrlGGU7CaqyeohdkizWQ=; b=K KooAeAglejK6RIG9DNMHaP/flls0DQheXsG/JJoQhVYvx0/qvXAItuqJDKOrJtuH WtRsSSJ9mmnfXrVzP2+Fy2cgtHiDf/YLo+GdnHW0f5ECz02wxi9TgVT7qxh4+ARB EiluEM4T8S9CN25rFzfqLrc1+rtpO+pviIK2xlk9J6RsA8h+PF7/3b08jPbcPBO+ q1si+9dsH+nkxnrm/f7Kpsp552JvrPDsWAjOnYlRAK141nz+cdoYyZl23sL2C3Ua XRx1TlSvbNeA3wHRZUfWpBzupgpG4UBdP69rf0/ReJGuDWEzfWU6lDqg91eeHF0G 3vLTjbKk48EqLKvyny9hA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1662847163; x=1662933563; bh=3 09hJBcSD36LprMBzVrjy8dDrlGGU7CaqyeohdkizWQ=; b=1fe2xV1vKrLl0+iDa 2qnPA3o013L8eN450GL/nvmElg+6PgU+ktSvI/JwBaOxtpEfHyUm8PvAAipnNhOh NPv1xRC7JfixW1PdNJNvftsQWy45TCz9HJRinAM/n5vsZetAmYdew5GPiCyVCDau HcdETF6xoW6sHtzmZzSJAsyPRvDWlyuo0HIyHb+EoSRN4vCURGKpdDhG/JNHmRya cV0AeiPej5//TsSZpsxWKUPPa8h9ADPPPJQZ2/qb/Rh6iU4+Y6Ah7R/ODZEx+iPV Z0i8BAtGM7ETnRJdCGu8drlewW8uZ5OU+McEu/ARU/I5Hev+Kdv+64dPDNaUmt3N y9o7w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedtkedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepmhgrrhhtihhnuceoshhrrdhhthesmhhhthdrfihtfheq necuggftrfgrthhtvghrnhepiedtvdetudehheetkeefgeffjefhveekkeffgeevhedvhe ekvefgffetkedtteejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepshhrrdhhthesmhhhthdrfihtfh X-ME-Proxy: Feedback-ID: icfa147fa:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 78F082D40071; Sat, 10 Sep 2022 17:59:23 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-927-gf4c98c8499-fm-20220826.002-gf4c98c84 Mime-Version: 1.0 Message-Id: <4e588362-2691-4bec-8472-81087ac90f1e@www.fastmail.com> In-Reply-To: References: <8d2cc9f9-cb05-2038-3d53-eb7f4e6e3aaa@hotmail.com> <2e2f1751-ec7c-d22c-4a51-df9047a2d62c@hotmail.com> <8e27ac17-eb81-5ccb-2e73-5e038851a1be@hotmail.com> Date: Sat, 10 Sep 2022 23:59:02 +0200 From: martin To: ~andrewrk/ziglang@lists.sr.ht Subject: Re: [_]struct within [_]struct (was comptime map) Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Hey Peter! I've followed your thread for the past few weeks, and while I certainly = can appreciate your concrete questions, I'm not sure I understand what y= our overall goal is. (i.e., maybe we've got an XY-problem at hand, where= you ask for something that's awkward to do in Zig but the problem you'r= e having could be solved by something different, which would be easy to = do in Zig) It looks like you have a bunch of states that each have a sl= ice of other states that they'd want to invoke somehow, from an event or= something. Could you be a little more descriptive? I hope I can offer some insight on tuples though, because it's actually = really simple; a tuple is just an anonymous struct, in which the struct = fields have the names `0`, `1`, ...=20 For instance, const std =3D @import("std"); =E2=80=8Bpub fn main() !void { const foo =3D .{ 10, -2, 99 }; std.debug.print("{}\n", .{ foo.@"1" }); } prints `-2`. (The `@"1"` syntax is used to avoid keywords, or the lexer = in general; the field is named `1`, because it is the second element in = the anonymous struct initializer (I'm not confident about the nomenclatu= re here), but `1` is not a valid identifier so you need this funny synta= x. It's just like `foo[1]` in Python, or `foo.0` in Rust, or whatever)=20 ~martin