Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lorentz15183279dBy the way, I didn't get this about React either; they define their own InputEvent to be able to make cross-platform statements, and they explicitly don't guarantee that an event object emitted by React is a web Event. They are by all metrics in the best possible position to attach the value to input events directly.
-
lorentz15183279dIn fact, if I had to define a React-like event API, I'd special case input such that the handler signature becomes
(value, event) => void -
lorentz15183279dI retract my outrage, the example was outdated. This is an updated HOF that is nicer to use. I'm still grumpy that this isn't a method on InputEvent though.
-
Demolishun35051279d@AlgoRythm the more I see the less I want to know.
I bet I have code in C++ that would freak people out too. -
lorentz15183279d@AlgoRythm It's neither complicated nor counterintuitive. Its purpose is to simplify moderately complex use cases where the callback can be a single expression but for some reason the string appears twice.
If it didn't have an explicit lifetime annotation it would be counterintuitive or at least suspicious because existentials default to 'static in some cases where a reference wouldn't. -
lorentz15183279dRust developers rely on the explicitness of the language to avoid understanding every detail upfront, so a big declaration isn't generally complicated or difficult.
-
Fast-Nop39106279dReact in Rust? For blogs where the only reason why they don't fail at basic stuff like clicking on links and actually loading a page is that the project doesn't get finished at all? ^^
-
lorentz15183279d@Fast-Nop Not finishing the project is a motivation issue which can be addressed with Rust's DX. But no, this is a bookmark manager / custom start page.
-
lorentz15183279dand its main purpose is explicitly to learn the Yew-Actix-Diesel full Rust stack. Getting a fancy bookmark manager is secondary
-
Fast-Nop39106279d@lorentz And also, it's not a motivation issue. It's a penchant for overly complicated solutions, then losing motivation after the resulting mess got too entangled to actually fix it.
-
lorentz15183278d@Fast-Nop Programming is a puzzle, some languages have visibly different connections, others look like they'd fit until you look at the whole thing together.
-
Fast-Nop39106278d@lorentz I see programming as puzzle how to solve a problem. By contrast, a puzzle language puts riddles by its own, unrelated to the problem.
For example, when implementing a simple data structure like a double linked list requires advanced language skills, then the language qualifies as puzzle language because it gets in the way. -
lorentz15183278d@Fast-Nop A doubly linked list doesn't require special language skills in Rust, it just requires regular language skills, and knowing how long your objects actually live, just as it does in C++, C, Zig and every non-garbage-collected language. The most straightforward way to implement it is with Rc-s or Arc-s in one direction and Weak-s in the other. It may be wise to implement Drop manually for the list node and drop the tail in a loop because - again, just like in C++ - by default destructors are called recursively and might overflow the stack.
-
lorentz15183278d@Fast-Nop If you want custom lifetime behaviour, you can also implement it with pointers and unsafe, using basically the same toolset as C++. Safe rust is recommended because it's even easier than that, not because manual lifetime management is somehow harder than in other languages.
-
kobenz868278d@lorentz you can't have it as a method and keep it working the same, a trait tho, a trait would be reasonable
-
devRancid648278d> I love the Rust community
They're the worst, obnoxious and denying language design faults with bs excuses all the time
Have fun changing 50 files because a lifetime/async gets added and waiting 2 hours to compile 🤡
Not even getting noticeable performance improvements for the frontend but it's unmaintainable -
lorentz15183278d@devRancid In what circumstances did you encounter a need to change things where you wouldn't expect the change to affect the types in question?
-
lorentz15183278d@devRancid I found that existentials help a lot by the way. When I needed to add and remove generics a lot from a context struct in Orchid, I eventually defined a ParseContext trait and passed around a `ctx: &impl ParseContext` which hid the changes to the concrete type. In older versions where existentials weren't supported, this would've been
`<C: ParseContext>(ctx: &C, ...`
which feels a bit heavy when most functions that forward this parameter are 7 lines long, but I think I could've gotten used to that too.
I don't know if this is relevant to your use case, I just remembered it from the wording of your complaint. -
lorentz15183278d@devRancid I agree that they're very defensive though, just today I read that Rust only suports cheap implicit calls like Deref and Drop and doesn't have an implicit Clone because it's potentially expensive.
All probable Drop implementations are exactly as expensive as the corresponding Clone.
I love the Rust community but this can't seriously be part of an example as in expected usercode for Yew.
rant
react in rust
all frontenders are high
yew