feature request: with(var decl) {}

Chris NS ibisbasenji at gmail.com
Tue Jul 24 18:40:50 PDT 2012


On Tuesday, 24 July 2012 at 23:03:39 UTC, Adam D. Ruppe wrote:
> On Tuesday, 24 July 2012 at 07:03:05 UTC, Chris NS wrote:
>> I can't help thinking it sounds rather like a job for... named 
>> parameters.  Just imagine it:
>
> Yeah, that could do it too, but named parameters have been
> brought up a few times too and there's opposition to it.
>
> I kinda prefer the struct to named params anyway because
> you can store it for later too. But I could go either way.

Oh I know; which is why I wrote in a slightly snarky manner.  I 
still hold out hope.  Your reuse argument for structs is, of 
course, completely valid and compelling.

Another possibility, in cases like that presented in the original 
post, is to write a single struct to be used with all the 
relevant functions -- but then there's the problem of memory 
abuse.  In some cases it may be fine, but tossing around several 
copies of a very large struct, and only using two or three of the 
fields in a given case, is just unreasonable.

-- Chris NS


More information about the Digitalmars-d mailing list