Hello,

Here's a simple class:

    class Point { has $.x is rw; has $.y is rw; }

'with' seems to return the result of evaluating the block. E.g. this
expression will return a Point:

    with Point.new { .x = 10; $_; }

Whereas this will return 10:

    with Point.new { .x = 10; }

Is there a way for a user to define a variant of 'with' which returns the
target object instead of the result of the evaluating the block? I.e.:

    with_alt Point.new { .x = 10; }

would return a Point.

And this:

    (with_alt Point.new {.x = 10}; with_alt Point.new {.y = 20})

would return a list of two Points.

Thanks!

Ed

Reply via email to