Re: How do I _really_ implement opApply?

2022-11-29 Thread zjh via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 01:17:14 UTC, zjh wrote: Should there be an `intermediate layer` to simplify such function calls? There should be a `placeholder` similar to `inout` that can absorb all `attributes` of the parameter.

Re: How do I _really_ implement opApply?

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 01:30:03 UTC, Steven Schveighoffer wrote: On 11/29/22 7:50 PM, WebFreak001 wrote: (note: I don't want to use a template, this way of writing it has the advantage that the compiler checks all different code paths for errors, so the errors aren't delayed until

Re: How do I _really_ implement opApply?

2022-11-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/29/22 7:50 PM, WebFreak001 wrote: (note: I don't want to use a template, this way of writing it has the advantage that the compiler checks all different code paths for errors, so the errors aren't delayed until someone actually tries to iterate over my data structure) 1. use the

Re: How do I _really_ implement opApply?

2022-11-29 Thread zjh via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 00:50:46 UTC, WebFreak001 wrote: ... Should there be an `intermediate layer` to simplify such function calls?

Re: How do I _really_ implement opApply?

2022-11-29 Thread WebFreak001 via Digitalmars-d-learn
note: all of these functions are prefixed with `scope:`

How do I _really_ implement opApply?

2022-11-29 Thread WebFreak001 via Digitalmars-d-learn
it seems now when trying to cover scope semantics, @safe/@system and pure it already becomes quite unmanagable to implement opApply properly. Right now this is my solution: ```d private static enum opApplyImpl = q{ int result; foreach (string key, ref value; this.table) { result =