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, [email protected] 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

Reply via email to