vrac

Template-based web library [WIP] - https://github.com/green-coder/vrac Zulip archive: https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/vrac Clojureverse archive: https://clojurians-log.clojureverse.org/vrac
2021-04-16T18:33:05.002300Z

My next milestone will be to implement https://github.com/day8/re-frame/tree/master/examples/simple in Vrac.

2021-04-16T19:13:41.003500Z

It is not working, but it shows how the event handler will look like.

2021-04-16T19:41:34.003800Z

Explanations here: https://twitter.com/VincentCantin/status/1383143229932015621

phronmophobic 2021-04-16T20:01:47.004300Z

In vrac, where does the path come from?

phronmophobic 2021-04-16T20:10:24.006600Z

> In Vrac, the "output" can be passed in the event next to the "input". Paths are unknown to the user. Trying to grok this. It seems like passing the "output" (I would call it a reference) is re-frame's work around for making updates less coupled to specific parts of the app db. Trying to understand vrac's approach.

2021-04-16T20:19:17.008Z

The :event and :logic in Vrac are meant to be interpreted offline. They encode meaning instead of process.

2021-04-16T20:20:24.009300Z

As a result, if the human can understand what's going on while reading the event handler after reading the instruction manual, then a program can do the same and generate the code needed for the "process".

2021-04-16T20:21:07.010Z

In Vrac, the path is conceptually passed alongside the value. It's as if the path was a metadata of the value.

phronmophobic 2021-04-16T20:21:46.010400Z

so where does the path come from?

2021-04-16T20:21:57.010900Z

from the caller of the event triggering.

phronmophobic 2021-04-16T20:22:19.011300Z

for the example [:time-color-change 34562], is the path in that event somewhere?

2021-04-16T20:22:55.012Z

In this specific example, there is no path conveyed with 34562

2021-04-16T20:23:37.012600Z

However, (:time-color nil) describe a data somewhere.

2021-04-16T20:24:30.013500Z

In Pathom's terms, that can be read as "the data reachable using :time-color in the global context".

2021-04-16T20:24:46.013800Z

nil is the global context

2021-04-16T20:25:27.015Z

(:time-color my-timer) would be the time-color in the context of a specific timer.

phronmophobic 2021-04-16T20:27:07.015900Z

so the component dispatching the event would presumably pass '(:time-color my-timer) as part of the event?

2021-04-16T20:27:27.016100Z

It could, yes.

2021-04-16T20:30:27.020300Z

In practice in Vrac, the user has very little need to call (v/dispatch event) directly. Most of the time, the events would be dispatched from the Vrac component's "render function".

phronmophobic 2021-04-16T20:30:41.020700Z

I do think the path dependence that's common in most frameworks is a challenge. membrane has some similar ideas (see https://blog.phronemophobic.com/reusable-ui-components.html). I still think there's lots of interesting ideas yet to be explored so I'm curious to see how vrac approaches the problem. I've been using the term "reference" to describe paths like '(:time-color my-timer).

2021-04-16T20:32:31.021800Z

> I do think the path dependence that's common in most frameworks is a challenge It's a handicap, mostly 🙂

2021-04-16T20:33:23.022300Z

Vrac plays a lot with the references, under the hood.

2021-04-16T20:33:48.022700Z

I am happy that you find the idea interesting.

phronmophobic 2021-04-16T20:34:30.023600Z

When I say "reference", it doesn't necessarily mean just a "reference type" like an atom. Here's the definition I came up with: Reference: Data that uniquely identifies an entity within a data model.

2021-04-16T20:35:07.024100Z

Yes, that's what I understood.

👍 1
phronmophobic 2021-04-16T20:48:09.024700Z

> In practice in Vrac, the user has very little need to call `(v/dispatch event)` directly. Most of the time, the events would be dispatched from the Vrac component's "render function". What does that mean?