incrediblers
Joined 2 months ago
Joined 2 months ago
But this made me think...
> "The getter ought to have a shorter name since it is probably called more frequently"
So i checked. Rough agent driven counts:
https://github.com/ronilan/incredible-flappy 407 setters and 183 getters.
https://github.com/ronilan/rusticon 546 setters and 5 getters
https://github.com/ronilan/shape-sorting 688 setters and 33 getters.
And in a code editor with a lot of ui configurations based on reusable elements 2865 setters and 206 getters.
In reactive apps on state handlers call on setters with state values. No getters involved...
// Mine
let label = Label.text("Hello Wold");
let label_text = label.get_text();
// Theirs
let label = Label.set_text("Hello Wold");
let label_text = label.text();
A method is a way to accomplish a specific task. Emphasis on specific not generic. The getter task is to always return. The setter task is specific. So the method should be the setter - `text`, `color`, `fill`. In Rust the getter can't have same name, so prefix it. Not the other way around.“Text selection should highlight a character when the mouse is beyond mid point and not after the whole character.”
This one’s interesting regarding event trigger because selection is at the TUI level where there are no more pixels just chars.
I am aware of issues. Note that this is not a "website" in the regular sense of the word. This is actually a TUI app written in rust and compiled to wasm (and other platforms too: https://github.com/ronilan/incredible/releases) as parrt of alpha testing of the Incredible TUI framework.
Creating the screen, reading a markdown file, laying out the text, colouring it, enabling the scroll, managing it, changing the mouse pointer over the scroll bar, responding to the drag on said scroll bar, underlining the links, colouring them when they are hovered, removing colour when they are not, inverting them when they are clicked, loading the next markdown page, changing the browser URL hash, the keyboard shortcuts, Ctrl+e to select all, Ctrl+c to copy, etc. - it's all coming from Incredible TUI framework, not the browser.
Feedback on all aspects much appriciated.
https://www.incredible.rs/