Comments (11)
It does operate on strings, but on a more complex level (it's not just code.to_string()
, because the format ends up being different and breaks the code).
I think your solution will work, I'll try it and add a test to check it, thanks!
from akin.
I completely missed this.
It's kind of difficult to fix because on how akin
currently works (treats code as a string and .replace() each variable with the corresponding value), but I'll look into it.
Thanks for pointing it out!
from akin.
So does akin
actually operate on strings, or was this just a way to describe the approach?
If the former: You could sort the list of identifiers, and then iterate over that list in reverse order. This way, the longest identifier of identifiers with a common prefix would be replaced first, which would fix the problem.
If the later, and it is too difficult to fix: I don't think this would be a big deal if it's mentioned in the documentation.
That being said, the issue resulted in a pretty strange error, without any useful information. Fortunately (after some time), I used cargo expand
to see what was going on.
from akin.
Added fix and test to version 0.3.1, could you test it with your code and see if it is really solved? If it is I'll close the issue.
from akin.
Sure. It seems, the problem still exist in 0.3.1. Does it work properly for you?
Edit: I see that you have a test that for it, which passes. Very strange, that I still get the error.
from akin.
Very odd. When I copy your test to my code, it works.
Tomorrow I'll try to figure out what is going on, and to create reproducible example. Maybe the current test is too simple to trigger the problem.
from akin.
Found the bug cause, it is a problem with the function that finds what variables are used in a code snippet.
It"ll probably require a refactor of this function, expect it to be solved in a couple of days, as it's a bit tricky to do right.
from akin.
Thanks for the update. Okay, let me know, when I should test the new fix. Knowing about the problem, it's obviously not a problem for me personally anymore (so no need to hurry).
If you can, send me the code in question, I'll try to look into what's akin generating exactly
The code is pretty complex and uses many external and internal dependencies, therefore I wanted to create a minimal example that reproduces the issue.
from akin.
Refactor done, it should now work on version 0.3.3
I've also added an additional test (it is a real-world example that wasn't working due to this bug).
from akin.
It seems to be fixes. Thanks, @LyonSyonII!
from akin.
Great, finally! I'll close the issue then
from akin.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akin.