-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add to_buffer(string) and use it when initializing a buffer #1907
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1907 +/- ##
=========================================
Coverage 36.37% 36.38%
- Complexity 18830 18833 +3
=========================================
Files 1083 1083
Lines 166605 166619 +14
Branches 35391 35393 +2
=========================================
+ Hits 60609 60622 +13
+ Misses 96110 96109 -1
- Partials 9886 9888 +2
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to have in main, but I think there are a fair few scripts (e.g. Ezandora's) which define
buffer to_buffer(string str)
{
buffer result;
result.append(str);
return result;
}
for the convenience, and which will now conflict and error. I think s.replace_string("", "")
is also popular.
Yeah. Ezandora's scripts concern me. On the other hand, we could make the compile error into a warning. If the script is not depending on the RuntimeLibrary version, no big deal if it redefines it - even to something not equivalent. |
And, oh - for replace_string, we don't want a string to auto-coerce into a buffer. Operator is allowed to check coercion based on context: "assign", "return", "parameter". Hmm. |
Also, your Bastille script. And TourGuide. And those are just the ones I have installed. |
Interesting.
works nicely if I declare the library function like this:
but not if I declare it like this:
There is no way for the user to declare a function whose argument is a STRICT_STRING_TYPE |
I made this script:
which yields:
The good news is that the user defined function really does override the library function. I don't see an immediate clean solution to the STRING_TYPE != STRICT_STRING_TYPE issue.
It compares Type using equals(). No special casing to pretend STRING_TYPE is the same as STRICT_STRING_TYPE.
I'm inclined to do #1, for now. |
I've wanted to be able to do this for a long time:
Now I can.
I also moved creation of the (buffer) return value of visit_url() to the top of the method, rather than duplicating the creation in two places.