Thread overview
Formalize my 2d opApply hack and clarify what your suppose to return
1 day ago
monkyyy
12 hours ago
Nick Treleaven
12 hours ago
monkyyy
1 day ago

https://github.com/dlang/dlang.org/issues/4307

https://forum.dlang.org/thread/csdnlhnlncjaxlvljxaa@forum.dlang.org

The spec as written while technically correct, doesnt give all the information on whats possible and when reading THE TOUR people were unable to apply it correctly to the 10 lines of code they just read

I suggest changing the spec to explicitly allow my hack, document the goto magic ints behavior to be best of whoever ability and being explicitly anti return 1;

To the best of my knowledge the compiler keeps a stack of lables and each opApply it -- a int, break lable finds that int and counts where it is on the stack, passing that into opApply. If its zero continue, if its not your suppose to pass it as is to the next guy. I believe this allows for 2d breaking in a single iteration by breaking via label or locally by decting 1 vs >2.

Needs some testing but Im pretty sure it just works; need some bolded text that say "do not write return 1; in an opApply, its wrong" and some test cases.

12 hours ago

On Tuesday, 9 September 2025 at 02:42:56 UTC, monkyyy wrote:

>

The spec as written while technically correct, doesnt give all the information on whats possible and when reading THE TOUR people were unable to apply it correctly to the 10 lines of code they just read

Tour fix: https://github.com/dlang-tour/english/pull/385

>

I suggest changing the spec to explicitly allow my hack, document the goto magic ints behavior to be best of whoever ability and being explicitly anti return 1;

Quirin has a solution to stop people being able to write that in the next edition: https://github.com/dlang/dmd/issues/20465. This is needed to make opApply @safe.

12 hours ago

On Tuesday, 9 September 2025 at 20:57:33 UTC, Nick Treleaven wrote:

>


Quirin has a solution to stop people being able to write that in the next edition: https://github.com/dlang/dmd/issues/20465. This is needed to make opApply @safe.

Without utilities to use it I view this as an anti-fun idea

If you add some api to the magic int maybe to interface with the-lable-stack(?) maybe it wouldn't just be breaking code, I still would like to hear what the hell lables are actually cause apparently theres some magic there