foo?=bar:baz
is rewritten as foo.opOpAssign!("?:")(bar,baz)
foo[i]?=bar:baz
opIndexOpAssign
for basic types it acts as foo=(bool)bar?foo:(typeof(foo))baz
Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 02, 2024 ternary op assign | ||||
---|---|---|---|---|
| ||||
for basic types it acts as |
May 02, 2024 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkyyy | On Thursday, 2 May 2024 at 17:42:28 UTC, monkyyy wrote: >
for basic types it acts as I find this syntax confusing, I would interpret that as:
|
May 02, 2024 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Thursday, 2 May 2024 at 18:17:12 UTC, Stefan Koch wrote: >On Thursday, 2 May 2024 at 17:42:28 UTC, monkyyy wrote: >
for basic types it acts as I find this syntax confusing, I would interpret that as:
often the statement you want to write is a=condition?b:a which repeats a, the way to simplify (and prevent int promtion issues) is with the += family of statements; but there isnt a clear one for if(cond)a=b Simd(/waterfalled code) has to do bit mask tricks, and I think you could wrap that up in a data structure with the opslice as recursive templates for opindex logic
|
May 16, 2024 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkyyy | On Thursday, 2 May 2024 at 17:42:28 UTC, monkyyy wrote: >
for basic types it acts as Isn’t this just Where would the user-defined operator be useful? |
May 16, 2024 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quirin Schroll | On Thursday, 16 May 2024 at 16:57:17 UTC, Quirin Schroll wrote: >On Thursday, 2 May 2024 at 17:42:28 UTC, monkyyy wrote: >
for basic types it acts as Isn’t this just Where would the user-defined operator be useful? when bar depends on foo; such as a user defined cond, lets saya database query that takes in lamdas
and when its "multiable data single instruction", simd or parrellizism, ranges etc. and theres something in that index |
March 15 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkyyy | Does this appear in other languages? I'm curious what experience there is with it. |
March 18 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sunday, 16 March 2025 at 06:45:03 UTC, Walter Bright wrote:
> Does this appear in other languages? I'm curious what experience there is with it.
Not that I know of
|
March 23 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to monkyyy | On Thursday, 2 May 2024 at 17:42:28 UTC, monkyyy wrote: >
for basic types it acts as What will you do when you use ternary pipe?
SDB@79 |
March 23 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to Salih Dincer | On Sunday, 23 March 2025 at 19:54:29 UTC, Salih Dincer wrote: >What will you do when you use ternary pipe?
Is it promising? SDB@79 |
March 24 Re: ternary op assign | ||||
---|---|---|---|---|
| ||||
Posted in reply to Salih Dincer | On Sunday, 23 March 2025 at 19:59:24 UTC, Salih Dincer wrote: >
Im imagining(if you like assign pass thru)
|