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: 240 seconds]
ur5us has joined #crystal-lang
notzmv has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
HumanG33k has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
notzmv has quit [Read error: Connection reset by peer]
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
SamantazFox has joined #crystal-lang
<raz> oh wow. been logged out of github for the first time in like a year. their new homepage is really neat
<FromGitter> <Blacksmoke16> GH has a homepage? :P
<raz> right? lol
<FromGitter> <y8> Maybe there is something I can help with?
wmoxam has quit [*.net *.split]
wmoxam has joined #crystal-lang
ur5us has joined #crystal-lang
<FromGitter> <manufaktor> Hi, is there a way to pass a `call`able object as a `&block` argument? I imagined I could pass anything that responds to `call` as the block argument...
<FromGitter> <manufaktor> Hi, is there a way to pass a callable object as a &block argument? I imagined I could pass anything that responds to call as the block argument...
<FromGitter> <Blacksmoke16> Crystal doesn't have the concept of callable objects, at least like PHP does with `__invoke` at least
<FromGitter> <Blacksmoke16> `#call` is just another method
<FromGitter> <Blacksmoke16> i think you could do it if you turn the method into a proc first
<FromGitter> <manufaktor> aha, is there syntax for that, or would I just have to wrap it in a `->` ?
<FromGitter> <Blacksmoke16> assuming it doesn't have args, i think `&->(->someobj.call)` maybe?
<FromGitter> <manufaktor> it has args, but I think it's hard to read anyway :)
<FromGitter> <Blacksmoke16> if it has args you need to pass the type of each one like `->someobj.call(Int32, String)`
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <manufaktor> I tried something like this for making an object a callable, but yeah I think I'll have to make it some other way ⏎ `class UsersResponse < Proc(Context, String)`
<FromGitter> <Blacksmoke16> a method is callable if it defines a `#call` method
<FromGitter> <Blacksmoke16> but its not a special thing like in some langs, nor can you just do like `someobj(123)` if it implements `def call(id : Int32)`
<FromGitter> <Blacksmoke16> an object*
<FromGitter> <Blacksmoke16> i guess to rephrase, the only reason to use `#call` is to maintain a consistent API with a proc with the same args
<FromGitter> <Blacksmoke16> i.e. its not a special method
<FromGitter> <manufaktor> thanks, understood. Thank you for helping me <3
ur5us has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
ur5us has joined #crystal-lang
notzmv has quit [Ping timeout: 245 seconds]
notzmv has joined #crystal-lang