Fork me on GitHub
#vrac
<
2021-04-16
>
Vincent Cantin19:04:41

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

phronmophobic20:04:47

In vrac, where does the path come from?

phronmophobic20:04:24

> 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.

Vincent Cantin20:04:17

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

Vincent Cantin20:04:24

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".

Vincent Cantin20:04:07

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

phronmophobic20:04:46

so where does the path come from?

Vincent Cantin20:04:57

from the caller of the event triggering.

phronmophobic20:04:19

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

Vincent Cantin20:04:55

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

Vincent Cantin20:04:37

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

Vincent Cantin20:04:30

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

Vincent Cantin20:04:46

nil is the global context

Vincent Cantin20:04:27

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

phronmophobic20:04:07

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

Vincent Cantin20:04:27

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".

phronmophobic20:04:41

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).

Vincent Cantin20:04:31

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

Vincent Cantin20:04:23

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

Vincent Cantin20:04:48

I am happy that you find the idea interesting.

phronmophobic20:04:30

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.

Vincent Cantin20:04:07

Yes, that's what I understood.

👍 3
phronmophobic20:04:09

> 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?