ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.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
<FromGitter> <watzon> Yeah it's unfortunate that open source doesn't really pay the bills
<FromGitter> <Blacksmoke16> if your project gets popular enough it possibly could
<FromGitter> <watzon> Yeah, but that's hard in a lesser known language like Crystal
<FromGitter> <Blacksmoke16> true, depends what you mean
<FromGitter> <Blacksmoke16> make*
<FromGitter> <Blacksmoke16> kinda is what influenced my Athena design change. (not that im expecting any income from any of this) but rather than banking on coming up with the next Rails, focus on creating smaller reusable components that *other* projects could take advantage of
<FromGitter> <bajro17> I working right now on regex router
<FromGitter> <Blacksmoke16> then you could build a framework out of those, or other projects could take advantage of them in their frameworks; which, in the end, only benefits the ecosystem
<FromGitter> <bajro17> I want see how it compare with radix
<FromGitter> <bajro17> maybe we can be even faster with regex instead use radix tree
<FromGitter> <Blacksmoke16> id be surprised if its faster, regex is kinda slow vs straight string parsing no?
<FromGitter> <bajro17> it bothers me how can be syro faster then routercr
<FromGitter> <bajro17> I will really love if someone can explain me why its faster when I dig deeper in syro
<FromGitter> <bajro17> I see main component is rack
<FromGitter> <bajro17> and how I can see rack is mostly about regex
<FromGitter> <bajro17> we need make rack in crystal and name it crack hahaha
<FromGitter> <Blacksmoke16> learned about a new symfony feature today, is pretty slick...made me wonder if it could be supported in crystal too
<FromGitter> <Blacksmoke16> essentially its a custom yaml tag that references a php class constant
<FromGitter> <Blacksmoke16> like register some custom tags with the yaml parser to control how that value gets parsed
<FromGitter> <Blacksmoke16> but w/o reflection idt it would be possible...
<FromGitter> <lbarasti> @RX14 I don't have the right to merge, but we're all green now 🎉
yukai has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
<hightower3> Let's say I have a struct with 6 Int16s, and I need to read them from an IO. Now, since I don't want these 6 variables to be nillable and assigned them one by one. Is there a way I can somehow do 6 times io.read_bytes(Int16, little_endian) and store these 6 vars at once?
<FromGitter> <Blacksmoke16> what id do is define an initializer that accepts the IO
<FromGitter> <Blacksmoke16> then just do like
<FromGitter> <Blacksmoke16> ```@one = io.read_bytes(Int16, ..) ⏎ @two = ...``` [https://gitter.im/crystal-lang/crystal?at=5dccae73091dd14a0eb6ab8e]
<hightower3> that's a good one as always, thanks!
<FromGitter> <Blacksmoke16> alas i can never do a project without find a compiler bug :S https://github.com/crystal-lang/crystal/issues/8468
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
nowhereFast has joined #crystal-lang
<nowhereFast> Is there a way to close sockets opened with `HTTP::Client.get` sooner/quicker?
<nowhereFast> I'm kicking some background work off and keep hitting `failed to create socket:: No file descriptors available` errors
<nowhereFast> guessing that these connections are not disposed of quick enough?
nowhereFast has quit [Ping timeout: 240 seconds]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 240 seconds]
ht_ has joined #crystal-lang
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 276 seconds]
ht_ has quit [Remote host closed the connection]
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
<hightower3> nowhereFast seems like you're creating connections anew while the old ones are using keep-alive and are still active
yukai has quit [Ping timeout: 240 seconds]
return0__ has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
return0__ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
alexherbo2 has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> proper variable naming is SOOO important!!
<FromGitter> <ImAHopelessDev_gitlab> Good variable naming helps me so much, wow!
<FromGitter> <ImAHopelessDev_gitlab> @vladfaust welcome back
<FromGitter> <ImAHopelessDev_gitlab> I think a problem is coming up with an actual good name for the property in the first place. Once you got that, it's like a golden ticket
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
alexherbo2 has joined #crystal-lang
return0e has quit [*.net *.split]
Vexatos has quit [*.net *.split]
sorcus has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
bougyman has quit [*.net *.split]
lvmbdv has quit [*.net *.split]
confact has quit [*.net *.split]
snapcase has quit [*.net *.split]
t1|Mike has quit [*.net *.split]
wmoxam has quit [*.net *.split]
maxpowa has quit [*.net *.split]
return0e has joined #crystal-lang
dostoyevsky has joined #crystal-lang
sorcus has joined #crystal-lang
Vexatos has joined #crystal-lang
maxpowa has joined #crystal-lang
wmoxam has joined #crystal-lang
lvmbdv has joined #crystal-lang
snapcase has joined #crystal-lang
confact has joined #crystal-lang
bougyman has joined #crystal-lang
t1|Mike has joined #crystal-lang
woodruffw has quit [Ping timeout: 240 seconds]
dostoyevsky has quit [Max SendQ exceeded]
Vexatos has quit [Quit: ZNC Quit]
dostoyevsky has joined #crystal-lang
woodruffw has joined #crystal-lang
return0e has quit [Ping timeout: 252 seconds]
Vexatos has joined #crystal-lang
return0e has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <bararchy> Hahaja var_157
<FromGitter> <bararchy> Security rule 58 if you can't read your code, the hackers also can't
return0__ has joined #crystal-lang
return0e has quit [Ping timeout: 245 seconds]
<hightower3> haha
<FromGitter> <bajro17> hahaha best rule I ever hear :D
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
gangstacat has quit [Ping timeout: 250 seconds]
alexherbo2 has joined #crystal-lang
gangstacat has joined #crystal-lang
return0__ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
duane has quit [Ping timeout: 268 seconds]
<FromGitter> <bajro17> how can I do case when
<FromGitter> <bajro17> with each array
<FromGitter> <j8r> example?
<FromGitter> <j8r> Ha pattern matching
<FromGitter> <j8r> Like with Tuples?
<FromGitter> <j8r> You have to transform the Array to an object
<FromGitter> <bajro17> I think I figure out
<FromGitter> <bajro17> I want make something like
<FromGitter> <bajro17> routes = [/\/url1\/{\d}/,/\/url2\/{\d}/]
<FromGitter> <bajro17> then to do case url when /\/url1\/{\d}/ do something
sagax has quit [Remote host closed the connection]
<FromGitter> <bajro17> I dont need case only if :)
duane has joined #crystal-lang
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.6]
ht_ has joined #crystal-lang
alexherbo2 is now known as alex```
alex```7 has joined #crystal-lang
alex``` has quit [Ping timeout: 268 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
olbat[m] has quit [Remote host closed the connection]
ternarysolo has quit [Write error: Connection reset by peer]
beepdog has quit [Write error: Connection reset by peer]
erdnaxeli has quit [Remote host closed the connection]
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
duane has quit [Ping timeout: 240 seconds]
alex```77 has joined #crystal-lang
alex```7 has quit [Ping timeout: 268 seconds]
duane has joined #crystal-lang
<hightower3> quite interesting
<Yxhuvud> Hmm. All the examples in that PR use a common superclass for the different choices. If that is necessary then that may be a bit limiting for how useful it is in practice.
<FromGitter> <Blacksmoke16> thats the main usecase
<FromGitter> <Daniel-Worrall> ooh!
<FromGitter> <straight-shoota> Yxhuvud, that's an interesting point
<FromGitter> <straight-shoota> But the implementation should really work without an inheritance relationship between the individual types
<FromGitter> <straight-shoota> You just need *a* type to define the discriminator method on, the mapping types don't need to be related
<Yxhuvud> Hmm, ok. That sounds rather useful. Especially as it seems you can define different discriminators for different contexts. (just because I want to be able to deserialize one way in one context doesn't mean it is ok to accept the same input in another).
<FromGitter> <straight-shoota> Yeah, the only restriction currently is that you need a separate type for each context
<FromGitter> <straight-shoota> This restriction shouldn't be strictly necessary, though.
<FromGitter> <straight-shoota> Actually, I bet this should really be able to work completely in runtime without any macro
<Yxhuvud> Being able to do `class Decoder; include JSON::Serializable; use_discriminator("type", {klass1: Klass1, klass2: Klass2 }); end` seems really nice to me, anyhow, if it works.
<Yxhuvud> It could work runtime, but you would probably lose performance by relying on hash lookups, which I think you would end up being dependent on.
<FromGitter> <nsuchy> is there a way to convert a String to an Integer
<FromGitter> <nsuchy> E.g. "12345" becomes 12345
<Yxhuvud> nsuchy: try "1234".to_i
<FromGitter> <nsuchy> thanks
<FromGitter> <straight-shoota> > *<Yxhuvud>* It could work runtime, but you would probably lose performance by relying on hash lookups, which I think you would end up being dependent on. ⏎ ⏎ Well, technically you could just iterate through the hash entries and compare them directly. That should be faster when it's only a few. This might still be a little bit slower than the macro approach, but that's hardly noticeable. It still
<FromGitter> ... needs to compare strings at runtime.
<Yxhuvud> truue
<FromGitter> <straight-shoota> Or just use a NamedTuple
duane has quit [Ping timeout: 252 seconds]
<FromGitter> <watzon> @straight-shoota so with it implemented at runtime it wouldn't require a Hash/NamedTuple literal right?
<FromGitter> <straight-shoota> Nope, just a Hash or NamedTuple
<FromGitter> <straight-shoota> Or whatever implements `#[]?`
<FromGitter> <watzon> Awesome, that would be really nice for my usecase. Right now I have over 700 types that have to be assigned as a literal, and I need to reuse that lookup table in multiple places which means a lot of duplicated code right now
<FromGitter> <straight-shoota> I know it gives a lot more flexibility. But I was wondering whether that would actually be that useful. Thanks for giving an example :D
<Yxhuvud> What are you building that needs that many types? :)
<FromGitter> <straight-shoota> It would still be a worthy improvement as it comes at almost no cost.
<FromGitter> <watzon> TDLib bindings. Telegram defines a fuck ton of custom types.
<Yxhuvud> Heh. I suppose I'm lucky when trying to do liburing bindings then. Not many types (instead there is fun things like static inline methods in .h files and fun macros that deal with volatile values)
sorcus has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<FromGitter> <christopherzimmerman> Oh my goodness, my week is made. I finally have broadcasting finished for bottle! ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dcdd11392a84f79fe6a1c49]
<FromGitter> <christopherzimmerman> Now it actually feels like numpy.
<FromGitter> <christopherzimmerman> ^ That's without copying any data, and just changing the strides of the array, so its memory efficient.
<hightower3> so good!
<FromGitter> <christopherzimmerman> The entire thing is 25 lines of code. Took me 2 weeks to write it lol
<FromGitter> <tenebrousedge> @christopherzimmerman way to go! 🎊
<FromGitter> <tenebrousedge> where's it at/
<FromGitter> <christopherzimmerman> https://github.com/crystal-data/bottle
<FromGitter> <christopherzimmerman> Always looking for contributors btw :)
<FromGitter> <christopherzimmerman> My big weakness is that I barely know crystal
<FromGitter> <Daniel-Worrall> I wish Crystal had eu friendly aliases
<FromGitter> <tenebrousedge> like what?
<FromGitter> <Daniel-Worrall> like Serialisable
<FromGitter> <tenebrousedge> Crystal doesn't go in for aliases
<FromGitter> <Daniel-Worrall> I know
<FromGitter> <tenebrousedge> :/
<FromGitter> <Daniel-Worrall> Maybe I'll make myself a stdlib_eu shard
<FromGitter> <tenebrousedge> you just need better autocomplete from your editor
<FromGitter> <Daniel-Worrall> Well maybe I want my code to be non-American
alex```77 has quit [Ping timeout: 276 seconds]
<FromGitter> <tenebrousedge> huh? what is "non-American"? This does not compute
<FromGitter> <kinxer> @christopherzimmerman At some point when I get some time I'm hoping to contribute a little.
<FromGitter> <alehander92> wow i didnt know
<FromGitter> <alehander92> this is valid british
<FromGitter> <watzon> Lmao
<FromGitter> <alehander92> i only know the `color`
<FromGitter> <alehander92> discussion
<FromGitter> <alehander92> oh no so color is actually american
<FromGitter> <Daniel-Worrall> British s -> American z
<FromGitter> <alehander92> so i dont even use british here
<FromGitter> <alehander92> yeah
<FromGitter> <Daniel-Worrall> British ou -> American o
yukai has joined #crystal-lang
<FromGitter> <straight-shoota> Well, #2394 would solve these issues
<DeBot> https://github.com/crystal-lang/crystal/issues/2394 (Use Esperanto instead of English)
<FromGitter> <Daniel-Worrall> Can I not use Time::EpochConverter for `"created_at":"2016-08-12 00:56:52"`?
<FromGitter> <Daniel-Worrall> Expected int but was string
<FromGitter> <Blacksmoke16> epoch converter expects the unix timestamp
<FromGitter> <Daniel-Worrall> oh duh
<FromGitter> <watzon> Hahahaha Esperanto
<FromGitter> <bajro17> is it possible use regex in has_key? for hash
Vexatos has quit [Ping timeout: 276 seconds]
<FromGitter> <Daniel-Worrall> Okay, so how do I correctly use the Time::Format as a converter
<FromGitter> <Daniel-Worrall> do I have to specify the pattern?
f1reflyylmao has quit [Ping timeout: 245 seconds]
<FromGitter> <bajro17> I try something like this
<FromGitter> <bajro17> I dont know is it good
<FromGitter> <bajro17> @watzon what you think?
sagax has joined #crystal-lang