9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Matthew Veety <mveety@gmail.com>
To: 9fans@9fans.net
Subject: Re: [9fans] Typestr usage (inspired by libgeometry)
Date: Tue, 16 Dec 2025 19:29:13 -0500	[thread overview]
Message-ID: <6973d9ad-83d2-4375-8a30-c7a669980d38@gmail.com> (raw)
In-Reply-To: <9B381DFBBE425AD6AD846363E0251600@eigenstate.org>

On 16/12/2025 10:35 am, sirjofri via 9fans wrote:
> Thinking about how typestr provides pretty cool syntactic sugar, I was wondering why that's the case? Is there a goal to maintain the C standard as far as it makes sense, or is it compatibility between plan 9 systems?

I thinks it's a mix of lack of awareness and the hidden function calls, 
I've used this quite a bit and there are some problems with 
maintainability because it hides what you're doing, though it can make 
code easier to write, especially things like typecasts.

On 16/12/2025 11:17 am, ori@eigenstate.org wrote:
> It's a subtly wrong feature -- it looks cute, but doesn't
> generalize well in C. Finishing it would imply garbage
> collection (or at least destructors), which have their
> own disadvantages.

This was years ago so I'm likely misremembering, but there was someone 
(I think qrstuv?) that added destructors and something like Go's defer 
to the compiler. The destructor didn't add any syntax to the compiler as 
is just would call a function defined similarly to the rest of the 
typestr methods. It worked pretty well for what is was. I don't remember 
how (or if) it handled the hidden allocations needed for intermediate 
values in expressions though.

-- 
Veety

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T7ee24291af957db7-Mdd9e0d5ebbed465269a7b017
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

      parent reply	other threads:[~2025-12-17  2:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 15:35 [9fans] Typestr usage (inspired by libgeometry) sirjofri via 9fans
2025-12-16 16:17 ` ori
2025-12-16 18:25   ` sirjofri via 9fans
2025-12-16 19:32   ` Skip Tavakkolian
2025-12-17 12:03     ` arnold
2025-12-17  0:29   ` Matthew Veety [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6973d9ad-83d2-4375-8a30-c7a669980d38@gmail.com \
    --to=mveety@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).