ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
<FromGitter> <didactic-drunk> Could I use this ⏎ ⏎ ``` header.value = {String::TYPE_ID, @bytesize - 1, 0} ⏎ @buffer.as(String)``` ⏎ ⏎ to make a String from c constant? [https://gitter.im/crystal-lang/crystal?at=5d6c759ab4d8294074b64561]
chemist69 has quit [Ping timeout: 252 seconds]
chemist69 has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
<FromGitter> <sam0x17> any way I can break early from a `.each` ?
<FromGitter> <sam0x17> (in a captured block)
<FromGitter> <sam0x17> `Error: can't return from captured block, use next` :(
<FromGitter> <sam0x17> figured out my problem -- this guy defined `.each` for this collection via a captured block ... just had to access it in a different way not using his `.each` and it worked
Groogy has quit [Quit: WeeChat 2.5]
gangstacat has joined #crystal-lang
ht_ has quit [Quit: ht_]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 246 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
<FromGitter> <asterite> @didactic-drunk I can't see how having a buffer from C, `buffer = [....]`, you'll make it so that you'll put some bytes before that buffer and then cast the whole thing to a Crystal String. You can try to make it work but I think it's impossible
beepdog has quit [Remote host closed the connection]
olbat[m] has quit [Read error: Connection reset by peer]
beepdog has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> n
olbat[m] has joined #crystal-lang
DTZUZO has joined #crystal-lang
chachasmooth_ has joined #crystal-lang
chachasmooth has quit [Ping timeout: 276 seconds]
HumanG33k has joined #crystal-lang
Human_G33k has quit [Read error: Connection reset by peer]
<FromGitter> <yxhuvud> oh, multithreading was just merged.
<FromGitter> <Blacksmoke16> wtb the blog post
<FromGitter> <asterite> I'm guessing the blog post will appear when 0.31.0 is released
<FromGitter> <Blacksmoke16> we shall see
<FromGitter> <bajro17> @yxhuvud Amazing <3
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 246 seconds]
ht_ has joined #crystal-lang
chachasmooth_ has quit [Read error: Connection reset by peer]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Read error: Connection reset by peer]
chachasmooth has joined #crystal-lang
<FromGitter> <Qu4tro> Hey 👋 . What's the best lightweight router around here? I'm not sure of the status of `router.cr` or `crouter`, which seems they may un-maintained (especially crouter).
<FromGitter> <waghanza> `router.cr` is used by https://spider-gazelle.net/#/
<FromGitter> <Qu4tro> Ah thanks! Just gave it a try, but it's erroring when installing with `shards install`. ⏎ This is the `shard.yml`: ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5d6d3a2c38499c13a68aa0ec]
dretnx has joined #crystal-lang
<FromGitter> <Qu4tro> Is there anything I can do, to overcome this?
<FromGitter> <Qu4tro> Additionaly, also checked https://github.com/spider-gazelle/action-controller/blob/master/shard.yml, but it seems they're integrating `router.cr` itself into the lib?
<FromGitter> <waghanza> @Qu4tro use a version ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and create an issue for that on the github repo [https://gitter.im/crystal-lang/crystal?at=5d6d3b242efeca1df53beb56]
<FromGitter> <waghanza> of course if using `spider-gazelle` no need to add `router.cr` as a dependency (as it is already the case)
<FromGitter> <Qu4tro> Amazing. Thanks! I'll create the issue. ⏎ Can you explain or point to somewhere where it explains the issue I was having. Would like to understand why it's failing.
Human_G33k has joined #crystal-lang
sagax has quit [Ping timeout: 246 seconds]
HumanG33k has quit [Ping timeout: 245 seconds]
<FromGitter> <Qu4tro> Ah thanks! My google-fo seems to have failed me.
dretnx has quit [Ping timeout: 245 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 264 seconds]
sagax has joined #crystal-lang
<FromGitter> <shinzlet> I'm trying to overload `self.new` on a class, and it's only working when the constructor doesn't take an argument. Anyone know what's going on? I think that the `self.new` method made by the class might be shadowing only the one in the second example for some reason. ⏎ ⏎ Sample one (works) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d6d50e00d4b1f5d88a2ca96]
<FromGitter> <Blacksmoke16> what happens if you move `self.new` below the initialize method
<FromGitter> <Blacksmoke16> they're the same so its prob using the last defined overload
<FromGitter> <shinzlet> I'll give that a try
<FromGitter> <shinzlet> Hey that worked! Thanks a ton
<FromGitter> <Blacksmoke16> np
<FromGitter> <shinzlet> is there any way to make crystal just perform macro subs and code gen without compiling it?
<FromGitter> <shinzlet> So that I could debug something like that a little easier haha
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <shinzlet> Self.new is automatically defined as a class method on all classes, according to the docs, so I'm guessing there's a preprocessing step where it actually puts that method into the class body before compilation
<FromGitter> <shinzlet> It is absolutely possible I don't know what I'm talking about here, but that's the hunch I had :p
<FromGitter> <ezrast_gitlab> There is `crystal tool expand` for seeing macro results, but implicit `.new` methods aren't a macro so not related.
<FromGitter> <shinzlet> I just found that in my own digging! and yup, unfortunately not helpful in this specific case
<FromGitter> <shinzlet> I don't think there's any way to see generated code currently from my searching these last ten minutes
<FromGitter> <shinzlet> Anyhow, thank you @ezrast_gitlab and @Blacksmoke16 ! Got it working now.
<FromGitter> <ezrast_gitlab> Aside from reordering, you can also avoid the method signature collision by doing this: https://carc.in/#/r/7h39
<FromGitter> <shinzlet> Clever! I was thinking about using named arguments, but in my case I would only ever need the overloaded new method
<FromGitter> <asterite> each `initialize` will add a matching `self.new` at the end of the first pass
<FromGitter> <shinzlet> Good to know!
olbat has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 245 seconds]
Stephie has quit [Quit: Fuck this shit, I'm out!]
Stephie has joined #crystal-lang
sorcus has quit [Ping timeout: 265 seconds]
chemist69 has quit [Ping timeout: 265 seconds]
chemist69 has joined #crystal-lang
sorcus has joined #crystal-lang
return0e has quit [Ping timeout: 244 seconds]
return0e has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> @didactic-drunk any thoughts on https://github.com/Blacksmoke16/crylog/pull/6#discussion_r319732324?
alex``` has joined #crystal-lang
alex`` has quit [Ping timeout: 252 seconds]
<FromGitter> <watzon> @Blacksmoke16 you can have named arguments in an annotation right?
<FromGitter> <Blacksmoke16> Yes
<FromGitter> <Blacksmoke16> And positional
<FromGitter> <watzon> How do you access named params? I tried doing it like you would with a named tuple and it didn't work? Do I need to do it more like a hash?
<FromGitter> <Blacksmoke16> Got some example code?
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d6d996b29dba2421cf21aec]
<FromGitter> <watzon> Doesn't work
<FromGitter> <watzon> It looks like accessing it like a Hash might though
<FromGitter> <watzon> It's compiling at least
<FromGitter> <watzon> Yep, works
<FromGitter> <Blacksmoke16> Do your logic in macro land
<FromGitter> <watzon> Yeah I figured that out just now
<FromGitter> <Blacksmoke16> `= {{ann[:at_start].nil? ? true : ann[:at_start]}}`\
<FromGitter> <watzon> I'm actually just autocasting to a bool instead `{{!!ann["at_start"]}}`
<FromGitter> <Blacksmoke16> that works too
<FromGitter> <Blacksmoke16> using symbol should work as well
<FromGitter> <Blacksmoke16> if not is something else going on im thinking
<FromGitter> <watzon> Hmm, yeah something else must've been
<FromGitter> <watzon> It's working now
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> trying to figure out how i want to setup my serialization lib
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d6d9c9e29dba2421cf23352]
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> ```user = User.new ⏎ ⏎ puts user.to_json``` [https://gitter.im/crystal-lang/crystal?at=5d6d9caa8b7327421de0e43c]
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d6d9ccbd3fda15e74558773]
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> Something else
<FromGitter> <watzon> There are going to be multiple serializers?
<FromGitter> <Blacksmoke16> at least YAML, but should be easy to support other formats
<FromGitter> <watzon> Then I like the last option personally
<FromGitter> <watzon> With the helper method as well
<FromGitter> <Blacksmoke16> is it a common use case to have application specific formats? im thinking no
<FromGitter> <Blacksmoke16> if so the first would be easiest to expand as you could just define a module that implements that method, vs having to PR the lib
<FromGitter> <Blacksmoke16> but yea, i tend to like the last one as well, could enum the formats, and provide some method to get the module used in the first based on the type
<FromGitter> <Blacksmoke16> the idea is `Object` (or some module you can include) defines the `#serialize` method
<FromGitter> <Blacksmoke16> uses the enum type to get the correct converter?, then passes an array of structs to the converter's serialize method, which is responsible for turning that array of metadata into the output string
<FromGitter> <Blacksmoke16> also assuming that the main `#serialize` method handles setting the properties to ignore, their serialized name, etc so thats all format agnostic
<FromGitter> <Blacksmoke16> im not missing anything obvious am i?