Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Argument for Enabling Floats in the UI Framework:
The decision to not render
Float
values directly in thehacksaw.ui
framework is understandable given concerns about localization and formatting. However, in practical applications, especially those involving dynamic or interactive elements like sliders and audio controls, the ability to render and manipulateFloat
values directly can greatly enhance the developer experience and the functionality of the UI. Below is an example of aPanVolumeView
component that illustrates this point:Explanation:
Enhanced Real-Time User Interactions:
RangeInput
component in the example allows users to adjustpan
andvolume
with fine granularity usingFloat
values.0.001
ensures a smooth and precise user experience. Without directFloat
support, achieving this level of granularity would be cumbersome and might necessitate additional conversion logic, potentially leading to performance overhead or added complexity.Maintaining Format Control:
formatVolume
andformatPan
convert the float values into user-friendly strings for display.Reducing Boilerplate Code:
Float
values would reduce the need for repetitive conversion code across components. Developers could bindFloat
values directly to UI elements, simplifying the codebase and minimizing the likelihood of errors in manual conversion logic.Supporting Advanced Use Cases:
Float
values would significantly enhance the framework's flexibility and power.Float
values directly allows them to see exact values, avoiding oversimplification or misinterpretation from forced string conversion.Internationalization Applies to Integers Too:
Using
Int
Instead ofFloat
Adds Extra Code and Complexity:Int
values and scale them to represent floats (e.g., multiplying by 1000 to avoid usingFloat
directly), this approach adds unnecessary complexity to the codebase. Developers must write additional logic to scale, convert, and then correctly format these values, which increases the likelihood of errors.0.001
using an integer, you would need to store it as1
and manually convert it back to0.001
when needed. This not only complicates the code but also makes it harder to maintain and understand.Avoiding Unnecessary Developer Work:
Avoiding Redundancy in Simple Applications:
Float
toString
can feel redundant and unnecessary.Minimizing Errors in Manual Conversion: