From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@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 UTF8SMTPS id 1BBB169E0B
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:31:44 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with UTF8SMTP id 1138035A25
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:31:44 +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 UTF8SMTPS id 1EE7235A16
 for <pmg-devel@lists.proxmox.com>; Wed, 24 Mar 2021 08:31:41 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with UTF8SMTP id CB19D4192F;
 Wed, 24 Mar 2021 08:31:40 +0100 (CET)
Message-ID: <1652ef3e-d29c-45a4-8dfa-09db3322260b@proxmox.com>
Date: Wed, 24 Mar 2021 08:31:39 +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: Thomas Lamprecht <t.lamprecht@proxmox.com>,
 Dietmar Maurer <dietmar@proxmox.com>,
 Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
References: <79994563.854.1616523747514@webmail.proxmox.com>
 <28ca9b85-a8fd-d204-5586-07657c3ecaaa@proxmox.com>
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <28ca9b85-a8fd-d204-5586-07657c3ecaaa@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.180 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
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [sencha.com]
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:31:44 -0000

On 3/24/21 08:21, Thomas Lamprecht wrote:
> 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...
> 
> 

but AFAIR, extjs actually parses the function *text* to find the
data dependencies (see 
https://docs.sencha.com/extjs/6.0.1/classic/src/Formula.js.html)

and i hope that the JIT does not change the text of the function
at all....