Date: Mon, 20 May 2019 14:28:14 +0200
Hello Andrew,
after reading through your proposal I found some things that don't seem
quite right.
While I can understand the need of a garbage collector in some use cases,
the one featured in the proposal is one of the less convincing examples.
The code is generating a lot of objects that are not needed anywhere just
to throw them away some time later.
For me, this is an anti-pattern.
Using a Dungeon class as owner for the rooms of the Dungeon, rather than
just defining ownership by the room self-referencing each other, you can
implement your example with an recursive approach:
http://coliru.stacked-crooked.com/a/3e5887dd4686e09b
There is still a lot to optimize, but I don't see the need for gc.
Regards,
Simon
P.S.
1. Your main-function uses 'uniform_real_distribution' instead of
'uniform_int_distribution'. This won't compile for size_t.
2. You are initializing the Mersenne-Twister generators with 'std::mt19937
gen(std::random_device{});' which should be 'std::mt19937
gen(std::random_device{}());' (parenthesis)
Am Fr., 17. Mai 2019 um 11:26 Uhr schrieb Andrew Tomazos via Std-Proposals <
std-proposals_at_[hidden]>:
> Oops, this was supposed to go to std-proposals_at_[hidden] not
> std-proposals_at_[hidden]
>
> ---------- Forwarded message ---------
> From: Andrew Tomazos <andrewtomazos_at_[hidden]>
> Date: Wed, May 15, 2019 at 9:20 PM
> Subject: Proposal of Handles (draft 2)
> To: <std-proposals_at_[hidden]>
>
>
> Please find attached a working draft of:
>
> Proposal of Handles
>
> Feedback appreciated.
>
> Regards,
> Andrew.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
after reading through your proposal I found some things that don't seem
quite right.
While I can understand the need of a garbage collector in some use cases,
the one featured in the proposal is one of the less convincing examples.
The code is generating a lot of objects that are not needed anywhere just
to throw them away some time later.
For me, this is an anti-pattern.
Using a Dungeon class as owner for the rooms of the Dungeon, rather than
just defining ownership by the room self-referencing each other, you can
implement your example with an recursive approach:
http://coliru.stacked-crooked.com/a/3e5887dd4686e09b
There is still a lot to optimize, but I don't see the need for gc.
Regards,
Simon
P.S.
1. Your main-function uses 'uniform_real_distribution' instead of
'uniform_int_distribution'. This won't compile for size_t.
2. You are initializing the Mersenne-Twister generators with 'std::mt19937
gen(std::random_device{});' which should be 'std::mt19937
gen(std::random_device{}());' (parenthesis)
Am Fr., 17. Mai 2019 um 11:26 Uhr schrieb Andrew Tomazos via Std-Proposals <
std-proposals_at_[hidden]>:
> Oops, this was supposed to go to std-proposals_at_[hidden] not
> std-proposals_at_[hidden]
>
> ---------- Forwarded message ---------
> From: Andrew Tomazos <andrewtomazos_at_[hidden]>
> Date: Wed, May 15, 2019 at 9:20 PM
> Subject: Proposal of Handles (draft 2)
> To: <std-proposals_at_[hidden]>
>
>
> Please find attached a working draft of:
>
> Proposal of Handles
>
> Feedback appreciated.
>
> Regards,
> Andrew.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2019-05-20 07:30:14