I believe the indices in your examples are updated in the wrong place. The 
following seems to do what I believe you expect: 
https://go.dev/play/p/U2YQM3fOz98

Pascal

On 16 Aug 2024, at 00:08, 'Dan Kortschak' via golang-nuts 
<golang-nuts@googlegroups.com> wrote:

Currently the Gonum graph packages make use of go:linkname abuse to be
able to implement first class iterator values that can be passed. We
also have a reflect-based implementation, but this incurs a significant
performance cost and so cannot be used as the default implementation
(users are able to select this through build tags).

With the advent of function iterators it would (superficially) appear
that there would be a path towards making this kind of iterator value
more generally available. This currently does not work (for example
here: https://go.dev/play/p/yb-c7f_E7t3
and https://go.dev/play/p/T3lbn-XrnYd, both of which are surprising
from a the perspective of a pre-rangefunc Go user). This is not the
case with map iterators since there is no corresponding index that is
meaningful in that context, but this is a matter of runtime
implementation.

Is there any chance that something like this would be supported in the
future?

Dan

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d0b3bffaff27f7d3b501b1f2d327eb94e95d0829.camel%40kortschak.io.

Intel Corporation nv/sa
Froissartstraat 95
1040 Etterbeek
RPR (Brussel) 0415.497.718. 
Citibank, Brussels, account BE52 5701 0312 5509

This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). Any review or distribution by others is 
strictly prohibited. If you are not the intended recipient, please contact the 
sender and delete all copies.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8200764E-1651-4422-A10B-043513B13215%40intel.com.

Reply via email to