Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 240 seconds]
<FromGitter>
<naqvis> @Dan-Do please give some love to type annotations, they are going to help you in long run and identify problems at the right spot. ⏎ `def render(layout, data)` Your current method signature doesn't reveal, what is this method expecting to work properly ⏎ ⏎ imagine what would happen when someone call it `foo.render(1, "fooo")` ? [https://gitter.im/crystal-lang/crystal?at=60a925fd0ff6de262b21f364]
<FromGitter>
<naqvis> compiler will yell at you stating that block parameter can't be executed, but that isn't the fault of the block
<FromGitter>
<naqvis> type annotating signature to`def render(layout : String, data : Hash)` will complain at the right location, where problem is happening
<FromGitter>
<naqvis> another point i would like to make is `if var` construct is used if you are working with optional types (types who might be nil)
<FromGitter>
<naqvis> block parameter is never going to be nil (as per the signature), so you needn't to use such construct there
<FromGitter>
<naqvis> just few random thoughts 😄
<FromGitter>
<Dan-Do> yeah, I appreciate that ❤️
<FromGitter>
<naqvis> 👍
lanodan has left #crystal-lang ["WeeChat 3.1"]
<FromGitter>
<lebogan> Please, let me know if this is the right place for my issue. I was using kemal-flash which relied on json.mapping which broke in 0.36.0. Not sure how to fix. Anyone know of a replacement shard for neovintage/kemal-flash? Or maybe steer me to how to fix? Thanks.
<FromGitter>
<Blacksmoke16> Or ofc update it to use json serializable
<FromGitter>
<lebogan> @Blacksmoke16 , @jhass thank both of you for the quick response. After some struggling, I managed to update to json serialize. I'm notifying the shard maintainer.
postmodern has joined #crystal-lang
<postmodern>
is there a short-hand like enum_for, for calling a method that yields args, and appending them to an Array?
<FromGitter>
<Blacksmoke16> Hm?
<postmodern>
if you have method A which yields data, and you want to write an overloaded version of method A that returns an Array of that data, is there a macro for that?
<postmodern>
i'm assuming i have to write that code which initializes an Array, calls the method with a block, and appends the yielded args to the array, then return the array
<FromGitter>
<Blacksmoke16> yea theres not a macro to do that for you