-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
replace: substring on match function argument error #5673
Comments
More SubString fallout. The replace("test <% 1 %> test", r"<%(.*?)%>"s, s -> parse(utf8(s[3:end-2]))) We probably need to teach |
Confirmed that works using replace("test <% 1 %> test", r"<%.*?%>"s, s -> parse(utf8(s[3:end-2])))
#=> "test 1 test" |
See also #5675 |
The right thing is for |
… conversion (fix JuliaLang#5673, subsumes JuliaLang#5675)
… conversion (fix JuliaLang#5673, subsumes JuliaLang#5675)
Thanks, @stevengj, that sounds good. |
Those null terminators really are hell. Either we make functions like replace and split slower up-front, or we face copying a string potentially many times. One slightly scary option is to update SubStrings in-place with null-terminated copies as necessary, so copying is never needed more than once for a given string. I'm not sure whether that's worthwhile or advisable though. |
Even scarier option: Just temporarily write a null character into the string during the |
Wow, that is true evil genius. |
(But if the |
Oh, man. That's so crazy it might work. I'm not sure if exception trapping is going to be low enough overhead though. |
It would also need to check for partially overlapping sub-strings, and use copies in that case. |
@carlobaldassi, that's true, the unusual case of passing multiple substring arguments to the same function would be tricky. Also, this would be very difficult to do automatically because of perverse situations involving passing callback functions. |
The main concern here is that in C, strings are mutable. |
Hello,
I'm implementing a simple template engine for Julia (version 0.3.0-767~ubuntu13.10.1). I get this error:
It should be a bug, isn't it?
The text was updated successfully, but these errors were encountered: