From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id EC0CA1FF142 for ; Tue, 07 Apr 2026 09:48:18 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6EF9BF923; Tue, 7 Apr 2026 09:48:53 +0200 (CEST) Message-ID: <374a3e86-a0c7-445e-8999-d16e547cdf4a@proxmox.com> Date: Tue, 7 Apr 2026 09:48:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH yew-widget-toolkit v2] widget: add 'div' macro To: Thomas Lamprecht , yew-devel@lists.proxmox.com References: <20260402134337.3433085-1-d.csapak@proxmox.com> <3570c013-8109-45cb-a054-7072fcea559e@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <3570c013-8109-45cb-a054-7072fcea559e@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775548063791 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: RHAJNKXRSA4UCSTB3UTZUUGQJ6JQ22WZ X-Message-ID-Hash: RHAJNKXRSA4UCSTB3UTZUUGQJ6JQ22WZ X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 4/5/26 11:07 AM, Thomas Lamprecht wrote: > On 02/04/2026 15:43, Dominik Csapak wrote: >> this is just a simple wrapper around the `Container` widget, but it's >> very useful in situations where bare strings are used in a flex layout, >> since e.g. a `Row` with multiple children that are all strings won't get >> a proper flex layout (since they're not elements) >> >> So instead of writing >> ``` >> Row::new() >> .with_child(Container::new().with_child("Text1")) >> .with_child(Container::new().with_child("Text2")) >> ``` >> >> one can now write >> ``` >> Row::new() >> .with_child(div!("Text1")) >> .with_child(div!("Text2")) >> ``` >> >> which is much shorter and more readable. > > Yes, but why a macro and not a normal method for this? Macro's are a bit > opaque, totally fine if there is a benefit for adding them, but here I > cannot see a big blocker against adding an e.g. TextContainer wrapper or > an Container::new_with_text (might need better naming, but just to relay > the idea), especially if that's your main use case. Or for a more generic > use case we could add a "Container::new_with_child" constructor or also > a wrapper type (SimpleContainer::new(child)). it was just the shortest thing i could come up with. I think the alternatives all don't really save much text vs the original 'Container::new().with_child()' but if we really don't want to use a macro for this, i could live with something like Container::with(...) or Container::text(...) or something like this. the advantage of the macro was also the possibility to have multiple elements with very little syntactic overhead (did not go into detail here in the commit message to be fair) > > And it isn't exactly a plain div, as then one could just use the html! > macro from yew, so the name as is, is IMO not totally ideal. If we go > the macro way (what's Dietmars opinion on this?), I'd favor to call it > container! to better reflect that it uses the pwt container class. actually it's exactly like a 'div' by default. we just have some convenience traits built on top. I think Dietmar also prefers a non-macro way, so i'd send another patch if one of the methods above would be ok for you.