01:26
dingenskirchen has quit [Ping timeout: 250 seconds]
02:21
<
FromGitter >
<Blacksmoke16> yea think this is going to work
02:25
<
FromGitter >
<Blacksmoke16> requires some code i have locally but would output `#<Partner:0x7faf53e7cee0 @id=2, @name="FACEBOOK">`
02:25
<
FromGitter >
<Blacksmoke16> also the tagged thing is hard coded, but shouldnt be too bad to implement
02:25
<
FromGitter >
<Blacksmoke16> you get the idea
02:28
<
FromGitter >
<Blacksmoke16> also has the benefit of being all built at compile time, so should be quire performant
02:46
_whitelogger has joined #crystal-lang
03:46
laaron has joined #crystal-lang
04:27
<
FromGitter >
<watzon> Ok I don't know if my brain just isn't working or what. What would be the best way to do this? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Basically I want to add a DSL to Tourmaline that would allow you to define commands from inside a class like you would normal methods rather than having to do it all inside of the initializer. The regular command methods can be found here
04:27
<
FromGitter >
<watzon> Seeing as @Blacksmoke16 has been doing a lot of macro stuff today maybe you'll know what to do
05:34
laaron has quit [Remote host closed the connection]
05:35
laaron has joined #crystal-lang
05:38
laaron has quit [Client Quit]
05:38
laaron has joined #crystal-lang
05:40
laaron has quit [Client Quit]
05:40
laaron has joined #crystal-lang
05:41
laaron has quit [Client Quit]
05:42
laaron has joined #crystal-lang
05:43
laaron has quit [Client Quit]
05:43
laaron has joined #crystal-lang
05:44
laaron has quit [Client Quit]
05:44
laaron has joined #crystal-lang
05:48
laaron has quit [Client Quit]
05:48
laaron has joined #crystal-lang
05:50
laaron has quit [Client Quit]
05:50
laaron has joined #crystal-lang
05:54
laaron has quit [Client Quit]
05:54
laaron has joined #crystal-lang
05:57
laaron has quit [Client Quit]
05:57
laaron has joined #crystal-lang
06:00
laaron has quit [Client Quit]
06:01
laaron has joined #crystal-lang
06:02
absolutejam2 has joined #crystal-lang
06:04
laaron has quit [Client Quit]
06:04
laaron has joined #crystal-lang
06:06
sorcus has joined #crystal-lang
06:07
laaron has quit [Client Quit]
06:07
laaron has joined #crystal-lang
06:13
<
FromGitter >
<absolutejam_gitlab> Is that some pattern matching I see?!
06:20
laaron has joined #crystal-lang
06:22
laaron has quit [Client Quit]
06:22
laaron has joined #crystal-lang
06:26
laaron has quit [Client Quit]
06:27
laaron has joined #crystal-lang
06:40
laaron has joined #crystal-lang
06:42
laaron has quit [Client Quit]
06:42
laaron has joined #crystal-lang
06:46
laaron has quit [Client Quit]
06:47
laaron has joined #crystal-lang
06:49
laaron has quit [Client Quit]
06:49
laaron has joined #crystal-lang
06:52
laaron has quit [Client Quit]
06:52
laaron has joined #crystal-lang
06:55
laaron has quit [Client Quit]
06:55
laaron has joined #crystal-lang
06:56
absolutejam2 has quit [Ping timeout: 246 seconds]
07:01
laaron has joined #crystal-lang
07:03
laaron has quit [Client Quit]
07:03
laaron has joined #crystal-lang
07:05
ht_ has joined #crystal-lang
07:07
alex`` has joined #crystal-lang
07:09
laaron has joined #crystal-lang
07:18
laaron has joined #crystal-lang
07:18
flaviodesousa has joined #crystal-lang
07:22
laaron has quit [Remote host closed the connection]
07:23
laaron has joined #crystal-lang
07:29
laaron has joined #crystal-lang
07:33
laaron has quit [Client Quit]
07:33
laaron has joined #crystal-lang
07:52
laaron has joined #crystal-lang
07:53
laaron has quit [Remote host closed the connection]
07:53
laaron has joined #crystal-lang
08:00
laaron has joined #crystal-lang
08:04
laaron has quit [Remote host closed the connection]
08:04
laaron has joined #crystal-lang
08:06
laaron has quit [Client Quit]
08:07
<
FromGitter >
<j8r> kind of, Tuple matching
08:07
<
FromGitter >
<j8r> very useful
08:07
laaron has joined #crystal-lang
08:13
laaron has joined #crystal-lang
08:15
laaron has quit [Remote host closed the connection]
08:16
laaron has joined #crystal-lang
08:18
laaron has quit [Remote host closed the connection]
08:19
laaron has joined #crystal-lang
08:21
laaron has quit [Client Quit]
08:21
laaron has joined #crystal-lang
08:36
laaron has joined #crystal-lang
08:39
laaron has quit [Client Quit]
08:39
laaron has joined #crystal-lang
08:43
laaron has quit [Client Quit]
08:43
laaron has joined #crystal-lang
08:44
laaron has quit [Client Quit]
08:44
laaron has joined #crystal-lang
08:45
laaron has quit [Remote host closed the connection]
08:56
laaron has joined #crystal-lang
09:24
alex`` has quit [Ping timeout: 245 seconds]
10:04
gangstacat has joined #crystal-lang
10:51
dingenskirchen has joined #crystal-lang
11:04
_whitelogger has joined #crystal-lang
11:07
<
FromGitter >
<asterite> forward_missing_to will forward the method as a. method call, not as a Hash accesor
11:07
<
FromGitter >
<asterite> what you want to do is impossible in Crystal
11:10
alex`` has joined #crystal-lang
11:13
duane has quit [Ping timeout: 245 seconds]
11:24
duane has joined #crystal-lang
11:30
<
jokke >
asterite: why is it impossible? should be easy with method_missing macro
11:35
<
jokke >
oh wait what?
11:35
<
jokke >
method_missing macro is gone?
11:37
<
jokke >
was it ever there? :D
11:37
<
jokke >
i'm confused
11:41
<
FromGitter >
<tenebrousedge> it's still there?
12:10
laaron has joined #crystal-lang
12:18
<
FromGitter >
<Blacksmoke16> @watzon that isnt going to work since ivars cant be used on top level
12:19
<
FromGitter >
<Blacksmoke16> could you make commands a class var?
12:31
duane has quit [Ping timeout: 246 seconds]
12:56
<
FromGitter >
<asterite> well, it wasn't impossible
13:09
dingenskirchen has quit [Ping timeout: 250 seconds]
13:31
lucasb has joined #crystal-lang
13:48
dingenskirchen has joined #crystal-lang
13:56
dwdv has joined #crystal-lang
14:09
<
FromGitter >
<tenebrousedge> yay for valve oil and practice space
14:47
laaron has joined #crystal-lang
14:49
<
jokke >
is it somehow possible to "stream" json from an io? i'm getting messages written to the io and would like to deserialize it from it
14:49
<
jokke >
(without reading to a string first)
14:50
<
FromGitter >
<Blacksmoke16> :0
14:50
<
FromGitter >
<Blacksmoke16> json to what format?
14:50
<
jokke >
json to a struct
14:51
<
FromGitter >
<asterite> `SomeStruct.from_json(io)`
14:51
<
jokke >
asterite: yes that works but only if the io
_only_ contains that one struct
14:51
<
FromGitter >
<asterite> what else does it contain?
14:51
<
jokke >
multiple, concatenated
14:52
<
jokke >
as in multiple per line
14:52
<
FromGitter >
<asterite> read line per line and then deserialize, I guess
14:52
<
jokke >
yeah but that would entail reading the whole line as a string first
14:52
<
FromGitter >
<Blacksmoke16> could he do something with pull parser, read until finished then new up, and repeat?
14:52
<
FromGitter >
<asterite> how big is the struct?
14:53
<
FromGitter >
<asterite> I'm pretty sure there's no need to optimize it at that level
14:53
<
FromGitter >
<asterite> yes, with pull parser it's possible but tedious
14:53
<
FromGitter >
<Blacksmoke16> indeed
14:53
<
FromGitter >
<asterite> we could change pull parser to not error if there's still stuff on the IO, with a flag
14:53
<
FromGitter >
<asterite> but it will make the API a bit harder, I think
14:56
<
jokke >
not sure how it would work with a pull parser though
14:56
<
jokke >
still errors
14:57
<
FromGitter >
<Blacksmoke16> where is the data coming from?
14:59
<
jokke >
i mean i guess i could write somekind of custom IO which wraps the socket and is EOF when it encounters a \n
14:59
<
jokke >
but that sounds overkill
14:59
<
jokke >
i'll go with from_json(String) then... :/
15:01
<
FromGitter >
<Blacksmoke16> should work directly on an IO?
15:02
<
jokke >
yeah but it still gives me line as a string
15:02
<
FromGitter >
<Blacksmoke16> ah i see
15:16
<
FromGitter >
<Blacksmoke16> wrap the main IO, delimiter to `\n`, `from_io delimited`, re new up delimited io with current state of the main io
15:19
<
FromGitter >
<meltheadorable> my understanding was that there were multiple json documents per line, so that wouldn’t help, did i misinterpret?
15:20
<
FromGitter >
<Blacksmoke16> could make delimiter to like `}{`?
15:20
<
FromGitter >
<Blacksmoke16> :shrug:
15:21
<
FromGitter >
<Blacksmoke16> but it would prob consume that and would be invalid then :/
15:27
return0e has quit [Ping timeout: 248 seconds]
15:27
<
jokke >
no getting them per line wouldn't be a probelm
15:27
<
jokke >
but it seems i have other issues :(
15:28
<
FromGitter >
<Blacksmoke16> :(
15:28
<
jokke >
there's no working kafka lib
15:28
<
jokke >
although there are 3 of them
15:28
<
FromGitter >
<Blacksmoke16> rip
15:29
<
jokke >
the ones that use the c lib have some kind of threading issue which causes deadlocks
15:29
<
jokke >
probably because the c lib isn't using evented io
15:33
<
FromGitter >
<asterite> Something like this works:
https://play.crystal-lang.org/#/r/7aj1 . The tricky part is knowing when EOF is reached, with a socket I don't think the `peek` trick will work so it's better to just rescue on parse failure and break
15:38
<
jokke >
oh wow i didn't know about IO::Delimited
15:40
return0e has joined #crystal-lang
15:50
laaron has quit [Remote host closed the connection]
15:51
laaron has joined #crystal-lang
15:54
<
jokke >
because i'm pretty sure it is causing dead locks in my program
15:54
sorcus has quit [Ping timeout: 250 seconds]
16:03
sorcus has joined #crystal-lang
16:07
ua has quit [Excess Flood]
16:12
<
FromGitter >
<asterite> no idea, sorry
16:31
ua has joined #crystal-lang
16:36
<
FromGitter >
<absolutejam_gitlab> Anyone used
16:39
<
FromGitter >
<absolutejam_gitlab> Can you stream an IO atm?
17:16
<
FromGitter >
<Blacksmoke16> meaning consume it without reading it all as a string or something?
18:06
<
FromGitter >
<Daniel-Worrall> how do I cross-compile to ARM?
18:06
<
FromGitter >
<Daniel-Worrall> Aiming at rpi4
18:12
<
FromGitter >
<absolutejam_gitlab> Yeah @Blacksmoke16, like a generator
18:13
dostoyevsky has quit [Quit: leaving]
18:13
dostoyevsky has joined #crystal-lang
18:14
dostoyevsky has quit [Client Quit]
18:15
dostoyevsky has joined #crystal-lang
18:17
<
FromGitter >
<watzon> @Blacksmoke16 making commands a class var wouldn't be good
18:28
<
FromGitter >
<Blacksmoke16> yea, then might have to think of a diff approach.
19:18
absolutejam2 has joined #crystal-lang
19:18
alex`` has quit [Ping timeout: 258 seconds]
19:20
alex`` has joined #crystal-lang
20:03
absolutejam2 has quit [Ping timeout: 248 seconds]
20:47
absolutejam2 has joined #crystal-lang
20:52
ht_ has quit [Remote host closed the connection]
20:58
alex`` has quit [Ping timeout: 258 seconds]
20:58
sorcus has quit [Ping timeout: 264 seconds]
21:27
<
FromGitter >
<absolutejam_gitlab> Looks super interesting to me
21:50
<
FromGitter >
<Blacksmoke16> duuuude this is cool
21:51
<
FromGitter >
<Blacksmoke16> "!partner` tells it to inject all services that have that tag
21:52
<
FromGitter >
<Blacksmoke16> which allows you to then have another service that can be injected into controllers or param converters
21:52
<
FromGitter >
<Blacksmoke16> which could for example, resolve/return the correct obj based on id
21:53
<
FromGitter >
<Blacksmoke16> ie. `GET /partners/GOOGLE`
21:53
<
FromGitter >
<Blacksmoke16> and if you want to add a new one just add another `@[Register("YAHOO", "Yahoo", name: "facebook", tags: ["partner"])]`
21:53
<
FromGitter >
<Blacksmoke16> and everything just works
21:53
<
FromGitter >
<watzon> That's pretty awesome
21:53
<
FromGitter >
<watzon> Creating a DI shard?
21:54
<
FromGitter >
<Blacksmoke16> more of a refactor
21:54
<
FromGitter >
<Blacksmoke16> had some trouble with with before, so it currently doesnt work
21:55
<
FromGitter >
<watzon> Can you use the DI module all by itself?
21:55
<
FromGitter >
<Blacksmoke16> yes
21:55
<
FromGitter >
<Blacksmoke16> `require "athena/di`
21:58
<
FromGitter >
<Blacksmoke16> by default it defines the container on the main fiber
21:59
<
FromGitter >
<Blacksmoke16> using it within a web framework, i.e. http request context is a bit tricker but i could walk you though how to handle that
21:59
<
FromGitter >
<Blacksmoke16> since you want each request to have its own container
22:00
<
FromGitter >
<watzon> Thats cool :)
22:01
<
FromGitter >
<Blacksmoke16> athena uses it for the request context
22:01
<
FromGitter >
<Blacksmoke16> so have access to it anywhere you want
22:02
<
FromGitter >
<Blacksmoke16> but sadly that example depends on some code that is still in PR, prob wont be merged in time for 0.30.0 :(
22:20
teardown has quit [Ping timeout: 258 seconds]
22:22
<
FromGitter >
<Blacksmoke16> waiting for releases isnt that bad on linux as you can just use the edge channel on snap
22:22
<
FromGitter >
<Blacksmoke16> works quite well
22:23
gangstacat has quit [Quit: Ĝis!]
23:11
lucasb has quit [Quit: Connection closed for inactivity]
23:18
<
FromGitter >
<Blacksmoke16> think i might make a blog post later about some useful DI patterns like that
23:18
<
FromGitter >
<Daniel-Worrall> welp, I don't seem to be able to build master with llvm7
23:18
<
FromGitter >
<Daniel-Worrall> WSL Ubuntu
23:18
<
FromGitter >
<Blacksmoke16> got the latest commits?
23:18
<
FromGitter >
<Blacksmoke16> was one that was merged like the other day to support 7
23:19
absolutejam2 has quit [Ping timeout: 258 seconds]
23:20
<
FromGitter >
<Daniel-Worrall> ye
23:21
<
FromGitter >
<Blacksmoke16> whats the error?
23:21
<
FromGitter >
<watzon> I don't think llvm7 is supported, is it?
23:21
<
FromGitter >
<Daniel-Worrall> there was a recent PR merged
23:22
<
FromGitter >
<Blacksmoke16> did you do a `make clean`?
23:22
<
FromGitter >
<Blacksmoke16> also prob might not hurt to clear cache
23:22
<
FromGitter >
<Daniel-Worrall> yup
23:22
<
FromGitter >
<Blacksmoke16> `rm -rf ~/.cache/crystal`
23:23
<
FromGitter >
<Daniel-Worrall> still a flood of error
23:23
<
FromGitter >
<Blacksmoke16> hm dunno, maybe add a comment to the fails to build on llvm7 issue?
23:24
<
FromGitter >
<Blacksmoke16> could be somewthing WSL specific
23:24
<
FromGitter >
<Daniel-Worrall> could be, I was going to try docker next
23:24
<
FromGitter >
<Daniel-Worrall> my pi has llvm7 so I was looking to get crystal built on 7 so I could crosscompile