Necessities for Adoption of D
Simen Kjaeraas
simen.kjaras at gmail.com
Sun Feb 10 09:22:50 PST 2008
Vladimir Panteleev <thecybershadow at gmail.com> wrote:
> On Sun, 10 Feb 2008 14:47:00 +0200, bearophile
> <bearophileHUGS at lycos.com> wrote:
>
>> Wax was developed for Python, that has named arguments too, so that
>> Python code may look like:
>>
>> tb = TextBox(parent, size=(400, 200), multiline=1, readonly=0, wrap=1,
>> justify='left')
>
> D isn't too far off with "with" statements. Example DFL code:
> with(tb = new TextBox) { bounds = Rect(100, 100, 200, 200); multiline =
> true; readOnly = false; wordWrap = true; parent = this; }
Now if only you could declare a new variable within a with statement. It's
not strictly necessary, but I find
with (auto tb = new TextBox()) { ... }
to be more aesthetically pleasing than
auto tb = new TextBox();
with (tb) { ... }
of course, given that with introduces a separate scope, tb might go out of
scope the moment the with statement exits. This might be open to
interpretation though, seeing as tb is declared outside the curly braces.
> And with the new full closures, you can implement event handlers inline,
> too.
>
More information about the Digitalmars-d
mailing list