Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider func and and sideEffect free #5

Open
arkanoid87 opened this issue Oct 22, 2022 · 4 comments
Open

Consider func and and sideEffect free #5

arkanoid87 opened this issue Oct 22, 2022 · 4 comments

Comments

@arkanoid87
Copy link

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
Copy link
Member

Vindaar commented Oct 22, 2022

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
Copy link
Member

Vindaar commented Oct 22, 2022

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:

  • I'm not sure if I break some use cases (essentially every code path gets the same IDs. It should be fine I guess, for same inputs it's the same variables. For other inputs the value / uncertainty pairs are different. But it's quite possible I miss something
  • turning the basic API into a macro for this isn't great

@arkanoid87
Copy link
Author

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
Copy link
Member

Vindaar commented Oct 22, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants