SciNim / Measuremancer

A library to handle measurement uncertainties & error propagation
https://SciNim.github.io/Measuremancer
21 stars 1 forks source link

Consider `func` and and sideEffect free #5

Open arkanoid87 opened 2 years ago

arkanoid87 commented 2 years ago

I was testing measuremancer on my fully "unchained" and "sideEffect" free lib, but I've found out that measuremancer calls imply Side effects

Hint: 'computeW0Deadh' calls `.sideEffect` '-'
>> /home/arkanoid/.nimble/pkgs/measuremancer-0.2.1/measuremancer.nim(216, 6) Hint: '-' called by 'computeW0Deadh'
Vindaar commented 2 years ago

The reason is that we have a global ID counter in the module to keep track of the symbols. I'll think about whether I can replace that either by a fully CT counter or some other solution. But I wouldn't bet on it.

Vindaar commented 2 years ago

Well, I have a CT variant working locally. But that requires me to turn ± and measurement into macros (so that I can register every call to those procedures and increase the ID counter at CT.

Two things:

arkanoid87 commented 2 years ago

If side effects are a requirement, I prefer an easier to maintain measurement package than a convoluted compile time thing to just make it work.

I will convert my code to proc instead. The pro are far larger than the cons

Vindaar commented 2 years ago

Yeah, I tend to agree.

I've pushed the (not cleaned up) code here https://github.com/SciNim/measuremancer/tree/CTcounter if you want to look at it / play around with it.