From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 18A4C69E06
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:21:46 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 0FFB935978
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:21:46 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 95A3C3596B
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:21:45 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 577A04267A
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:21:45 +0100 (CET)
Message-ID: <28ca9b85-a8fd-d204-5586-07657c3ecaaa@proxmox.com>
Date: Wed, 24 Mar 2021 08:21:44 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101
 Thunderbird/87.0
Content-Language: en-US
To: Dietmar Maurer <dietmar@proxmox.com>,
 Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
References: <79994563.854.1616523747514@webmail.proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <79994563.854.1616523747514@webmail.proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.045 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic
 dependency in view model
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 24 Mar 2021 07:21:46 -0000

On 23.03.21 19:22, Dietmar Maurer wrote:
>> So, if on evaluation a get(X) is missed due to it being not always called,
>> like with boolean statements where a single truthy is enough for an or expression
>> like above, that data dependency is lost and one may see bug like behaviour.
>>
>> Use intermediate variables to combat that, for example, above `accountValueHidden`
>> formula should read:
>>
>> accountValueHidden: (get) => {
>>     let editable = get('accountEditable'), available = get('accountsAvailable');
>>     return !editable || !available;
>> },
> 
> I guess a good JIT can still optimize that away?
> 


You're right, that may be the case.
Albeit, I guess that for such short method where the JS engine cannot know if it is
a "hot" function (lots calls) so the JIT won't be used initially, and the interpreter
probably isn't smart enough to detect this optimization.

At least above approach helped a bit ago when I ran in such a bug, but yeah, it may
not be really future proof...