new A().b() currently requires extra brackets/parentheses
Philippe Sigaud
philippe.sigaud at gmail.com
Sun Sep 9 06:23:07 PDT 2012
On Sun, Sep 9, 2012 at 2:49 PM, Ben Davis <entheh at cantab.net> wrote:
> D's syntax currently requires me to put the new A() part in brackets. So
> instead of
>
> new A().b()
>
> I have to write
>
> (new A()).b()
Hi Ben,
you could use factory functions:
class A {}
A a() { return new A();}
(and appropriate overloads for the different A constructors, of
course). Which would give you:
dialogue=guiDialogue([
guiLabel(titleText).setLayoutHint(GuiLayoutHint.TOP),
fileNameInput.setLayoutHint(GuiLayoutHint.TOP),
currentDirectoryLabel.setLayoutHint(GuiLayoutHint.TOP),
confirmButton,
guiButton("Cancel", {dialogue=null;}),
]);
For the delegate at the end, I *guess* (but I'm not certain) that just
using { ... } will work. It's a void delegate().
Then:
More information about the Digitalmars-d
mailing list