On 10/24/17 10:30 AM, Sönke Ludwig wrote:

Am 24.10.2017 um 16:25 schrieb Steven Schveighoffer:

On 10/24/17 4:45 AM, Sönke Ludwig wrote:

On Tue, 24 Oct 2017 07:21:15 GMT, Alexey Kulentsov wrote:

On Mon, 23 Oct 2017 23:05:42 GMT, Sönke Ludwig wrote:

void fn(const Task task)
{
     ...
     taskIdToStore = task.tid.toString;
     ....
}

and can't because of 'mutable method vibe.core.task.Task.tid is
not callable using a const object'

The method itself can be made inout, but the problem is that,
AFAICS, a const(Tid) isn't usable for sending or receiving
messages either.
  Yes, I understand. But it still can be useful if I want only to
collect tasks ID's to use it in another place.

Added:
https://github.com/vibe-d/vibe.d/commit/c50c962748e4ec6d62cfa532fa0a03827bbfcd5d

https://github.com/vibe-d/vibe-core/commit/874e174d38be6520f301453f75e4660dc5b158c3

inout should have been used, much cleaner IMO.

https://github.com/vibe-d/vibe.d/pull/1962
https://github.com/vibe-d/vibe-core/pull/38

The problem is that inout also matches immutable, so that the
ternary operator deduces the expression type to const instead of
inout (because the static variable is mutable).

This is, unfortunately, a limitation of inout. const(inout) can match
immutable or inout, but there is no equivalent for mutable.

I hadn't noticed that the property partially depended on static global data.

So I closed those PRs, what you have is the best that can be had.

-Steve