-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Specification compliant ToString
(to_string
)
#425
Conversation
Benchmark for 4b86b35Click to view benchmark
|
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.
Looks very good, I added some comments in places I thought we could improve readability, mostly :)
Benchmark for 8be4ad9Click to view benchmark
|
- Moved value display logic to value/display.rs
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
- Coverage 66.72% 66.64% -0.09%
==========================================
Files 123 124 +1
Lines 8809 8852 +43
==========================================
+ Hits 5878 5899 +21
- Misses 2931 2953 +22
Continue to review full report at Codecov.
|
Benchmark for f92de8eClick to view benchmark
|
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.
This is good to go! :)
This PR makes
ToString
(to_string
) spec compliant.What was wrong with the previous implementation?
The previous implementation used to
ToString
trait which was automatically implemented forDisplay
, the problem is that we use different logic for displaying and converting toString
type, for example, converting a string value to aString
type with displaysto_string
is"some string value"
(don't get the quotes, because the is a bug #373) but with the spec compliant function it'ssome string value
without the quotes.Additionally the spec compliant version should call
to_primitive
on objects and if it was to throw an exception it would have to propagate it.This PR should unblock #373 .
Changes:
Value
display logic tobuiltins/value/display.rs
to_string
to interpreterto_string
=> interpretersto_string