From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WHvEMNypGWY+ZAEA62LTzQ:P1 (envelope-from ) for ; Fri, 12 Apr 2024 23:38:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WHvEMNypGWY+ZAEA62LTzQ (envelope-from ) for ; Fri, 12 Apr 2024 23:38:36 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=ksXmb2yE; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=26k+qxVx; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1712957916; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=Q71PD1IMRz1CgNifZ9GwFmBDYv+uueWyLT3zcVZULFg=; b=PFED8hjyfDEWQV0xXEw3zege68UOZswrM3tS0pn4QIu71YC7CcULuN7w+M5fH2CMTUSzkR Le91PkohUhAVtIwBadFILampW/+h3YNjxx+eBQ7S8rSV/W11qLCmXpcYr2WqL9bgUyW+2q daEIi3P8v2VhbqAxKtImgS+tcCnPqVdB3k00YRpp6Ju7Ck8pNP8zuAi6BZXoheQnvl8I1k bumLpe3QuErvTCUMDc9OxshVElNZNzRHlzsdfUCzTsC4YvhVF5D6MzJOhClRQBmbVLgZWn mdVUZNZ1ebiaNZ3ElbDQwC+Eljrn9/hSYw2hU+K4rrQE2JAbf+AnCiPnIsqPjA== ARC-Seal: i=1; s=key1; d=johnnyrichard.com; t=1712957916; a=rsa-sha256; cv=none; b=ayOKQlXsnmywP6vYIyWC3atpU4kvWZ4amkNjXwnFuzX3EAv7cnd8KdGwiWOR0n1wCDVLMT RVJ9ICCwbM+BG1sA8fWbHybxbJ4s5Sxo8+PWWw7+IZaBYybp+9egYSrAskDFOVRqgzqS1m mnPutGjLgYvSV3nmmyZp9gEJbZ8ciRW4G3EOPCxhoJ51Q3R01AGxym4jflotoCMxye/MfY S3hwzyqRlvz//w8qmJeLkWnD14cHUHBVXh2fLEMb8ICZ2Z3IjG2E1A0AQP//KEL/aaeVlJ wbQM3zpO6ipBOctchsZGGSVaapaZWFokobfB0OX7ZCcCvt38hX0rgR2cleu64w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=ksXmb2yE; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=26k+qxVx; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8400E1C926 for ; Fri, 12 Apr 2024 23:38:33 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=n2ExRzIhEiigSLcpoo1oaTe+5END15UUuzIoE5VXYtU=; c=simple/simple; d=lists.sr.ht; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1712957912; v=1; b=ksXmb2yEA+miiip8VIHRJn635lksCvOoGsqd6rX24zOaftyK/Lvv/ReDNbxGytgdqVUcbjM9 8ITdsqsoROXI8t5kPAjC6TBFG0ZQAFAKLBGVTA0lvaHGN52Ues8OiTE78/6u05ajaKUKqgIIo6i VmoE8IkAmxWlzMhRRMUOA0RwC3YDw5DIiAumzklvHpEY0lPbT7PsFn8ULJs3a+UKMPP+qouP5Ug qkHrgu7EUHWktBe7HlfM2zpzRnYTJuzlkF/ppAxlzizOk2Ysgr7RNE6if+ld2wHTJP/u57pJf6q Db8QOhSi4VC6SxQu1g7xVlWnUJqYK74lhFwSQRgxLsArg== Received: from lists.sr.ht (unknown [IPv6:2a03:6000:1813:1337::154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 93AE1204AB for ; Fri, 12 Apr 2024 21:38:32 +0000 (UTC) Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by mail-a.sr.ht (Postfix) with ESMTPS id BF4EF202E0 for <~johnnyrichard/olang-devel@lists.sr.ht>; Fri, 12 Apr 2024 21:38:31 +0000 (UTC) Date: Sat, 13 Apr 2024 00:36:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1712957910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q71PD1IMRz1CgNifZ9GwFmBDYv+uueWyLT3zcVZULFg=; b=26k+qxVxCxwXWKES1jouNhMMBi+YeeOVD6TBxydgi5Xo6vZ6KghMG4banW9a9GBkO/pPAC N3A0Ukx+/iR5UHzS82fj8wpOuLFUG8X9pD5sYFXpTJc2TfeYy5TwXz7W+mDklo+vJsD0Ra tdctS5PsGqKjNnLMNLLqt2fPzoYrVahlDwKzS2rS0RnQVjTngiUOO6ShDUhCi5vyd6CJRx 0+eYLOchi0x+rJSl4QQyprvf5v2QkaaQdOXZgB1Og6hKEulW1sTs5cpWj6YHmkgYpGQaGv x4WuA67XYicdlnBzgMGgPnC+gKAX5MYKwhsBATZD52AmVjB5iepdOSHTzzpHiQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Johnny Richard To: ricardo_kagawa@disroot.org Cc: carlos@maniero.me, ~johnnyrichard/olang-devel@lists.sr.ht Subject: Re: [PATCH] fixup! docs: spec: add variables and constants specification Message-ID: References: <20240411224539.42752-1-ricardo_kagawa@disroot.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240411224539.42752-1-ricardo_kagawa@disroot.org> List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -10.13 X-Spam-Score: -10.13 X-Migadu-Queue-Id: 8400E1C926 X-Migadu-Scanner: mx12.migadu.com X-TUID: dLr2D6l3lZvx Thanks a lot for your contribution, I very impressed you managed to send a really nice PATCH. Sorry for that, but there is another Patchset version which was applied to the main branch. I think Carlos forgot to mention this Patchset was SUPERSEDED[v2] by version 2. v2: http://lists.johnnyrichard.com/olang/5fzsolce5h42aa6udppiwezgbzeqerkde3xvyilidnkcjaho2j@ygxd7ugzck4m/T/#m0f5cc6f2d49835ec83d4fd5c24d97d2597cb5363 However, I will leave my thoughts here but (we should try to address the current implementation problems in a new patches). On Thu, Apr 11, 2024 at 07:39:58PM -0300, ricardo_kagawa@disroot.org wrote: > From: Ricardo Kagawa > > Since this patch adds support to assignments, lets also add support to > > all assignment operators like "-=" "+=" "<<=" and so on. > > I disagree. Support for those assignment operators should only be added > when both assignments and operators are defined, and none of these > operators are defined yet. Sure... Unfortunately we don't have the specification for operators but they are already implemented into the language parser (I was planning to submit the assignment operators spec after this patch get applied). As soon as I send the Patch we can discuss on top of it anything related to assignment operators. > > This patch lacks support to the following valid assignment expression > > (which I think adds flexibility to the language): > > > > var x: u32 = a = b = c = 1 > > Personally, I don't like this idiom, but I wouldn't stop you from adding > it. Johnny's patch actually already enables this, and also the > following (for clarity, of course the `if` statement does not exist yet, > but it is included here as an example of what might come in the future): > > ``` > var x > if (x = next()) { > return x > } > ``` > > Which is something I don't like either, just as much. Carlos and I discussed it and we also agreed on removing this assignment. The patch v2 has removed it. > So, in my opinion, the decision should hinge on the compiler's ability > to properly validate the constant's immutability, and whether or not > late initialization should be allowed (complicating semantic checks). I prefer to not do a late initialization as well (it will make things simpler). I prefer to make the assignment mandatory for constants. > --- > Discussions: > > - Are you planning to hoist declarations, or are declarations required > to be placed before their use? We are planning to have declarations being placed before their use. > - Are you planning to include type inference for variable declarations? No. Everything should be verbose and explicit. > -- >8 -- > > - Moved statements common to the translation unit and function bodies to > their own non-terminal. Good. > - Restored Carlos' definition of variable and constant definitions, as > they are not quite the same, structurally and semantically. > Personally, I'd rather constants to be initialized immediately, but > you may have a different opinion on this. We also prefer to have the constants being initialized immediately. > - Moved some non-terminals from the "Statements" section to the > "Functions" section, as there will be some statements that are > function-body specific, some that are translation-unit specific, and > some that are common to both. I liked it. > - Renamed "assign" to "assignment", for better wording. Nice. > - Renamed from Carlos' patch to > (must not be used in ). Nice. > > Signed-off-by: Ricardo Kagawa > --- > docs/pages/language-specification.md | 36 ++++++++++------------------ > 1 file changed, 13 insertions(+), 23 deletions(-) > > diff --git a/docs/pages/language-specification.md b/docs/pages/language-specification.md > index 2650dd9..b218462 100644 > --- a/docs/pages/language-specification.md > +++ b/docs/pages/language-specification.md > @@ -24,15 +24,14 @@ language. > (* Entry Point *) > ::= ( ( | ))* > > - ::= > - | > - | > +(* Translation Unit *) > + ::= | > > (* Variables *) > - ::= ':' ( )? > - ::= 'var' > - | 'const' > - ::= > + ::= 'var' ':' ? > + ::= 'const' ':' After discussing with Carlos I regretted my suggestion about combining _var_ and _const_. Today we have both combined. But separate them makes a lot easier to implement. Could you please prepare a new patch over the _main_ branch with this change (if Carlos agree of course)? > + ::= > + ::= '=' > (* Functions *) > ::= 'fn' ':' > @@ -40,27 +39,18 @@ language. > ::= '(' ')' > ::= > ::= > + ::= '{' ( )* ? '}' > + ::= | > + ::= 'return' > > (* Statements *) > - ::= '{' ( )* ? '}' > ::= ';' | > - ::= | | > - ::= 'return' > + ::= | | > > (* Expressions *) > - ::= | | > - ::= > - ::= '=' > - | '*=' > - | '/=' > - | '%=' > - | '+=' > - | '-=' > - | '<<=' > - | '>>=' > - | '&=' > - | '^=' > - | '|=' As I said before, these _assignment operators_ are already implemented. I have implemented it before we start the language spec. I will prepare a patch to fix the spec. > + ::= | | > + ::= > + ::= '=' > > (* Identifiers *) > ::= 'u32' > -- > 2.44.0 >