ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <watzon> Is there any way to insert an element into an array at a specific index and have it expand instead of raising an IndexError?
lucasb has quit [Quit: Connection closed for inactivity]
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> yea
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Array.html#insert%28index%3AInt%2Cobject%3AT%29-instance-method @watzon
<FromGitter> <watzon> Can that be used to insert out of index though? For instance for an Array [1, 2, 3, 4] could I `insert(8, 1)`?
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> could make your own method to do that, would have to pad it
<FromGitter> <watzon> That's what I thought
<FromGitter> <Blacksmoke16> yea
<FromGitter> <watzon> Oh well, I figured out a way around my issue
<FromGitter> <Blacksmoke16> i mean i dont think it would be a hard method to add
<FromGitter> <watzon> So I just created a Crystal version of Open Location Codes (https://github.com/google/open-location-code) and benchmarked it against Ruby
<FromGitter> <watzon> Ruby ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d1d7e45b1b66b7203d2163e]
<FromGitter> <watzon> Not bad
<FromGitter> <watzon> Here's the library btw https://github.com/watzon/pluscode
_whitelogger has joined #crystal-lang
<FromGitter> <watzon> @Blacksmoke16 finally testing out Athena
absolutejam3 has joined #crystal-lang
<FromGitter> <wontruefree> i made a quick and dirt qrcode encoder https://github.com/wontruefree/qrencode
<FromGitter> <wontruefree> just in case someone idling here was looking for one
<FromGitter> <watzon> Got a 404 with that link
<FromGitter> <watzon> Where's @Blacksmoke16 when you need him?
<FromGitter> <wontruefree> @watzon it was private I just made it public
<FromGitter> <watzon> Ahh there you go
<FromGitter> <wontruefree> thanks for the response though I forget to make some of these repos public
<FromGitter> <wontruefree> also made a quick readme and demo
DTZUZO has quit [Ping timeout: 245 seconds]
absolutejam3 has quit [Ping timeout: 268 seconds]
jhass has quit [Ping timeout: 245 seconds]
asterite has quit [Ping timeout: 264 seconds]
asterite has joined #crystal-lang
jhass has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 246 seconds]
flaviodesousa has joined #crystal-lang
flaviodesousa has quit [Max SendQ exceeded]
<FromGitter> <mwlang> hmmm...I just realized I have versioning in two places...once in the shard.yml and again in a version.cr file.
<FromGitter> <watzon> Yup that's pretty typical
<FromGitter> <watzon> Of course you can pull your version into your `version.cr` from `shard.yml` if you don't feel like keeping track in both places
<FromGitter> <mwlang> Is there anything that actually checks these version numbers? I'm thinking to just remove the VERSION constant within the crystal code.
<FromGitter> <mwlang> I know Ruby utilizes the VERSION constant in gems management, but I suspect crystal only looks at shard.yml
<FromGitter> <mwlang> for any sort of dependency management, that is.
<FromGitter> <watzon> Not really, I mean there could be times when other shards will want to keep track of the version or where you might want to use it in a CLI or something
<FromGitter> <mwlang> ah...CLI -- that's a good use-case, which I don't have.
<FromGitter> <mwlang> ok, it's a goner.
<FromGitter> <j8r> @dscottboggs_gitlab what advantage does it bring to have `@[AlwaysInline]`?
<FromGitter> <watzon> I believe it's the same principle as with C's inline functions
<FromGitter> <j8r> So why not having it by default?
<FromGitter> <watzon> That is a good question. I don't think all functions benefit from inlining. I don't know enough about it though.
<FromGitter> <watzon> I haven't worked with C much
<FromGitter> <mwlang> inlining is kind of a fine balance, micro-optimization thing
<FromGitter> <mwlang> when there's not a lot of code in the function you're inlining, you can save the call overhead and realize some performance boost, esp. in heavy number crunching routines.
<FromGitter> <mwlang> but when you have a lot going on in a function, it's better to take the call penalty for the space-saving, compiling speed, optimize once, etc. benefits gained.
<FromGitter> <mwlang> in my particular case, it really doesn't even matter, so I didn't opt to do it since I'm pretty sure 99% of the utilized time is waiting on the network API call to return the data.
<FromGitter> <j8r> 👍 that would be a kind of over-optimization
<FromGitter> <mwlang> personally, I don't even consider this degree of optimization in building web-apps, esp. in Ruby, so it's interesting to suddenly be facing the possibility that I *can* consider such in Crystal. Kind of brings back memories of my Windows programming days and doing all kinds of micro optimizations to make things run as fast and as small as possible (before RAM, diskspace and CPU became plentiful and cheap)
<FromGitter> <alex-lairan> Yes, I agree ⏎ ⏎ It's better to challenge code complexity in time and memory before inlining things :)
<FromGitter> <alex-lairan> (But, inside a lib, it's interesting to optimize things)
<FromGitter> <yxhuvud> see it like this: If it was optimal to always have it, the compilers would do it by default. Don't add it unless you try with it and without it and notice an improvement.
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
alex`` has joined #crystal-lang
sorcus has joined #crystal-lang
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
absolutejam3 has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> Hm. I just always use it for simple one-line functions like this out of habit... didn't realize it was such a controversial concept
absolutejam3 has quit [Ping timeout: 268 seconds]
<Yxhuvud> not controversial, just useless most of the time. most of the time the compiler is smart enough to inline stuff itself
absolutejam3 has joined #crystal-lang
<FromGitter> <watzon> Well it's been a long night, but I turned my pluscode project into a little API
<FromGitter> <watzon> And with that I'm off to sleep
<FromGitter> <bararchy> good night @watzon
absolutejam3 has quit [Ping timeout: 244 seconds]
alex`` has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
alex`` has joined #crystal-lang
<Yxhuvud> Hmm, was there any happily overflowing variants of >>= added for the overflow variants?
<Yxhuvud> (ugh, crap english. hopefully understandable message)
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 248 seconds]
<Yxhuvud> Actually, is there any table of all the overflow protected operations somewhere in the documentation or do I have to go look in the PRs?
DTZUZO has joined #crystal-lang
<Yxhuvud> (or well, is there any place where it will be once the overflow flag ends up being the default case?)
blassin27 has joined #crystal-lang
blassin2 has quit [Ping timeout: 248 seconds]
flaviodesousa has joined #crystal-lang
<FromGitter> <Blacksmoke16> @watzon sleeping :P
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 272 seconds]
<FromGitter> <Blacksmoke16> @watzon thats fixed in master now. Seems i missed those types
absolutejam3 has joined #crystal-lang
teardown has quit [Read error: Connection reset by peer]
alex`` has quit [Ping timeout: 245 seconds]
absolutejam3 has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 246 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
lucasb has joined #crystal-lang
<FromGitter> <mwlang> What? @watzon sleeping? No way. Someone poke him.
<FromGitter> <Blacksmoke16> no i was sleeping, in reference to
<FromGitter> <Blacksmoke16> ☝️ July 4, 2019 2:12 AM (https://gitter.im/crystal-lang/crystal?at=5d1d98dae0cad96750a3fa2a)
<FromGitter> <mwlang> but you don't sleep either.
<FromGitter> <mwlang> :-D
<FromGitter> <Blacksmoke16> *lies*
Yxhuvud has quit [Remote host closed the connection]
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Ping timeout: 246 seconds]
Yxhuvud has joined #crystal-lang
absolutejam3 has joined #crystal-lang
absolutejam3 has quit [Read error: Connection reset by peer]
absolutejam1 has joined #crystal-lang
absolutejam1 has quit [Read error: Connection reset by peer]
absolutejam1 has joined #crystal-lang
DTZUZO has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 245 seconds]
mps has quit [Quit: leaving]
mps has joined #crystal-lang
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
flaviodesousa has quit [Read error: Connection reset by peer]
flaviodesousa has joined #crystal-lang
<FromGitter> <watzon> Lol @Blacksmoke16 sleeping? No way!
<FromGitter> <Blacksmoke16> sleep is one of my fav things
<FromGitter> <watzon> Lol mine too, but you'd never know it
<FromGitter> <watzon> Oh, and happy 4th of July. May the odds be ever in your favor.
<FromGitter> <watzon> Or something like that
<FromGitter> <Blacksmoke16> ☝️ July 4, 2019 1:13 AM (https://gitter.im/crystal-lang/crystal?at=5d1d8ae907bf5635af254aa4)
<FromGitter> <Blacksmoke16> how'd that go for you?
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <watzon> I wasn't able to use it because of the JSON issue, but I'll try it again soon
<FromGitter> <watzon> I see you got that fixed
<FromGitter> <Blacksmoke16> yea, missed those types i guess
<FromGitter> <Blacksmoke16> were you just wanting to render arbitrary json?
<FromGitter> <watzon> Yeah, I was trying to use Athena with google_maps_api
<FromGitter> <watzon> For pluscode-api.watzon.tech
<FromGitter> <watzon> I'll have more small api projects in the near future though
<FromGitter> <Blacksmoke16> gotcha, should be good now, if you run into anything else let me know
<FromGitter> <watzon> Will do
<FromGitter> <bararchy> my biggest wish for Crystal is enums with non Int based values
<FromGitter> <bararchy> ```enum MyEnum ⏎ Foo "foo" ⏎ Bar "bar" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d1e3643dcd1894b8dbd504d]
<FromGitter> <watzon> That would be wunderbar
<FromGitter> <Blacksmoke16> elvis operator would be handy
<FromGitter> <Blacksmoke16> `string = string ?: "empty"`
<FromGitter> <Blacksmoke16> which is like `string = string ? string : "empty"`
<FromGitter> <watzon> That would be nice as well
<FromGitter> <Blacksmoke16> also is `??`
<FromGitter> <dscottboggs_gitlab> how is `?:` different from `||`? Like I've used it in kotlin because `or` works different in Kotlin but I don't see the point in crystal
<Yxhuvud> you mean ||=. || break if lhs isn't assigned yet.
<FromGitter> <Blacksmoke16> `||` only works the the first value is nil/false
<FromGitter> <Blacksmoke16> `"" || "foo" # => ""`
<FromGitter> <Blacksmoke16> well
<FromGitter> <Blacksmoke16> that wouldnt wo
<FromGitter> <dscottboggs_gitlab> yes, so does elvis?
<FromGitter> <Blacksmoke16> right :P good call lol
<Yxhuvud> do elvis work on stuff that isn't assigned?
<FromGitter> <Blacksmoke16> in php you cant do like `false || 1` so prob why they implemented an operator for it
<FromGitter> <Blacksmoke16> not really needed since you can do that in crystal
<FromGitter> <dscottboggs_gitlab> yeah in Kotlin `nil or 1` is just false because the `or` operator only returns a boolean not lhs or rhs
snsei__ has joined #crystal-lang
snsei__ has quit [Ping timeout: 276 seconds]
absolutejam1 has joined #crystal-lang
snsei__ has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 268 seconds]
absolutejam1 has joined #crystal-lang
snsei__ has quit [Ping timeout: 250 seconds]
<FromGitter> <naqvis> Made my first contribution by submitting a shard for reading/writing `Tar` archives. This shard supports GNU, PAX and USTAR tar formats. Effort has been made to make the api as fluent as other archive modules in standard lib. ⏎ https://github.com/naqvis/crystar
<FromGitter> <Blacksmoke16> neat
absolutejam1 has quit [Read error: Connection reset by peer]
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <girng> very cool @naqvis
<FromGitter> <j8r> @naqvis there was already https://github.com/arcage/tarball.cr
<FromGitter> <j8r> BTW good job, I may use if it was supporting tar.xz. I know, xz has to be implemented first :/
snsei__ has joined #crystal-lang
absolutejam1 has joined #crystal-lang
alex`` has quit [Ping timeout: 248 seconds]
absolutejam2 has joined #crystal-lang
absolutejam1 has quit [Ping timeout: 258 seconds]
snsei__ has quit [Ping timeout: 276 seconds]
snsei__ has joined #crystal-lang
snsei__ has quit [Remote host closed the connection]
snsei__ has joined #crystal-lang
snsei__ has quit [Ping timeout: 252 seconds]
alex`` has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 244 seconds]
DTZUZO has joined #crystal-lang