Excited about Dream web framework

Quite the opposite :slight_smile: The basic “Dream” core is less opinionated than Opium. It looks like we will eventually factor that core out to port Dream to Mirage, maybe to Node, etc. You can see the core separated out in the directory structure here — that core directory is src/pure.

The “opinionated” impression of Dream probably comes from that, I carefully considered what

  1. everyone typically needs anyway,
  2. can still be included without adding any large or system dependencies, and
  3. can be added in a way that it is still strictly optional.

…and added that to Dream under a neat interface. Caqti is a good example here, because the Caqti base package does not depend on anything that Dream doesn’t already pull in on its own, so the only cost to including and recommending Caqti is only compilation time during dependency install. And:

  1. because Dream is otherwise unopinionated, you can simply ignore the Caqti support, and use any other database, no database, or any other means of accessing SQL databases;
  2. Dream does not depend on caqti-driver-sqlite3, etc. — you choose those as a user, if you need them, and these are the parts that actually have system dependencies. Dream does not pull those system dependencies in on its own.

So this is not truly a matter of being opinionated, but strictly some convenience provided by an otherwise unopinionated library.

Dream is absolutely not like Sihl in this regard. By contrast, Sihl is a much higher-level framework, adds a lot of features, but at the price of e.g. threading SQL statements into its codebase. Dream simply has nothing like that, on that scale.

So, even though Dream is lower-level than Opium, Dream’s convenience features do end up extending Dream’s reach to slightly higher levels than Opium, encroaching slightly on Sihl — but only on the very lowest layers of Sihl. If I could offer an ugly diagram (keeping in mind, for other readers, than Sihl is based on Opium):

           Higher level ->
+-------------+--------------------+
|    Opium    |        Sihl        |
+-------------+--------------------+
+-----------------+
|      Dream      |
+-----------------+

EDIT: Not to scale!

I really want to emphasize that Dream is about doing things like what Opium does, in a way that I considered to be better-factored and easier to use. It’s not in any way equivalent or similar to Sihl.

However, I do see the temptation to compare Dream to Sihl, because I do think that a substantial proportion of the true value of Sihl can be taken out and added in an unopinionated way to an Opium-like framework as mere convenience functions, which is, of course, as I said above, what I did with Dream :slight_smile:

(EDIT for clarification: that’s not to say that Dream’s convenience features that partially overlap with Sihl’s are based on Sihl’s — they just occupy equivalent niches).

I also believe, based on recent Opium PRs, that there are efforts between Sihl and Opium to do just that, upstream some things from Sihl to Opium. So, speculating, but I don’t think I’m alone in making this observation.

8 Likes