Photon v0.13.0 with offload
IchorDev
zxinsworld at gmail.com
Mon Sep 1 10:22:03 UTC 2025
On Monday, 18 August 2025 at 15:20:14 UTC, Dmitry Olshansky wrote:
> ```d
> void main() {
> startloop();
> go({
> goOnSameThread({
> writeln("Blocking computation");
> writeln("Integral:", gauss(0.0, 10.0, x => x*x,
> 1e-7));
> });
> });
> runFibers();
> }
> ```
One thing that I think could really be improved about Photon is
these funny symbol names.
- `startloop` is all-lowercase. It's two words so shouldn't it be
`startLoop`?
- `go` doesn't actually do any 'go-ing' right away, since fibres
are deferred; so it's a little misleading. Maybe it could be more
like `schedule`?
- `goOnSameThread` is hyper-explicit compared to `go`, but its
name still didn't help me understand it until I read the docs.
Perhaps `goSync` or `scheduleSync` would be more intuitive?
- `runFiber` is an unfortunate victim of the American-English
disease. It would be nice to have an alias for 'fibre', which is
the spelling used in the rest of the English-speaking world.
Would also be great to have a function named something like 'end
loop' that cleans up everything that the library uses internally
and allows Photon to be freshly re-initialised with `startloop`
again later. This would be essential to using Photon in a modular
environment. If Photon is no longer needed, then we don't want it
hogging resources until the process dies. Obviously calling such
a function should not work within a fibre.
More information about the Digitalmars-d-announce
mailing list