RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.0 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<Papierkorb> jwoertink, you can do `Sample.x` - macros behave like a class method in that regard
<FromGitter> <jwoertink> Oh? hmm.. I had tried that but it threw an error. Maybe the error was related to something else though. I'll give it another shot. Thanks!
sz0 has joined #crystal-lang
<FromGitter> <drosehn> Might want to put a `{% debug() %}` just before the `end` of your macro to see if it really is producing what you expect it to produce.
<FromGitter> <jwoertink> What's `debug()`? I haven't seen that yet
<FromGitter> <jwoertink> Do I need to run with a `--debug` flag or something?
<Papierkorb> the debug() macro function dumps the output of the macro itself to standard out on compile-time
<Papierkorb> no need for --debug
<FromGitter> <jwoertink> oh cool. That will help for sure
olek_poz has quit [Ping timeout: 258 seconds]
<FromGitter> <drosehn> Note that `{% debug() %}` is only for "seeing inside" macros at compile-time. It isn't related to `--debug`.
bjz has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter> <tekjar> Hi. How do I create getters for my instance variables?
<FromGitter> <jwoertink> You don't have a `client_id` method
<FromGitter> <jwoertink> if you use `getter client_id` it will use the @client_id and make the method
<FromGitter> <jwoertink> or `property client_id` if you want getter and setter
<FromGitter> <tekjar> @jwoertink Ohh. I think I tried `property`
<FromGitter> <tekjar> Do I need to initialize in place if I add `property`?
<FromGitter> <tekjar> Oh. Thanks
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <jwoertink> You need a space between `client_id` and the `:`
<FromGitter> <jwoertink> `client_id : String` not `client_id: String`
<FromGitter> <tekjar> Oh damn. This feels weird. Why did the other non property type declarations work?
<FromGitter> <jwoertink> You should also add a space after the instance variables, even though the compiler doesn't mind those
<FromGitter> <jwoertink> because you can't have a : in your instance variable name, so the compiler knew
<FromGitter> <jwoertink> but with the property name, it doesn't know if you're defining a property, or a hash with symbol keys
<FromGitter> <jwoertink> and actually, you could get rid of those instance variable declarations since you initialize them with default values https://play.crystal-lang.org/#/r/1p78
bjz has joined #crystal-lang
<FromGitter> <tekjar> @jwoertink Ohh alright. Thanks a lot :)
<FromGitter> <jwoertink> :thumbsup:
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cyberarm has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #4122: Fix typo and NOTE flag in GZIP::Writer doc comment (master...fix-gzip-writer-doc) https://git.io/vyEhh
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
tatey has quit [Ping timeout: 240 seconds]
tatey has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Qchmqs has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
sigipa has joined #crystal-lang
olek_poz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
zaiste has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
pawnbox has joined #crystal-lang
olek_poz has joined #crystal-lang
mark_66 has joined #crystal-lang
nickc2 has quit [Ping timeout: 258 seconds]
nickc2 has joined #crystal-lang
gloscombe has joined #crystal-lang
<FromGitter> <schoening> @sdogruyol i read your 60.000 websocket benchmark. Really impressive for what it is :) but we need a benchmark showing what happens when those people send messages! Server broadcasting and maybe some json manipulation :smile: !!!
<FromGitter> <schoening> I'm gonna take a look at tsung. I only wish it wasn't xml :worried:
<Qchmqs> is windows support planned ?
<FromGitter> <schoening> Yes
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
zaiste has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zaiste has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Svenskunganka has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
zaiste has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
gloscombe has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
zaiste has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
zaiste has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alxnlssn has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
zaiste has joined #crystal-lang
<crystal-gh> [crystal] bcardiff closed pull request #4122: Fix typo and NOTE flag in GZIP::Writer doc comment (master...fix-gzip-writer-doc) https://git.io/vyEhh
pawnbox has joined #crystal-lang
pawnbox_ has quit [Ping timeout: 264 seconds]
zaiste has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #4123: Add Crystal::LLVM_VERSION to docs (master...add-crystal-llvm-constant-docs) https://git.io/vyzJp
olek_poz has quit [Ping timeout: 260 seconds]
<FromGitter> <fridgerator> Is it possible to send an http post request using TLS 1.2? Trying to access Stripe API, won't allow tls 1.x
Qchmqs has quit [Read error: Connection reset by peer]
<FromGitter> <fridgerator> on OSX
<RX14> crystal uses openssl
<RX14> so it depends on your openssl version I would assume
<FromGitter> <fridgerator> yeah I might have to try and use linux
<FromGitter> <fridgerator> openssl on mac is old
<FromGitter> <drosehn> If the user has installed a newer openssl via macports or brew, does crystal use that?
<RX14> i don't know
<FromGitter> <fridgerator> I doesn't seem like it
<RX14> i think if you use brew link or sth but idk
<RX14> this is why I use linux :)
<RX14> also lack of money
<FromGitter> <fridgerator> I just installed openssl 1.0.2k and symlinked to /usr/local/bin, but doesn't seem to work
<FromGitter> <fridgerator> I've thought about switching back to linux as my main dev machine
<RX14> well crystal obviously doesn't use the openssl binary
<RX14> it uses the library...
<RX14> so symlinking the binary will do nothing
<FromGitter> <fridgerator> ah right
<travis-ci> crystal-lang/crystal#176bd62 (master - Fix typo and NOTE flag in GZIP::Writer doc comment (#4122)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/208985884
<DeBot> https://github.com/crystal-lang/crystal/pull/4122 (Fix typo and NOTE flag in GZIP::Writer doc comment)
<wmoxam> I've updated the OpenBSD port for Crystal 0.21.1: http://wmoxam.com/crystal-openbsd.html
<FromGitter> <sdogruyol> @wmoxam thank you :tada:
soveran has quit [Remote host closed the connection]
<wmoxam> I should probably make a port for shards too
<FromGitter> <sdogruyol> doesn't shards work by default?
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<wmoxam> I think it may be packaged with the OSX + Linux builds
<FromGitter> <tekjar> Hi. I want to ping to the server periodically while also reading from the server.
<FromGitter> <tekjar> ```loop do ⏎ packet = @socket.read_bytes(Mqtt, IO::ByteFormat::NetworkEndian) ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58c03120e961e53c7fb8af4e]
<FromGitter> <tekjar> How do I create a timer and select between `read_bytes` and timer timeout?
<FromGitter> <fridgerator> you can create a timer by putting the loop in a new thread and using `sleep`
<RX14> anyone got good naming suggestions for a crenv replacement?
<RX14> there's cvm (like rvm) but I'd like something more memorable if possible
<FromGitter> <fridgerator> @RX14 you don't like crenv?
<RX14> it's OK, but i'd like to try rewriting it in (mostly) crystal
<RX14> with just a few shell hooks for integration
<FromGitter> <fridgerator> @RT `spawn { loop do; puts "in the loop"; sleep 10; end }`
mark_66 has quit [Remote host closed the connection]
ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.1 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<FromGitter> <tekjar> @fridgerator So when timeout happen, I should do a n/w write. Is it safe to write again in a different thread using same socket?
<FromGitter> <tekjar> Especially when TLS is involved where WRITE calls also does READS internally
<RX14> you can't select on read_bytes
<RX14> you can set a timeout on the IO
<RX14> and catch the exception
<RX14> but that's it
<FromGitter> <tekjar> So `read_bytes` timeouts after that and I do a n/w write then?
<RX14> what do you mean n/w
<FromGitter> <tekjar> Ah sorry. n/w --> network
<FromGitter> <tekjar> I mean tcp write in this case
<RX14> you can use an IO from multiple threads
<RX14> don't timeout the reads, just spawn a seperate fiber
<RX14> and use that in a loop to send the pings
<RX14> IO#write calls are atomic as far as I know
<literal> RX14: crock
<RX14> so as long as you structure your message as a single IO#write call you'll be fine
<RX14> literal, hmm
<RX14> literal, what's your thought process behind the name?
<literal> doesn't seem to have any technical connotations according to Google
<literal> RX14: a crock is a container
<literal> that was the idea
<RX14> ohh yeah that is indeed a good name
<literal> crane seemed good too, but there's an open-source project using that name
olek_poz has joined #crystal-lang
<RX14> hmm
<RX14> i'll consider both
<RX14> I thikn creane is easier to get as a name
<literal> I got both from $(grep ^cr /usr/share/dict/words) :P
<RX14> that's a very good way to name things
<RX14> thanks for the idea
<RX14> I might go with crane as there's no other crystal project called crane
<Papierkorb> RX14: I have a list of names I get from watching shows or stuff, and when I need one, I most likely pull it from there
<RX14> heh, i wish I had such a list
<RX14> I'm always to absorbed in shows to collect names while i'm watching them
<Papierkorb> Before that I literally said "the first name I hear will be the name of the project" and started a random episode of a series I already watched
<Papierkorb> it did work to some degree ;)
<RX14> hah
olek_poz has quit [Ping timeout: 260 seconds]
<RX14> but yeah, crane will take crystal version from shard.yml as well as .crystal-version, and will be more robust. It'll be able to build crystal and shards from previous releases using only the crystal git repo, and eventually be able to manage entire toolchains for cross-complation
<RX14> starting with alpine linux for musl libc static compilation support
<RX14> (hopefully)
<RX14> thats my goal at least
<FromGitter> <sdogruyol> what is crane?
<RX14> @sdogruyol A crenv replacement that i'm about to start working on, @literal gave me a name
<FromGitter> <sdogruyol> that'd be lovely
<FromGitter> <sdogruyol> crenv is good but causes lots of hard to debug problems
<RX14> indeed
<RX14> i'm going to write it in mostly crystal with some small bits of bash for shell integratiion
<RX14> probably will have a look at rustup for inspiration too
<FromGitter> <sdogruyol> i love rustup
<FromGitter> <sdogruyol> it's grown so big now one can easily cross-compile with it
<RX14> i've never used it myself
<RX14> or rust much
<RX14> maybe you can help out with crane suggestions if you've used rustup :)
<FromGitter> <sdogruyol> i've started using it when rust was in best in 2015
<FromGitter> <sdogruyol> it was just there to easily install and switch between versions
<FromGitter> <sdogruyol> 2 years later it's like the official way to install rust and cross-compile stuff
<FromGitter> <sdogruyol> and back in the days it was just some shell scripts :P
<FromGitter> <sdogruyol> not best -> *beta
<RX14> cool
A124 has quit [Quit: '']
A124 has joined #crystal-lang
<FromGitter> <sdogruyol> Wow i just checked Rust's main page after a long time and i love this https://www.rust-lang.org/en-US/friends.html
<FromGitter> <drosehn> Looks like the list is randomized, so each time you visit it shows the friends in a new order.
<FromGitter> <sdogruyol> oh nice
<RX14> that is awesome
<FromGitter> <crisward> I love the fact that the rust sample on home page doesn't work :wink:
<FromGitter> <sdogruyol> woot?
<FromGitter> <sdogruyol> it did work for me when i press "run"
<FromGitter> <crisward> I get an error
<FromGitter> <crisward> If you're going to include a demo, should really be sure its going to work.
<FromGitter> <sdogruyol> lol
<RX14> well i assume the demo works most of the time
<RX14> that's not a compile error
<RX14> thats a network error
<RX14> i don't see the complaint personally
<FromGitter> <crisward> It's the audience effect, it's what breaks projectors when a room is full.
<FromGitter> <tekjar> I love `rustup`. It would be awesome if crystal could do something similar
<RX14> well
<RX14> i think I violated the "don't talk about it until you know it's going to happen" rule already
<RX14> but i'll try and make it happen
soveran has quit []
olek_poz has joined #crystal-lang
<FromGitter> <sdogruyol> @RX14 i believe you can do it
alxnlssn has quit [Quit: Connection closed for inactivity]
A124 has quit [Ping timeout: 240 seconds]
<RX14> i'm sure I could do it if I had enough time :)
A124 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Raimondi has quit [Quit: WeeChat 1.6-dev]
pawnbox has joined #crystal-lang
<RX14> this is *really* cool https://github.com/mosop/cli
<RX14> I'd have liked a little less magic, but in terms of functionality it looks awesome
pawnbox has quit [Ping timeout: 268 seconds]
<FromGitter> <bcardiff> Cool, we reach the point of "yet another" :-)
<FromGitter> <tekjar> Hi. I'm thinking about design of my mqtt client library where I need to do `Tcp read`, `Tcp write` and `Ping` concurrently. `Read` should indefinitely run and `Writes` happen when user (through api) want to publish data (which will be alot sometimes).
<FromGitter> <tekjar> That is how I'm doing `read` and `pings` now
<FromGitter> <tekjar> I'm planning write on a different fibre and take user requests through a channel
<FromGitter> <tekjar> Is this tcp read write dance of large data from different fibres (on same socket) safe?
<RX14> as long as your protocol is stateless wrt ping and you keep your writes atomic that should work
<FromGitter> <tekjar> RX14: Can you please explain about atomic writes
<RX14> when you call write_bytes, it's going to write the whole data or error
<RX14> it won't mix up the data
<RX14> if there are 2 write calls at the same time
<RX14> (iirc)
<RX14> but if your protocol can't handle a "ping message" at any time after startup, you might have problems
<RX14> for example if there's two-way negotiation
<FromGitter> <tekjar> The fibre won't context switch and start reading in between?
<RX14> it could start reading
<RX14> the write and read calls themselves can interleave however they want
<FromGitter> <tekjar> Ohhh
<RX14> but write("foo") and write("bar") will always be foobar or barfoo, not fbooar
<RX14> i.e. messages won't get corrupted
<RX14> that's the only guarantee you have
<RX14> if you have difficulty, you could have a central writer fiber, and then a fiber which just queues a ping command
<FromGitter> <tekjar> Ohh thanks. Mqtt doesn't expect pings when there is something available to write. This clears my doubt. Thanks :)
<RX14> yeah you're going to have to do something else than that then
<FromGitter> <tekjar> I'm asking this question because I remember reading about some issue in rust when sharing a socket across multiple threads when TLS is involved. I'll try to find that
<RX14> crystal doesn't technically have multiple threads
<RX14> (not yet)
<FromGitter> <tekjar> But they will right?
<RX14> maybe
<RX14> well
<RX14> no
<RX14> yes
<RX14> they will
<RX14> it'll be a huge change
<RX14> everything will subtly break
<RX14> we'll never release in 2017
<RX14> maybe end of '18
Raimondi has joined #crystal-lang
<FromGitter> <tekjar> So not in 1.0?
<RX14> it'll be in 1.0
<RX14> i'm just saying 1.0 in 2017 is unrealistic given we havent implemented parellism yet
<FromGitter> <tekjar> Ohh.. ok
<FromGitter> <tekjar> Anyway..Here is the issue where rust sslstream was talking about races when trying to share sockets
pawnbox has joined #crystal-lang
<FromGitter> <bcardiff> Just a heads up, ggiraldez and others are working in parellism :-) there is a branch for that. Still WIP. It is the next big feature we aim to.
pawnbox has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> @RX14 why not 2017
<FromGitter> <sdogruyol> @bcardiff yup i'm closely following it :P
<RX14> because parallelism isn't easy
<FromGitter> <sdogruyol> any planned date for that
<FromGitter> <sdogruyol> @RX14 agreed but it's not impossible
<FromGitter> <sdogruyol> just takes time
<RX14> no
<RX14> it's not impossible
<RX14> but once it's feature complete it's still going to take a long time to be production-ready
<RX14> getting it working is only half the problem
<RX14> concurrency code is really hard and it's not going to be possible to run the parallelism code long enough in production to iron remotely enough of the bugs out to release 1.0
<RX14> before the end of 2017
<FromGitter> <sdogruyol> IMHO it doesn't have to be perfect in every way to be in 1.0
<FromGitter> <bcardiff> But it need to be usable :-). We will do our best with the available resources and the community support to reach out goals. We don't have a crystal ball of course.
<RX14> it doesn't have to be perfect for sure, but I would never feel comfortable releasing 1.0 without crystal being used in production at a large scale for a few months
<RX14> and I don't think it's realistic to do that before the end of 2017
<FromGitter> <sdogruyol> @bcardiff yep, usable is good enough
<RX14> usable is pretty objective
<FromGitter> <sdogruyol> @RX14 you may be right but let's not keep our hopes low
<BlaXpirit> it's just funny to me cuz i saw such words in #nim 2 years ago
<RX14> both sides BlaXpirit?
<RX14> nim isn't 1.0 yet is it
<BlaXpirit> it is not
<FromGitter> <sdogruyol> nim was a failure in that way
<BlaXpirit> but meh, it's so convoluted it's beyond fixing
<RX14> nim?
<BlaXpirit> yes
<RX14> i've not followed it
<RX14> what happened to it
<BlaXpirit> nothing really, it's just weird and has few people joining and the same amount leaving
<RX14> hmm
<RX14> well it's quite a fine balance I think on when to release 1.0
<RX14> too late and the language/community runs out of stream
<RX14> and dies
<FromGitter> <sdogruyol> thats what happened with nim yes
<RX14> too early and it's branded as "buggy" and "incomplete", or we have to release 2.0 within the year
<RX14> so objectively, releasing too early is the better option
<RX14> it also depends on how much traction and support you have before 1.0
<RX14> for example rust, it had mozilla resources (not going to die) so could wait until it was 99% ready to release 1.0
<FromGitter> <sdogruyol> @RX14 Rust did release very very early and they do release really fast with 6 weeks cycle
<FromGitter> <sdogruyol> yeah was just gonna say that lol
<dom96> sdogruyol: citation needed :P
<FromGitter> <sdogruyol> @dom96 oh wow it's great to have a nim contibutor here :)
<FromGitter> <crisward> Do what node did, go 8 years, then go from version v0.11 to v4 overnight. That didn't confuse anyone. :smile:
<FromGitter> <sdogruyol> Hahaha
<FromGitter> <sdogruyol> IMHO people doesn't care about the version numbers
<FromGitter> <sdogruyol> If it gets "shit done" they're ok with it. This is proven with PHP and Node already
<FromGitter> <crisward> I think if I want to convince customers we want to build their next product in a language, a v1 would make them feel more confident.
<FromGitter> <sdogruyol> yeah that's if they are really interested
bjz has joined #crystal-lang
<FromGitter> <crisward> Talking of naming, I like to do a crystal module called "Dilithium", just 'cos the geek in me thinks it'd be cool to do it in crystal. I've no idea what it'd do, but it'd be fast...
<FromGitter> <sdogruyol> what's it about
<FromGitter> <sdogruyol> ah lol
<FromGitter> <sdogruyol> thanks :)
<RX14> I love git-run :) https://aww.moe/54y6n4.png
<RX14> makes it super easy to update crystal version + run specs in all of your crystal projects/libraries
<FromGitter> <sdogruyol> git-run?
<RX14> I just run `gr @crystal -- crenv local 0.21.1`
<RX14> then `gr @crystal -- crystal spec`
<FromGitter> <sdogruyol> that's cool
<RX14> yeah, it's a really really useful tool which I found a while ago and I thought i'd share
<RX14> I ended up maintaining the AUR package for it so I follow it's development quite closely
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 256 seconds]
onec has joined #crystal-lang
pawnbox has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 240 seconds]
onionhammer has joined #crystal-lang
soveran has joined #crystal-lang