proposal: allow 'with(Foo):' in addition to 'with(Foo){..}'
Era Scarecrow via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 11 05:41:25 PDT 2014
On Monday, 11 August 2014 at 12:25:52 UTC, Artur Skawina via
Digitalmars-d wrote:
> What you're really looking for is context dependent access to
> the target scope. That would work for statics and enums, but
> would probably require a new syntax (it becomes too misleading
> and/or ambiguous otherwise).
> Not pretty, but sometimes useful when you have a lot of such
> elements and/or when they are generated from DSLs.
I hoped i could give a relative use case for with(): that could
avoid using lots of braces to get the data across without heavy
verbose duplication. With the bulk static data that has to be
entered manually, it quickly gets ugly that it's F.A F.B F.C F.D
every few lines when you know A, B C & D's presence is enough to
describe what it's doing.
Honestly i can live without with():, but after it's been
presented and i consider what it could mean, i can't help but
want it. Yeah it's probably limited of when it's actually useful,
but for static data and constants and enums that literally
removes 10-20k from my source file dropping it from 60-70k to 50k
or smaller, that means a lot to me.
More information about the Digitalmars-d
mailing list