Article View: comp.lang.c
Article #1294Re: p = {1,0,0}
From: bartc
Date: Tue, 03 Nov 2026 14:07
Date: Tue, 03 Nov 2026 14:07
75 lines
3804 bytes
3804 bytes
On 03/11/2026 12:19, fir wrote:
> bartc pisze:
>>>>>> On 01/11/2026 13:32, fir wrote:
>>>>>>> the fact stat some cannot assign a structure like
>>>>>>> this
>>>>>>>
>>>>>>> s = {x,y};
>> (It seems to work in my language, provided the expression isn't
>> 'open'. So 'a := (x, y)' will work, as the LHS helps refine the type,
>> but not 'print (x, y)' because the types have not been pinned down.)
>>
>>
>
> [legal note:
> imo if you take some ideas from me you should credit it (its like "i
> seen it from the fir "or "as fir said/showed") ..im here speaking
> generally becouse (i cant find as a copyright police what people took
> for me and what by the chance no)
You think I stole this 'feature' from your recent post?
In the early 1990s I could write code like this in my scripting language:
p := (100, 200, 300)
q := (20, 30, 40)
m := (p + q) / 2
println m # (60.00, 115.00, 170.00)
It was a 3D graphics application.
In my systems language, it worked like this, and from the 1980s:
record point =
int x, y
end
point p = (100, 200) # RHS must be compile-time expr
But general assignments, outside of initialisation and with runtime
expressions, were not implemented until within the last decade (I can't
remember exactly as I rarely use the feature, but it was more than two
days ago). That means being able to do this:
p := (x+1, y)
Such an ability is a natural consequence of the syntax which has always
been able to express it. It's just a question of (1) whether it has
useful and desirable semantics; (2) someone has bothered to implement it.
So it has been a thing since the 1980s, and I eventually got around to
it some decades later.
Notice also that it uses round brackets and not braces.
> i know people are not much honest
> anyway..yet this above is quite not so totally unusual observation
> (though many undable to dat obeservations) but speaking generally]
Yeah, nobody has thought of having a constructor term like (a, b, c) in
a PL before you brought it up! Not even in Lisp.
Anyway, DB mentions that C++ has it in the form of {a, b, c}.
> same way {1,2,"assas", 8.9} is value of anonymous structure of type int
> int char* double (or eventually float)
> no any problem with that imo
How do you access the elements?
Technical Details
Message-ID:
<11ccpr5$3qfhd$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me> <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me> <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me> <11ccjfo$3nvjc$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: bartc <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Tue, 3 Nov 2026 14:07:32 +0000
Organization: A noiseless patient Spider
Lines: 75
Message-ID: <11ccpr5$3qfhd$1@dont-email.me>
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me>
<11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me>
<11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me>
<11ccjfo$3nvjc$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 03 Nov 2026 14:07:34 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="4013613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198YB9EKSuPeuk8sp5xHiyr"; posting-host="853800b9025500c01cf642049ea4c4b1"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3F5q87mEbBtmr7Xdu7JDzVLxw9I= sha256:Xz6+GEcVpVUxoI8InEBRF7Uz7oA+VNu0PmMQVIgVj6Q=
sha1:9z0ATpQWxsxwodNT1VADlOvqwVU= sha256:lYSm0oZiaZQco3pG6tKhda5tpiSYoqugPq05lNNIe/s=
Content-Language: en-GB
In-Reply-To: <11ccjfo$3nvjc$1@dont-email.me>