Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes. Set by lizmat on 24 May 2021. |
|||
00:01
Pe_Elle left
00:31
Pe_Elle joined
01:33
Pe_Elle left
01:36
Pe_Elle joined
01:41
Pe_Elle left
02:02
Pe_Elle joined
02:08
Pe_Elle left,
Pe_Elle joined
03:05
Pe_Elle left
03:06
Pe_Elle joined
03:10
Pe_Elle left
03:17
guifa left
03:35
Pe_Elle joined,
Pe_Elle left,
Pe_Elle joined
03:38
Pe_Elle left
03:39
Pe_Elle joined
03:44
Pe_Elle left
03:49
guifa joined
04:12
Pe_Elle joined
04:16
Pe_Elle left
04:53
Pe_Elle joined
05:58
Pe_Elle left
06:28
Pe_Elle joined
07:33
Pe_Elle left
07:56
Pe_Elle joined
08:01
Pe_Elle left
08:14
Pe_Elle joined
08:30
guifa left
09:16
Pe_Elle left
09:40
Pe_Elle joined
09:45
Pe_Elle left
10:01
Pe_Elle joined
10:35
sena_kun joined
11:00
Pe_Elle left
11:30
Pe_Elle joined
11:35
Pe_Elle left
11:37
Pe_Elle joined
|
|||
SmokeMachine | Is there a way to add raku sub to the template (as the built in ones (like HTML()))? | 11:43 | |
12:43
Pe_Elle left
13:08
guifa joined
13:11
Pe_Elle joined
14:38
Pe_Elle left
14:58
Pe_Elle joined
|
|||
librasteve | smokemachine: i just took an initial look at Cromponent. My initial overall feedback is (i) it is awesome, (ii) about 80% of what I was aiming to do (and I have had a big coder’s block on getting my head around this problem… so kudos to you for a very nice cut). My next thought is to play around with your code when i get a chance, and then give blow by blow feedback and maybe feed in some new angles. | 15:00 | |
15:04
Pe_Elle left
|
|||
SmokeMachine | I’m strat playing on moving some part of Cromponents to use Cro constructs now I have a bit more understanding on how Cro::WebApp;:Template work (I still don’t get how the Builtins are “injected” into the AST) | 15:05 | |
librasteve | I’m keen to be able to nest components and my guess is that is why you are asking if a crotmp can contain a raku sub call. To my surprise, I found that your approach with template inline is more promising that trying to follow my Template-Register idea. My initial idea was to register both the main crotmp (containing crotmp subs & macros) and then to register caller crotmp stubs, but I think that it may be better | 15:13 | |
to stay with the purely template-inline and to provide composition by exporting components as subs that can call one another … with arguments to deliver named data to each components for hydration. For nesting you need to be able to pass (a list of) inners and their needs to be a marker in the crotmp like <:body> to where the inner resides. Rather than monkey with the Cro Template internals, when not just do a substitution of | |||
a simple body marker like that? | |||
my mental model for composable subs is maybe like HTML::Functional - you know you could have a sub called grid() and another called todo() and then go something like grid(:row2, :col2, todo() xx 4) | 15:17 | ||
SmokeMachine | You already can have nested components, no? It’s just the case of your base component have another components as its attributes, right? | ||
On the case you described, from where would come the todo data? | 15:18 | ||
librasteve | grid(:row2, :col2, todo('bleble') xx 2, todo('blabla') xx2 ) | 15:20 | |
its just raku code | |||
vars, blocks, $_ as you like | 15:21 | ||
SmokeMachine | On cromponent, the component is a combination of an object (on my example a `Todo.new: :data(“the todo string”)`) and a Cro template sub auto created by the return of the method RENDER. | ||
But I need to do 2 different things: 1 - pass the object to the render function; 2 - call the sub passing the object as argument… | 15:22 | ||
librasteve | sorry - I am not able to really work on this right now (must walk dog only 45 mins daylight!!) | 15:23 | |
SmokeMachine | Please, feel free to leave… I’ll just put some thoughts here so you (or anyone else) can see later when you have some time, ok? | 15:25 | |
One way I was thinking on improving it (to not need to do that on 2 steps) is to make the component be a template register itself… and have a method that would run the RENDER, compile the template, cache it and sun the template passing self. The problem with that approach is that using a component on template would need something like: `<&HTML(.my-component)>`. | 15:29 | ||
15:34
Pe_Elle joined
|
|||
SmokeMachine | Another possible solution I thought would be adding a new type of tag to Cro template, a Component tag <*>… it would have 5 “formats”: <*.my-component> (where .my-component references to the component object), <*$my-component> (where the variable $my-component is a component object), <*> (where the topic variable is a component object), <*MyComponentClass> and <*MyComponentClass(parameters)> | 15:38 | |
15:39
Pe_Elle left
|
|||
SmokeMachine | (The last 2 would receive a class, the last one would use the parameter list to call the classes new(), and the other one would use the class itself… | 15:40 | |
The tag would call the obj’s (or classe’s) .RENDER, compile it, cache it, render it and return it with out escaping it… | 15:43 | ||
15:44
Pe_Elle joined
|
|||
SmokeMachine | Another solution I thought it basically the same as the <*> one, but instead of creating a new tag, create a new sub, and we would be able to do something like: <&COMPONENT(.my-component)>… and that’s why I was asking if it is possible to create new template subs in raku… I was kind of able to do that assim it as a builtin… but one of the best parts of this solution is that, if I can create the sub in raku, I don’t need to | 15:47 | |
modify Cro and can create a new module for doing that… | |||
Só, is there a way to create template subs in raku from outside Cro::WebApp code? | 15:48 | ||
Another thing I thought is that (back to Cromponent code) the component could be defined by a sub (as it is currently) or you could choose it to be defined as a macro, that way you could easily use <:body> on the component’s RENDER method… | 15:54 | ||
Any of this make sense? | 16:47 | ||
16:48
Pe_Elle left
17:36
Pe_Elle joined
17:40
Pe_Elle left
17:46
Pe_Elle joined
18:50
Pe_Elle left
19:20
Pe_Elle joined
19:28
Pe_Elle left
19:57
Pe_Elle joined
20:01
Pe_Elle left
20:31
Pe_Elle joined
20:55
Pe_Elle left
21:24
Pe_Elle joined
21:28
Pe_Elle left
22:00
Pe_Elle joined
22:05
Pe_Elle left
22:51
Pe_Elle joined
22:56
Pe_Elle left
23:11
sena_kun left
23:29
Pe_Elle joined
|