Extend with to take multiple arguments
Amex
Amex at gmail.com
Thu Jun 6 20:21:17 UTC 2019
On Thursday, 6 June 2019 at 07:19:15 UTC, Laurent Tréguier wrote:
> On Thursday, 6 June 2019 at 00:29:33 UTC, Adam D. Ruppe wrote:
>> On Wednesday, 5 June 2019 at 21:02:39 UTC, 12345swordy wrote:
>>> tbh I found the with keyword to be unnecessarily verbiage. In
>>> C# you can initialize a class like this:
>>> var exp = new Class { };
>>
>> What does that have to do with the `with` keyword?
>
> I think that what 12345swordy means is that in C#, you can
> directly initialize class members in the curly brackets:
>
> var exp = new Something() {
> SomeMember = 42
> }
>
> So you get shorter syntax to init class members, without the
> need for a "with" keyword.
I don't use with just to initalize but many things... it cuts
down having to specify a reference.
with(XX) with(YY)
{
swith(q}
{
case a
}
if (b)
foo(y)
}
}
where q,a,b,y all come from XX and YY.
Having to specify all the withs gets redundant(since it has to be
done for each scope, I usually use it at the function level).
More information about the Digitalmars-d
mailing list