Nondestructive assignment using = with { }
#8114
Replies: 2 comments 3 replies
-
But why? What's wrong with |
Beta Was this translation helpful? Give feedback.
-
Although It might be useful to have inline aliases so we could do something like |
Beta Was this translation helpful? Give feedback.
-
The
with
operator, being a nondestructive binary operator like+
or-
, would have improved ergonomics with an assignment variant like+=
or-=
, for exactly the same reasons. Has anyone proposed one? If not, I'd suggest reversing the syntax order in this case (becausewith=
doesn't look great) and making it a three-token operator of=
,with
, and{
that looks like the following:That syntax aligns it with
= new
for assigning a new instance,= ref
for assigning a reference, and= from
for assigning a LINQ query, so it feels pretty C#-like to me.Beta Was this translation helpful? Give feedback.
All reactions