Covariant overrides on the Buffer Hierachy

Zhong Yu zhong.j.yu at
Tue Apr 22 02:30:47 UTC 2014

On Mon, Apr 21, 2014 at 7:07 AM, Ulf Zibis <Ulf.Zibis at> wrote:
> So to me, this is clearly a language matter, not to solve by tricky
> footprint and/or performance lasting code on APIs:
> People want a _smart syntax_ for consecutive method invocations on the same
> object, that's all!

Amen to that!

However I'm a little concerned with the mental effort a reader needs
to figure out the implicit method receiver. I'd like to see more
explicitness in establishing the implicit method receiver, something
like Pascal's with statement.

    expr "."
        // expr is the implicit receiver for this block
        foo(); // interpreted as

so that we could write


    string.{ mySub=subString(indexOf("C"), indexOf("Q")); }

    new HashMap<>().{ put(n1,v1); put(n2,v2); }

    new Button().{ color(red); text("hello"); onClick(event->color(blue)); }

Zhong Yu

More information about the core-libs-dev mailing list