ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
ur5us has quit [Ping timeout: 250 seconds]
straight-shoota has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
DeBot has quit [Ping timeout: 248 seconds]
DeBot has joined #crystal-lang
jhass has joined #crystal-lang
straight-shoota has joined #crystal-lang
dmgk has quit [*.net *.split]
dmgk has joined #crystal-lang
riza has quit [*.net *.split]
riza has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
analogsalad has joined #crystal-lang
jmdaemon has quit [Ping timeout: 272 seconds]
ur5us has joined #crystal-lang
ur5us_ has joined #crystal-lang
ur5us has quit [Read error: Connection reset by peer]
notzmv has quit [Ping timeout: 240 seconds]
Sankalp has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us_ has quit [Read error: Connection reset by peer]
HumanG33k has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
sorcus has joined #crystal-lang
HumanG33k has quit [Quit: WeeChat 3.0]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Client Quit]
HumanG33k has joined #crystal-lang
Sankalp has quit [Ping timeout: 248 seconds]
HumanG33k has quit [Quit: WeeChat 3.0]
HumanG33k has joined #crystal-lang
analogsalad has quit [Ping timeout: 248 seconds]
sorcus has quit [Quit: WeeChat 3.5]
analogsalad has joined #crystal-lang
rez has joined #crystal-lang
sorcus has joined #crystal-lang
rez has quit [Quit: much snoozes...]
rez has joined #crystal-lang
rez has quit [Quit: l8r]
<FromGitter> <moe:busyloop.net> https://carc.in/#/r/d4fo
<FromGitter> <Blacksmoke16> idk what im looking at
<FromGitter> <moe:busyloop.net> a field filter for partial serialization
<FromGitter> <Blacksmoke16> stdlib already supports this via the `JSON::Field` annotation fwiw
<FromGitter> <moe:busyloop.net> yup but this one is for when you want to make different views on the same object
<FromGitter> <moe:busyloop.net> it's also for when you don't want to write a whole bunch of boilerplate for it 😛
<FromGitter> <HertzDevil> well there is no deserialization here
<FromGitter> <Blacksmoke16> it does have a `JSON.parse` in there, but nothing like `JSON::Serializable` at least
<FromGitter> <Blacksmoke16> +1 for the name/comment tho :P
<FromGitter> <moe:busyloop.net> yeh it's only for the way out anyway. (although i feel like some kind of filtering should be baked into stdlib at some point)
<FromGitter> <Blacksmoke16> best you could do atm is use another shard, or use the existing annotations, having a like immutable struct for each view
<FromGitter> <Blacksmoke16> could open an issue for it, tho TBD on if thats something that would be accepted given its getting into a fairly complex feature? :shrug:
<FromGitter> <moe:busyloop.net> yeh, i'm trying to minimize boilerplate. most often i just want `foo.to_json(:a, :b, :c)`. although even cooler would be to also have it work with arrays/nesting, but then it obv becomes way more complicated.
<FromGitter> <Blacksmoke16> might be able to monkey patch that in
<FromGitter> <moe:busyloop.net> yeh, i just realized, it's actually not too bad anyway; https://carc.in/#/r/d4fz
<FromGitter> <Blacksmoke16> still would be if one of the values was an obj/array that you also wanted to filter
<FromGitter> <moe:busyloop.net> should be fine for my dabblings, i don't need more than that anyway. basically just wanting to strip fields from db responses before rendering them out http client.
<FromGitter> <moe:busyloop.net> yes, if it gets more nested than that, a proper serialization framework will be needed. one with ExclusionStrategies and what not 😬
<FromGitter> <Blacksmoke16> hehe, could also just leave it up to the user and let them deal with it :P
<FromGitter> <moe:busyloop.net> if anyone uses my stuff they're by definition lazy and don't want to deal with anything, gotta minimize them keystrokes
<FromGitter> <Blacksmoke16> xD fair enough
<FromGitter> <moe:busyloop.net> oh, while i'm rambling, https://github.com/Sija/any_hash.cr is quite joyful to work with for certain things. gives me hope that crystal could actually have a hash-variant that behaves almost like a ruby hash at some point. prob more of a 4.0 think, if ever, but i'll already propose to call it `LazyHash` then :)
<FromGitter> <Blacksmoke16> at that point is it really type safe? :P
<FromGitter> <HertzDevil> that shard is still very far from a true any-hash
<FromGitter> <moe:busyloop.net> in places where it matters, it can still be. sometimes you (or at least i) just want to wrap things up to bring them "elsewhere", without having to (or even being able to) explicitly type it all the way down.
<FromGitter> <moe:busyloop.net> and yup, it's not a true-any, yet. but very helpful for incrementally building up json-serializable things. not sure if an entirely true-any is actually possible - but even in this relatively limited form i already found it very helpful.
<FromGitter> <HertzDevil> a true any might be something like `Reference | Box(Nil) | Box(Char) | Box(Bool) | Box(Int8) | ...` ranging over all storable `Value` types
<FromGitter> <moe:busyloop.net> yup, just wrap it up in a hash-style syntax and i'll take it :)
ua_ has quit [Ping timeout: 248 seconds]
analogsalad has quit [Quit: bye]
ua_ has joined #crystal-lang
ua_ has quit [Ping timeout: 246 seconds]
jmdaemon has joined #crystal-lang
ua_ has joined #crystal-lang
ua_ has quit [Ping timeout: 276 seconds]
ua_ has joined #crystal-lang
ua_ has quit [Ping timeout: 276 seconds]
ur5us has joined #crystal-lang
ua_ has joined #crystal-lang