<FromGitter>
<spTorin> If you need to transfer a result or an error code from the method (analog to Result in Rust). Which path is correct and more in line with the spirit in the crystal? ⏎ ⏎ 1) return tuple `{result<T>, Err}` and first check `if answer[1]` ⏎ 2) return Union `(result<T> | Err)` and first check `result.is_a?(Err)` ⏎ 3) simply call the method and handle all exceptions at the level above
<FromGitter>
<oprypin:matrix.org> @spTorin: never 1, rarely 2, usually 3 if the error is the rare case
taupiqueur has joined #crystal-lang
hightower3 has quit [Remote host closed the connection]
hightower3 has joined #crystal-lang
hightower3 has quit [Ping timeout: 268 seconds]
hightower2 has joined #crystal-lang
taupiqueur has quit [Ping timeout: 252 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Read error: Connection reset by peer]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
hightower2 has quit [Read error: Connection reset by peer]
hightower2 has joined #crystal-lang
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
<FromGitter>
<mehmethankut_twitter> is there a way to get all properties defined for an object? or should I write my own macro
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 268 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 252 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 260 seconds]
<FromGitter>
<naqvis> Crystal doesn't have reflections and no RTTI. So you will have to go with macro. Take a look at TypeNode (https://crystal-lang.org/api/1.2.2/Crystal/Macros/TypeNode.html) for all available `type` information you can retrieve at compile time.
<ngp>
is it possible to chain Procs? Ie. a Proc function takes a &block argument and I want to chain an arbitrary list of them together
<ngp>
where the input to each "higher level" proc is some args, and the next Proc in the chain
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
Guest70931 is now known as mookie
<FromGitter>
<naqvis> you can try some kind of builder pattern here. something like https://carc.in/#/r/cfll
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
greenbigfrog has quit [Ping timeout: 252 seconds]
taupiqueur has joined #crystal-lang
greenbigfrog has joined #crystal-lang
<ngp>
I don't think that gives me exactly what I'm looking for. What I'm trying to implement is similar to a pipe-filter pattern, but using Procs
taupiqueur_ has joined #crystal-lang
taupiqueur has quit [Ping timeout: 260 seconds]
<FromGitter>
<jrei:matrix.org> You'll have more luck by using OOP
<FromGitter>
<jrei:matrix.org> For example, like done in `Array` with `select` and other methods, by mutating the same object then returning it
<ngp>
so currently I have an array of Procs, but I think I can work with it by wrapping each proc, it's input, and the next proc in the chain in an object
<FromGitter>
<Blacksmoke16> could also use an array of structs that have a `#call` method
<FromGitter>
<jrei:matrix.org> That's like how `HTTP::Server` does.