HNHacker News
TopNewBestAskShowJobs

rabidferret

401 karma · joined May 21, 2013

submissionscomments
rabidferret··on Grokking Diesel, Rust's ORM
Can you elaborate on how Diesel doesn't compose in this way? Composition is one of the main goals of Diesel.
rabidferret··on Grokking Diesel, Rust's ORM
If you open an issue we can up the limit again
rabidferret··on Grokking Diesel, Rust's ORM
I think people read way too much into the ORM label. Diesel is very much a query builder first, not an ORM. As a random data point, I've been fixing bugs in Rails lately by basically copying over code from Diesel and converting it to Ruby. That code has all been in Arel not Active Record.

I agree that the "I make Rails" thing is a double edged sword. I would hope people would see it as an indicator that I have a lot of experience and lessons to learn from, but I think many people see the opposite.

rabidferret··on Grokking Diesel, Rust's ORM
We didn't want to commit to our own home-grown hlist type until we had some indicator of whether the language was going to go with variadics based on tuples or hlists.
rabidferret··on Grokking Diesel, Rust's ORM
It'll eventually go away when some form of variadic generics lands in the language
rabidferret··on Grokking Diesel, Rust's ORM
Ironically, I was actually originally planning on having Diesel primarily built around parsing actual SQL. (See the commit message of https://github.com/diesel-rs/diesel/commit/2ba8bf481c3d21d8b..., which is like commit number 4)

I agree that if you're just writing a single self-contained query, SQL is a great DSL for that. I've been trying to improve our story for working with raw SQL (one tradeoff will be that it isn't type checked).

However, there are major benefits to an in-language DSL as well. If you are wanting to re-use fragments of queries, or conditionally construct a different query, that's a pain to do with SQL strings.

rabidferret··on Grokking Diesel, Rust's ORM
Slick was definitely an influence on Diesel's design. I tried to have our query builder map more closely to SQL though, whereas Slick feels like it's trying to pretend it's just an Iterable.
rabidferret··on Grokking Diesel, Rust's ORM
You could just as easily write `posts.filter(user_id.eq(1)).load(&connection)`.
rabidferret··on Grokking Diesel, Rust's ORM
Not a HashMap specifically, but there is a way to group them into `Vec<(User, Vec<(Post, Vec<Comment>)>)>`. (Which you can convert into a hashmap pretty easily) http://docs.diesel.rs/diesel/associations/index.html for details.
rabidferret··on Announcing Rust 1.18
Uh... Custom derive?
rabidferret··on Rust Performance Pitfalls
"requires unsafe" already implies everything in your comment. `unsafe` literally means "this might violate memory safety"
rabidferret··on Naughty Strings: A list of strings likely to cause issues as user-input data
That doesn't mean that a 500 is a good UX. We give error messages on invalid form input for a reason.
rabidferret··on Go and Dogma
Yeah, ultimately it's fundamentally no different than Go but with more sugar and ability to abstract properly. Turns out that counts for a lot.
rabidferret··on Getting Started with Tokio
I think that's only the case when you are specifically trying to avoid boxing.
rabidferret··on Getting Started with Tokio
Just because a type can be named doesn't mean that returning the named type properly expresses your intent.

The name of said type can get real hairy real fast, as well.

rabidferret··on My experience rewriting Enjarify in Rust
> it's almost never required

Mate you should try Diesel or Futures. ;)

rabidferret··on Rails 5.0: Action Cable, API mode, and more
Most in depth I went was probably in http://m.youtube.com/watch?v=PUuYAksQWg4 but I discuss it in pretty much every talk I give.

You can also just ping me on Twitter and I can talk about it more. :)

rabidferret··on Rails 5.0: Action Cable, API mode, and more
I talk about this at length in one of my recent talks but the short version is we wanted to optimize for reuse via named scopes
rabidferret··on Critical Update on DAO Vulnerability
For an insurance policy like that, they wouldn't offer any policy without auditing the device, including the code.
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
This isn't true at all. You can add as many fields as you want. You'll need to recompile to use them, of course.
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
That is our `sql` function
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
It's impossible. We can't guarantee the order of the result set, so we'd have to iterate the entire collection just to implement `next`
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
Hah I love this answer. ^_^
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
We have a SQL literal ast node but you lose most of the benefits of the library that way
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
> And rusqlite (or libsqlite-3) doesn't have those issues?

rusqlite has the same issues. libsqlite doesn't since it's just C bindings. Same as pq_sys. Ironically, rusqlite makes the same design choices as rust-postgres, but it's actually wrapping a heap allocated object anyway, so it gains nothing by doing so...

> I'd probably attempt to change rust-postgres first

I did, too. It turned out to be a pretty major rewrite.

rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
It's a bit late here, but feel free to DM me in our Gitter room and I can give you a full explanation tomorrow.
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
The short version is its refusal to box things means that you have to have the connection, the statement, and the cursor all as local variables in the same lexical scope (you almost always want to abstract away the statement and cursor), and it's use of trait objects for serialization and deserialization. I might go into it briefly in my talk, but I don't like to rag on other people's work so I probably won't say much on it.

(Sorry for the double post, I think I replied to my own comment and not yours!)

rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
Diesel's selling point isn't actually the performance aspect. It's the safety and productivity.
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
It's possible. I tried to build on rust-postgres originally, but its design basically makes it impossible to abstract over. We also have fundamentally different views on how `ToSql` should work.
rabidferret··on Diesel: A Safe, Extensible ORM and Query Builder for Rust
I'll take your word for it. I'm no gas can expert. :)
← PreviousPage 2 of 3Next →