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> <drosehn> I'd go with `@thing = nil`, and set it to the "real thing" in later processing.
<FromGitter> <jwoertink> Cool. That's what I did and it's working. I just have to call `@thing.not_nil!.do_stuff`
<FromGitter> <jwoertink> `alias Whatever = String | Int32 | Nil`
<FromGitter> <jwoertink> alias `Meh = String | Symbol`
<FromGitter> <jwoertink> `options = {} of Meh => Whatever`
snsei has joined #crystal-lang
danielpclark has quit [Ping timeout: 258 seconds]
danielpclark has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
snsei has quit [Remote host closed the connection]
<FromGitter> <domgetter> I see sometimes macros have a preceding \. Like this \{{ run(...) }}
<FromGitter> <jwoertink> I think that's for formatting purposes
<FromGitter> <domgetter> There's nothing about it in the main docs. Are there any resources to more information about it? The only thing I know is that it makes the compiler not complain about nested macros
snsei has joined #crystal-lang
<FromGitter> <jwoertink> I haven't seen any docs on it
<FromGitter> <domgetter> Here's an example of its use in the source code of ECR: https://github.com/crystal-lang/crystal/blob/204bfd0555921f3aadbda289993cca5323ebaf95/src/ecr/macros.cr#L82
<FromGitter> <jwoertink> Yeah, I sort of remember it being something to do with formatting
<FromGitter> <jwoertink> like maybe how the code if formatted when it's generated? Maybe keeping indents or something? I haven't used them before, so I'm not 100% sure
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
fenicks has left #crystal-lang [#crystal-lang]
IRCFrEAK has joined #crystal-lang
IRCFrEAK has left #crystal-lang [#crystal-lang]
snsei has joined #crystal-lang
txdv has joined #crystal-lang
zaiste has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
olek_poz has joined #crystal-lang
Qchmqs has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
leonardschuetz has joined #crystal-lang
<leonardschuetz> Hey, is there a method to easily indent Strings?
leonardschuetz is now known as KCreate
<KCreate> (changed my nick from leonardschuetz to KCreate)
<KCreate> I've always created a little helper method like [this](https://github.com/charly-lang/charly/blob/master/src/charly/helper.cr) and thought it would be a nice addition to the stdlib...
mjblack has quit [Ping timeout: 264 seconds]
mjblack has joined #crystal-lang
gloscombe has joined #crystal-lang
splitty_ has quit [Ping timeout: 260 seconds]
KCreate has quit [Read error: Connection reset by peer]
KCreate has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
KCreate has quit [Ping timeout: 268 seconds]
gloscombe has quit [Ping timeout: 256 seconds]
gloscombe has joined #crystal-lang
gloscombe has quit [Ping timeout: 240 seconds]
gloscombe has joined #crystal-lang
KCreate has joined #crystal-lang
KCreate has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
mark_66 has quit [Ping timeout: 260 seconds]
<FromGitter> <Sija> @domgetter `\{{ … }}` notation is used to defer macro definitions
KCreate has joined #crystal-lang
KCreate has quit [Client Quit]
gloscombe has quit [Ping timeout: 260 seconds]
gloscombe has joined #crystal-lang
gloscombe has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
mark_66 has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
bjz has joined #crystal-lang
python247 has joined #crystal-lang
<python247> hey guys
<python247> making a comparsion table, need to confirm/deny language features https://docs.google.com/spreadsheets/d/18-Yy2UDLK6krKPq8Lx8ezKOgdSKd4E5pYpVT_MF3uMk/edit?usp=sharing
<FromGitter> <Sija> @python247: updated
<FromGitter> <Sija> I’m not sure about *Coroutines/Continuations* tho'
<python247> would be nice to simplify the terms/features and/or expand it tho
<FromGitter> <KCreate> aren't modules and interfaces the same in crystal?
<FromGitter> <KCreate> you can extend a module and define abstract methods inside modules
rolha has joined #crystal-lang
rolha has left #crystal-lang [#crystal-lang]
mjblack has quit [Ping timeout: 260 seconds]
mjblack has joined #crystal-lang
<RX14> python247, what exactly do you mean by "continuations"
<RX14> also i don't think crystal really has generators per se
<FromGitter> <sdogruyol> how about yield?
<RX14> i guess it does count as a generator in a roundabout way
snsei has joined #crystal-lang
<RX14> @asterite can you clarify "Right now a module that is used as an interface can also declare/use instance variables, but that will probably change in the future."
<RX14> how are you considering changing modules?
<python247> there's a source at the bottom
snsei has quit [Ping timeout: 246 seconds]
<RX14> wow, continuations looks horrifying in usual code
<RX14> i assume they're used in the low-level to build higher-level features in python and ruby
<RX14> but crystal builds fibers without them so I think adding continuations would be a terrible diea
gloscombe has joined #crystal-lang
bjz_ has joined #crystal-lang
<FromGitter> <sdogruyol> IDD
bjz has quit [Ping timeout: 240 seconds]
python247 has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
fryguy9 has joined #crystal-lang
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 260 seconds]
<FromGitter> <asterite> @RX14 For example IO has @encoding but you can use it as an "interface" too (like, I can declare an instance variable of type IO). We will probably make it so that if you want to use a module for the type of something, it can't use instance variables (including types can). The reason is compile time and runtime efficiency, mainly for the dispatch (it's hard to explain here why)
<FromGitter> <asterite> So we'll probably make IO be a class (right now all including types are classes, so not a big deal)
<RX14> currenmtly modules as type restrictions expand to unions of implementations, correct?
<RX14> and you want to optimise that?
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vS48u
<crystal-gh> crystal/master fc35eea Leonard Schuetz: Fix #4223: Fixed undefined method Math.gamma (#4229)
<FromGitter> <asterite> For example, say you have a class Base with a method "foo", and subclasses. To generate code for "foo" for Base and any subclass, considering that no subclass overrides it, you can generate a single method for all of them. This is because if "foo" uses an instance variable "@x", it will always be in the same offset for all types in that hierarchy
<RX14> I feel like being able to use modules like they are currently is really great, couldn't you just apply additional optimizations to modules with no instance variables, and allow things to continue to exist?
<FromGitter> <asterite> For a module this can't be done because the instance variable might be located in different offsets, and that generates lots of duplicated code
<FromGitter> <asterite> You can try to see the LLVM generates for "puts" with IO being a module and IO being a class
<RX14> I see the problem, but I'd prefer that it was an optimization instead of a restriction
<FromGitter> <asterite> All methods gets codegened for each of the IOs, even though they are basically the same
<FromGitter> <asterite> But someone reopens your module and adds an instance variable, and suddenly compile times and the binary size increases...
<FromGitter> <asterite> Plus, interfaces should be used as interfaces
<FromGitter> <asterite> In any case, this is not final, we are still discussing it :-)
<RX14> but they're not interfaces, they're modules :)
<RX14> if you want interfaces, then either you can reuse modules to get the effect, or create a new interface construct
<RX14> I prefer the former, but I dislike adding restrictions
<FromGitter> <asterite> what's the problem with that?
<RX14> it already inherits a class
<RX14> turning IO into a class too would require multiple inheritance
<RX14> also, I think there are performance traps in every language. And trading off expressability (especially as it's used so pervasively) with performance would require a lot of discussion
<FromGitter> <asterite> but it's OK to inherit that, there's no multiple inheritance in that example
<RX14> oh yeah sorry
<RX14> my bad
<RX14> thats the first thing I thought of
<FromGitter> <asterite> it's ok :-)
<RX14> i'll probably work on CI today btw :)
<FromGitter> <asterite> We'd have to find some cases where using modules as interfaces, that require instance variables in their definition, pose a problem
<RX14> hope it goes well
<FromGitter> <asterite> Great! :-)
<RX14> currently I don't think there's much differentiation between inheritance and modules
<RX14> it seems as if you can express almost everything you can do with inheritance with modules
<RX14> and allow "multiple inheritance" at the same time
<RX14> but the performance and binary size does change between inheritance and modules as you explained
fryguy9 has quit [Quit: Leaving.]
fryguy9 has joined #crystal-lang
fryguy9 has quit [Client Quit]
bjz_ has joined #crystal-lang
<crystal-gh> [crystal] bcardiff closed pull request #4208: Allow Iterator.stop to be used inside Iterator.of block (master...fix/iterator-of-stop) https://git.io/vS3JB
<FromGitter> <asterite> That's probably the only reason why class inheritance is in the language. Many have said that with just modules and inclusion you can do what you can do now
bjz has quit [Ping timeout: 240 seconds]
olek_poz has quit [Ping timeout: 260 seconds]
qchmqs_ has joined #crystal-lang
<travis-ci> crystal-lang/crystal#fc35eea (master - Fix #4223: Fixed undefined method Math.gamma (#4229)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/218084783
<DeBot> https://github.com/crystal-lang/crystal/issues/4223 (Missing gamma method in LibM) | https://github.com/crystal-lang/crystal/pull/4229 (Fixed undefined method Math.gamma)
snsei has quit [Remote host closed the connection]
Qchmqs has quit [Ping timeout: 240 seconds]
qchmqs_ has quit [Quit: Konversation terminated!]
Qchmqs has joined #crystal-lang
<FromGitter> <crisward> Is there any way to check if a http request is https ?
<RX14> in HTTP::Server?
<FromGitter> <crisward> Sorry, yes in HTTP::Server
<FromGitter> <crisward> Or more specifically, when behind an nginx proxy doing the ssl
<RX14> well, if you're terminating SSL in crystal, you'll know since you set up the server
<RX14> and you can have http and http[s on on HTTP::Server instance afaik
<RX14> if you're terminating with NGINX you're going to have to set a HTTP header
<RX14> or at least I think
<FromGitter> <crisward> Express.js has a `proto` property on the request object, even if it's being proxied. Not sure how they do that. Will have a mess and see what it there.
<RX14> maybe it's from X-Forwarded-For
<RX14> "When the trust proxy setting does not evaluate to false, this property will use the value of the X-Forwarded-Proto header field if present. This header can be set by the client or by the proxy."
<RX14> yup
<RX14> that RFC should do for implementing your own XFF parser
<RX14> actually thats a different header...
<RX14> hmm
<FromGitter> <crisward> I've got this header set in nginx - `proxy_set_header X-Forwarded-Proto $scheme;`
<RX14> yeah thats how...
<RX14> I'd love for that RFC to get a load more traction though
<RX14> it looks super useful
<FromGitter> <crisward> I already use this in crystal, which seems to work for getting proxied ip - `ipaddress = ctx.request.headers["X-Forwarded-For"]?`
<RX14> X-Forwarded-For is comma sepoerated though...
<RX14> it's a list of proxies the request has passed through
<RX14> so that parsing is incorrect
<RX14> it goes client, proxy1, proxy2
<RX14> so you'll want to extract the first field if seperated by commas
<FromGitter> <crisward> I think that only happens with multiple proxies. Also I'm using it as a key in a local hash to store the last five spammers in a form spam flagging system, so it doesn't matter too much.
<crystal-gh> [crystal] bcardiff closed pull request #4191: Adds non-allocating random_bytes method to SecureRandom. Fixes #4049 (master...master) https://git.io/vSktR
<FromGitter> <crisward> But thanks, I'll make a note
<RX14> yeah, it's probably ok to not care for that
<RX14> but it's techynically incorrect
<RX14> and expecting the string there to be a literal IP would break things
<FromGitter> <crisward> If I remember correctly they can be ip6 too or a weird mix. Sort of thing that'd be useful for crystal HTTP to sanitise.
<RX14> yeah we need more methods
fryguy9 has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yopp- is now known as yopp
<travis-ci> crystal-lang/crystal#0fbe4c8 (master - Allow Iterator.stop to be used inside Iterator.of block (#4208)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/218093330
<DeBot> https://github.com/crystal-lang/crystal/pull/4208 (Allow Iterator.stop to be used inside Iterator.of block)
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mark_66 has quit [Remote host closed the connection]
leonardschuetz has joined #crystal-lang
leonardschuetz is now known as KCreate
bmcginty has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
olek_poz has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
Qchmqs has quit [Ping timeout: 260 seconds]
<travis-ci> crystal-lang/crystal#3b196f5 (master - Adds non-allocating random_bytes method to SecureRandom. Fixes #4049 (#4191)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/218102376
<DeBot> https://github.com/crystal-lang/crystal/issues/4049 (Add non-allocating method to SecureRandom) | https://github.com/crystal-lang/crystal/pull/4191 (Adds non-allocating random_bytes method to SecureRandom. Fixes #4049)
zaiste has quit [Quit: Textual IRC Client: www.textualapp.com]
sz0 has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
dannyAAM has joined #crystal-lang
<FromGitter> <crisward> Anyone using docker for mac to run crystal ?
<crystal-gh> [crystal] ysbaddaden pushed 3 new commits to master: https://git.io/vS4dv
<crystal-gh> crystal/master 854cdce Julien Portalier: Merge pull request #4230 from ysbaddaden/std-fix-openssl-110...
<crystal-gh> crystal/master 58b8481 Julien Portalier: Fix: OpenSSL 1.1.0 removed support for DSS
<crystal-gh> crystal/master b67a118 Julien Portalier: Fix: OpenSSL 1.1.0 renamed some symbols...
<travis-ci> crystal-lang/crystal#3b196f5 (master - Adds non-allocating random_bytes method to SecureRandom. Fixes #4049 (#4191)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/218102376
<DeBot> https://github.com/crystal-lang/crystal/issues/4049 (Add non-allocating method to SecureRandom) | https://github.com/crystal-lang/crystal/pull/4191 (Adds non-allocating random_bytes method to SecureRandom. Fixes #4049)
<FromGitter> <mjago> @crisward I did for a couple of weeks end of last year. Initial try out. Worked fine
<FromGitter> <crisward> @mjago did you use HTTP?
<FromGitter> <mjago> not on docker
<FromGitter> <crisward> Think there is an issues related to https://github.com/crystal-lang/crystal/issues/2660
<FromGitter> <crisward> Was wondering if anyone had a workaround.
<FromGitter> <fridgerator> i'm using docker quickstart terminal, I haven't had any issues
<FromGitter> <crisward> Do you mean docker-toolbox? If so, I think that creates a full vm. Docker for mac creates a tiny alpine thing. I'll try with a simple kemal app as it may be specific to my app.
<FromGitter> <fridgerator> right, it uses virtualbox
<FromGitter> <fridgerator> I think I remember seeing issues about alpine support
<RX14> alpine support is for if the container is alpine
<RX14> there can be issues with DNS resolving, but that would show up clearly as failing to connect to the DB container by hostname
<RX14> and there's workarounds anyway...
fryguy9 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#854cdce (master - Merge pull request #4230 from ysbaddaden/std-fix-openssl-110): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/218144314
blufor has joined #crystal-lang
<FromGitter> <drosehn> Hmm, this is "interesting". The new crystal home page seems to flake-out on Opera, but in a very weird way. The images in the page seem to be confused with images from an earlier page that I had viewed. I've seen this behavior before, this is the first time where it was clear what the browser is doing.
<FromGitter> <drosehn> but if I do a screen-snapshot of it (on macOS), the images are all perfectly correct for the crystal page.
<Papierkorb> does it happen in Chrome too?
<Papierkorb> sounds like a browser bug
<RX14> yeah sounds like a GPU intraction bug
<FromGitter> <fridgerator> in Opera the images appear wrong, but a screenshot of the browser window shows correct images?
<FromGitter> <drosehn> Yep. I've seen this behavior in Chrome too, although I haven't tried crystal's new page yet.
<FromGitter> <drosehn> Right now I'm trying to see if there's something I could do to get it to *stop* screwing up in Opera.
<Papierkorb> drawing bug, GPU drivers usually don't NULL texture memory before giving it out again, which can cause stuff from elsewhere to appear
<FromGitter> <drosehn> Additional info: if I do a full-screen screenshot, then I get the corrupted nonsense. But if I do a selected-area screenshot, then it gets the images which Crystal's page actually wants to show.
<FromGitter> <drosehn> and indeed, the same kind of weirdness happens with the crystal home page when viewed in Google Chrome.
A124 has quit [Read error: No route to host]
<Papierkorb> Known issue to browsers, though program writers and graphics driver writers aren't on the same page who has to fix the general problem. Either way, if that happens it means Chrome doesn't feel like drawing those parts, so to me it's a Chrome bug
<FromGitter> <crisward> @RX14 what is the workaround for the db resolve issue ?
gloscombe has quit [Remote host closed the connection]
Kug3lis has joined #crystal-lang
A124 has joined #crystal-lang
<FromGitter> <fridgerator> @drosehn does it happen on all image types? I see a png on that page, as well as svg. Happening to both?
Raimondi has quit [Write error: Broken pipe]
Raimondi has joined #crystal-lang
<FromGitter> <drosehn> I've got some good screenshots now, and it happens in Google Chrome, so I'm just going to file a bug with the Google Chrome folks. And I'm including a screen shot of how nice it looks in Safari. Presumably they'll get the hint.
<RX14> @crisward shell out to a commandline DNS resolver
<RX14> i can tell you a really good DNS resolver thats installed everywhere
<RX14> host = `getent hosts #{hostname} | awk '{ printf $1 }'`
<RX14> getent and awk are everywhere so you dont have to install anything special
<FromGitter> <drosehn> I think crystal can handle the parsing of the output!
<FromGitter> <drosehn> (no need for `awk`...)
<RX14> sure
<RX14> but it would be a little more effort
<FromGitter> <drosehn> Also, it looks like `getent` is not on macOS.
<FromGitter> <fridgerator> I have `getent`, i'm using zsh, if that matters
<Papierkorb> what's wrong with the built in dns resolver?
<Papierkorb> ah, found the issue
<FromGitter> <fridgerator> looks like its not installed by default though
<FromGitter> <drosehn> zsh wouldn't matter. (or at least, `getent` does not appear if I switch to zsh). Which version of macOS? I'm a bit behind, but I don't have it on my Yosemite or Snow Leopard systems. Neither the command nor the man-page for it.
<Papierkorb> can you use getaddrinfo() from libc?
<Papierkorb> that's what I'd resort to
<RX14> it's kind of a pain to wrap I think
<RX14> the GAI wrapper in the stdlib seems quite complex re: multiple results anwyay
<FromGitter> <drosehn> FWIW, I go with `host` if I need dns, which is on macOS and the RHEL linux machines that I use. On the hosts which don't have that, I go with the ancient `nslookup`. Although to be honest I try to avoid running DNS-needing scripts on machines which don't have `host`.
<FromGitter> <crisward> @RX14 thanks.
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
<FromGitter> <fridgerator> @drosehn i'm on Sierra, but `which getent` doens't return a location, it returns a function
<FromGitter> <fridgerator> so I'm thinking I have it because of some other package
fryguy9 has quit [Quit: Leaving.]
<FromGitter> <fridgerator> I saw on stack overflow getent isn't on OSX because OSX uses DirectoryService to do hostname resolution
fryguy9 has joined #crystal-lang
KCreate has quit [Quit: leaving]
bjz has joined #crystal-lang
ruby has joined #crystal-lang
<FromGitter> <domgetter> How big is the stack in crystal?
<RX14> 8MiB
<Papierkorb> fibers have 8MiB
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <domgetter> cool, thank you
<FromGitter> <elorest> I remember seeing a tweet a month back or so about successfully running kemalcr in multiple threads. Are there any updates on that?
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fryguy9 has quit [Quit: Leaving.]
olek_poz has quit [Ping timeout: 240 seconds]
ruby has quit []
sz0 has quit [Quit: Connection closed for inactivity]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZU has joined #crystal-lang