🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:38 jpn joined 00:43 jpn left
Voldenet SmokeMachine: for sessions I'd go php way of pre-defining session requirement per method and magic variable for it: `method RENDER($_) is using-session { $*session<Thing> = 42; }` 01:13
because router needs to know whether to use set session cookie before returning any result 01:14
in fact, default configuration for app could decide what's the default 01:15
> root-component App.new, :using-session > root-component App.new, :not-using-session
01:17 Manifest0 left
Voldenet Other way would be to specify endpoints metadata with generic extensions, then adding session extension with strongly-typed classes 01:19
`class Storage { has Int $.blah is rw; }; root-component App.new, :oprions(Session.with(Storage), OpenID.with($oid-provider))); class Component { RENDER($_) { .ext[0].blah = 42; say .ext[1].me } }` 01:26
`RENDER($_) is skipping-extension(0)` 01:27
01:32 bent_fingers left
Voldenet That by-index could be difficult to maintain, but with proper machinery: `class Session { my $ext-metadata = reserve-extension; method get($ext) { $ext.get($ext-metadata) } }; RENDER($_) { Session.get(.ext).blah = 42 }` 01:33
or `Session[::T]` 01:34
it's tempting to use maps everywhere, but it's impossible to make it faster later without refactoring 01:35
In fact, if the first extension would always be hashmap, then it could be made faster simply by rewriting extensions, so `RENDER($_) { .ext(Session[Storage]).blah = 42 }` would look the same without and with optimized lookups 01:38
01:39 jpn joined
Voldenet Either way, that's just my idea for how sessions should look like – you define that session's going to hold X and Y - this helps when keeping sessions persisted, because when structure of data in production changes, deserialization can take care of missing properties 01:43
SmokeMachine I just started playing with form generation and I think that's looking good... (github.com/FCO/HTML-Component/blob...kumod#L18) it also accepts a 2nd positional value with a Associative with values to populate the form... 01:44
01:45 jpn left
SmokeMachine Voldenet: thanks for your suggestion! I'll take a read and try to understand it and see what I think about those suggestions... tomorrow (if I have some time) I'll try to write a PoC about that... 01:45
Voldenet np, don't know how much of it will be useful, because it makes the whole thing a lot more complex, first thought of `$*session<Thing>` feels easy to do most things with 01:46
and it mimicks php's $_SESSION 01:47
SmokeMachine about the form, I still have to find a way to auto populate (and show errors). in case it went to a POST endpoint, got errors, it should, probably, show the form with the data and the errors...
Voldenet btw, with that `.form` it'd be easy to make testing all endpoints easy with `for new-todo.^methods -> $m { .form $m }`, which is something very much resembling swagger ui 01:50
01:51 pragma- left
Voldenet but awfully easy to implement compared to writing openapi schema 01:52
SmokeMachine Good point… I haven’t thought about that 01:53
Voldenet being able to test endpoints easily is crucial for app developers after all 01:55
Btw regarding the pre-filled forms on render, there might be some values (password, repeated-password) that probably would need to be re-typed on error, but I don't know what the code should be 01:57
`is no-fill` or `.form: self.new-todo, :skip(*.password, *.repeated-password)` 01:58
SmokeMachine I think inputs of type password should do that by default… and maybe something like: is ignore-value… what do you think? 02:03
Voldenet Makes sense, and keep-value being default for everything else 02:26
02:31 japhb left 02:36 hulk joined 02:37 kylese left 02:40 japhb joined 02:41 jpn joined 02:45 japhb left 02:46 jpn left, japhb joined 02:50 japhb left 03:07 TieUpYourCamel left 03:08 TieUpYourCamel joined 03:13 jpn joined 03:15 hulk left, kylese joined 03:16 japhb joined 03:17 jpn left 03:23 jpn joined 03:28 jpn left 04:00 dead1 joined 04:29 human-blip left 04:36 jpn joined 04:41 jpn left 05:31 jpn joined 05:37 jpn left 06:26 jpn joined 06:31 abraxxa joined 06:33 jpn left 06:34 jpn joined 06:44 human-blip joined 07:40 jpn left 07:50 abraxxa left 07:56 abraxxa joined 08:00 jpn joined 08:11 jpn left
SmokeMachine Voldenet: about `for new-todo.^methods -> $m { .form $m }`, I'll probably implement a way to return all the endpoints instead of all methods (that may have methods that are not endpoints...) 08:16
08:40 sena_kun joined 09:02 Manifest0 joined 09:14 Sgeo left 09:17 haxxelotto joined
Voldenet …certainly, that would be including my favourite BUILDALL endpoint 09:21
10:21 DarthGandalf left 10:38 DarthGandalf joined 10:43 jpn joined 12:43 jpn left 13:05 jpn joined 13:10 jpn left 13:22 jpn joined 15:34 Sgeo joined 15:46 jpn left 15:48 jpn joined 16:09 japhb left 16:16 vlad joined 16:19 jpn left 16:20 jpn joined 16:28 japhb joined 16:42 jpn left 16:43 jpn joined 16:46 vlad left 16:47 vlad joined 16:48 jpn left 17:04 abraxxa left 17:06 abraxxa-home joined 17:09 abraxxa-home left 17:31 vlad left 17:32 codesections1 joined 17:56 vlad joined 18:31 codesections1 left 18:47 jpn joined 18:53 jpn left 19:36 haxxelotto left 19:42 vlad left 19:48 jpn joined 19:53 jpn left 20:06 bent_fingers joined 20:48 jpn joined 20:53 jpn left 21:46 jpn joined 21:52 jpn left 23:09 jpn joined 23:14 jpn left 23:16 sena_kun left