ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.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
balduin has quit [Ping timeout: 240 seconds]
zipR4ND1 has quit [Ping timeout: 276 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
balduin has joined #crystal-lang
FromGitter has quit [Ping timeout: 240 seconds]
FromGitter has joined #crystal-lang
<crystal-gh> [crystal] icyleaf closed pull request #4217: add YAML::Any method to_json (master...support-yaml-any-to-json) https://git.io/vScKf
<FromGitter> <elorest> I’m trying to figure out how to use Hash map in macros. https://crystal-lang.org/api/0.19.2/Crystal/Macros/HashLiteral.html#map%3AArrayLiteral-instance-method ⏎ ⏎ Here’s an example of what I’m trying to do. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59096b615e61bd94342a14a7]
<FromGitter> <Sija> @elorest see https://play.crystal-lang.org/#/r/1ysc
<FromGitter> <Sija> or https://play.crystal-lang.org/#/r/1ysf with hash
<FromGitter> <elorest> thankyou.
<FromGitter> <Sija> hope it helps
<FromGitter> <elorest> This was pretty much exactly what I was looking for. https://play.crystal-lang.org/#/r/1ysm
<FromGitter> <elorest> Thanks.
<FromGitter> <Sija> cool, yw!
<FromGitter> <Sija> clever trick for setting instance properties btw
<FromGitter> <elorest> Yeah it seems like it will be useful.
<FromGitter> <elorest> Do you know if there’s a way to get the asm output from crystal play like you can in rust?
<FromGitter> <Sija> nope
<FromGitter> <elorest> k
<FromGitter> <elorest> have a good night.
<FromGitter> <elorest> or whatever time it is there lol
<FromGitter> <Sija> it’s 8am but nevertheless its my night time ;)
unshadow has joined #crystal-lang
<unshadow> After allocation memory for IO.read (mem = Slice.new(size)), should I discard it (=nil) or something when I'm done with it ? or would the GC handle it ?
<FromGitter> <Sija> GC will handle it
gewo has quit [Quit: WeeChat 1.5]
gewo has joined #crystal-lang
Frites has joined #crystal-lang
mark_66 has joined #crystal-lang
<FromGitter> <schoening> Aw gee.. now I have to learn asp net. I sure wish company would use crystal. :smile:
txdv has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
<FromGitter> <bew> One dayyy (_I strongly hope_)
<vegai> looked at some macro code in Artanis
<vegai> saw {{
<vegai> ... escaped. Is it so that { needs to be escaped?
<vegai> that seems to make sense, since it's used in macro definition code. But why don't we need to escape }?
<vegai> not sure if it's more clear that the parser figures it out
txdv has joined #crystal-lang
zipR4ND has joined #crystal-lang
Frites has quit [Ping timeout: 240 seconds]
poikon has left #crystal-lang [#crystal-lang]
Ven has joined #crystal-lang
Ven is now known as Guest98555
Raimondi has quit [Write error: Broken pipe]
Raimondi has joined #crystal-lang
Guest98555 has quit [Ping timeout: 240 seconds]
yogg-saron has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest51495
zipR4ND has left #crystal-lang [#crystal-lang]
zipR4ND has joined #crystal-lang
zipR4ND has left #crystal-lang [#crystal-lang]
Guest51495 has quit [Ping timeout: 268 seconds]
zipR4ND has joined #crystal-lang
Ven_ has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> wow....
<vegai> nice!
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 260 seconds]
jhass has quit [Ping timeout: 264 seconds]
asterite has quit [Ping timeout: 264 seconds]
asterite has joined #crystal-lang
jhass has joined #crystal-lang
splitty___ has joined #crystal-lang
splitty__ has quit [Ping timeout: 240 seconds]
txdv has quit [Ping timeout: 276 seconds]
Ven_ has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest31589
txdv has joined #crystal-lang
zipR4ND has quit [Ping timeout: 240 seconds]
Guest31589 has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Client Quit]
Ven_ has joined #crystal-lang
zipR4ND has joined #crystal-lang
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven is now known as Guest80741
Aytan72 has quit []
p0p0pr37 has quit [Remote host closed the connection]
p0p0pr37 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philpax has quit [Ping timeout: 255 seconds]
zipR4ND has left #crystal-lang [#crystal-lang]
zipR4ND has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] Sija opened pull request #4369: Pass Severity instead of String to Logger::Formatter (master...fix-logger-formatter-severity) https://git.io/v90Xy
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
sp4rrow has joined #crystal-lang
Guest80741 has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest37161
<FromGitter> <paulcsmith> Is there a way to rescue compile time errors? Here is a simplified example of something I'm trying to do: https://gist.github.com/paulcsmith/27d260b706f8ba415e0d01e297a2b09c
<FromGitter> <paulcsmith> Is something like this possible?
<FromGitter> <paulcsmith> Oh never mind that actually worked. I had an error in my original code but when I typed the example I fixed it :) haha
<FromGitter> <paulcsmith> Actually that seems to reduce everything. So maybe what I'm trying to do is not supported
<FromGitter> <bew> you could try to resolve the page, to see if the page exist using the `resolve` macro method? https://crystal-lang.org/api/0.22.0/Crystal/Macros/Path.html#resolve:ASTNode-instance-method
<FromGitter> <paulcsmith> Good suggestion. I just tried that and it still raises a compile time error :(
<FromGitter> <paulcsmith> Too bad there isn't a `resolve?`
<FromGitter> <bew> true
Guest37161 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
unshadow has quit [Ping timeout: 276 seconds]
unshadow has joined #crystal-lang
<RX14> I wish you could use :thinking: as well as :confused: in github issue reactions
<oprypin> why cant you?
<RX14> in the reactions, not the bodies
<oprypin> oh ok
<RX14> there's only 6
<FromGitter> <bew> true, reactions are way too limited...
<RX14> i wouldn't say too limited
<FromGitter> <bew> would be cool if projects owners could allow a set of emojis
<FromGitter> <bew> for reactions
<RX14> I always use :confused: when I know what the issue author means but I'm unsure as to the implications: i.e. I need to think more
<oprypin> both of these can be taken in the wrong way
<FromGitter> <bew> let's open an issue on github's github :P
<oprypin> yeah their summary is very good. what i was thinking but couldn't put into words
<FromGitter> <mverzilli> that's funny, when I see the :thinking: emoji I usually interpret is as "confused" with a slightly negative tone
<RX14> Can anyone think of any commonly used abbreviations in crystal?
<RX14> I think crystal tends to not use abbreviations but maybe it's just my memory
<oprypin> you mean in actual code or just communication
<RX14> @mverzilli well that's how I use it so I guess my message is getting through
<FromGitter> <mverzilli> no, I think most of them are cargo-cults from Ruby's stdlib
<FromGitter> <mverzilli> (re:abbreviations)
<RX14> yeah there's quite a lot in String
<oprypin> pretty much
<RX14> but apart from that it's pretty much abbreviation free
<oprypin> WeakRef
<RX14> we much change it!
<oprypin> oh that's probably also from ruby, isnt it
<FromGitter> <bew> there is `elsif` :P
<RX14> yeah I don't like elsif
<RX14> I think `else if` is perfectly parsable
<oprypin> i think you can literally write else if right now but it has a different meaning
<RX14> not... really
<RX14> it needs the special case to remove the double end
<oprypin> uhmmmm what could possibly go wrong
yogg-saron has joined #crystal-lang
<RX14> I really don't use elsif often though
<RX14> I usually use case before i get to elsif
<FromGitter> <bew> in Lua there's `elseif`
<oprypin> in Python there's `elif`
<oprypin> sigh
<RX14> damnit python
<oprypin> still looks nicer than elsif
<FromGitter> <bew> I prefer `elseif` or `elsif` over `elif`, not clear enough for me
<RX14> I prefer else if :)
<FromGitter> <bew> but `else if` imply that after `else` you have an expression (the if)
<FromGitter> <bew> not we make an exception for it..
<oprypin> else if cannot work, it is already present and has a different meaning
<oprypin> exception is dirty
<FromGitter> <bew> true
<RX14> yeah
<RX14> it works in C just fine... but not anywhere else I guess
<oprypin> it does not require an `end`
<FromGitter> <bew> but C allows oneline statements without `{ }`
<RX14> i know why it works
<RX14> and why it doesn't in crystal
<RX14> but that doesn't sytop me from wishing it did
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mark_66 has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> are you blaxpirit @oprypin ?
<oprypin> yes
<FromGitter> <sdogruyol> cool
<RX14> working on fixing the techempower benchmarks
<RX14> i've updated crystal and added a really simple reuse_port thingy
<RX14> @sdogruyol is reuse_port exposed in kemal?
<FromGitter> <fridgerator> @RX14 currently no, `server.listen` is called without any parameters: https://github.com/kemalcr/kemal/blob/master/src/kemal.cr#L64
<RX14> thanks
zipR4ND has quit [Ping timeout: 240 seconds]
<RX14> i should be able to use Kemal.config.server.bind(reuse_port: true) though
<FromGitter> <fridgerator> would be nice, I offered this suggestion before
<FromGitter> <fridgerator> does that work?
balduin has quit [Remote host closed the connection]
<RX14> i havent tried it
<RX14> but it should
<FromGitter> <fridgerator> I didn't think about that
<FromGitter> <fridgerator> i was using `sed` to replace the line before building, lol
<RX14> eyy segfault
<RX14> god damnit
<RX14> @fridgerator the bind line I just tried segfaulted somehow :/
<FromGitter> <fridgerator> hrm
<RX14> which makes little sense
<FromGitter> <sdogruyol> @RX14 how can I help
<RX14> @sdogruyol pass through reuse_port from kemal.run :)
<RX14> but it makes no sense why calling bind would segfault though...
<FromGitter> <sdogruyol> Do we really need that
<unshadow> kemel.run(reuseport: true)
<unshadow> or something
<RX14> @sdogruyol if you want crystal to run on more than 1 core in the techempower benchmarks; yes
<unshadow> Yeha, then a script can just run the process x times where x is the number of cores
<RX14> reuse_port is the best way to implement parallelism right now
<unshadow> and via Linux kernel magic it will load balance the work on the processes
<FromGitter> <sdogruyol> That's correct but how about we wait for parallelism
<RX14> and it may even prove to have better performance after it's in the stdlib
<RX14> since the connections will be distributed in the kernel
<RX14> @sdogruyol why *not* add it? It'll still be around and useful after parallelism
<RX14> oh i see why it segfaults
<unshadow> TechPower is really visable, I had my boss ask me about should we re-write something in crystal even though it shows poor performance and I had to show him different results manually , so this little work can give Crystal quite a big boost
<RX14> @fridgerator that line of code won't work
<FromGitter> <fridgerator> `sed -i -- 's/config.server.listen/config.server.listen(true)/' lib/kemal/src/kemal.cr` ;)
<FromGitter> <sdogruyol> See Kemal run
<FromGitter> <sdogruyol> I'd be happy to have a PR BTW
<RX14> @sdogruyol yes but you should use getter!
<FromGitter> <bew> `property!` ?
<FromGitter> <Sija> maybe it’ll be enough to add `server` to yielded arguments in https://github.com/kemalcr/kemal/blob/master/src/kemal.cr#L63?
<RX14> it is yielded!
<RX14> oh wow I didn't notice that
<FromGitter> <Sija> nah, wrong call, wouldn’t make any difference here since `reuse_port` is available only in `#listen` and `#bind`
<RX14> yes
<RX14> if you have bind you have it
<RX14> you call bind(reuse_port: true) followed by listen
<RX14> listen calls bind automatically
<RX14> but if you call it manually beforehand
<RX14> you can specify args
<FromGitter> <Sija> right, so calling `server.bind(true)` inside of block should suffice?
<RX14> bind(reuse_port: true)*
<RX14> the method defs really should have a *,
<RX14> always use named parameters here
<FromGitter> <Sija> true, otherwise looks cryptic
<RX14> yup
<FromGitter> <Sija> so @sdogruyol, how about changing `yield config` to `yield config, server`? :)
<FromGitter> <sdogruyol> Lol
<FromGitter> <sdogruyol> Feel free to open a PR
<FromGitter> <fridgerator> why not just a `config.reuse_port` option? default to false
<RX14> no need @Sija
<RX14> the config contains the server
<RX14> kemal.run { |cfg| cfg.server.bind(reuse_port: true) }
<RX14> compiles and works
<FromGitter> <Sija> huh, didn’t noticed that
<crystal-gh> [crystal] rockwyc992 opened pull request #4375: Compiler: fixed VirtualMetaclassType#metaclass (master...fix/compiler/VirtualMetaclassType_metaclass) https://git.io/v9EGG
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <Sija> GTG skyrocketing through benchmarks with round 0 modifications, yay!
<RX14> hmm?
<RX14> i'm so confused
<RX14> i can't use psql on the Frameworkbenchmarks machine
olbat has quit [Ping timeout: 258 seconds]
olbat has joined #crystal-lang
Aytan72 has joined #crystal-lang
<RX14> damnit @Sija stop stalking by commits
<FromGitter> <sdogruyol> lol
Ven has joined #crystal-lang
<FromGitter> <Sija> that’s what I do when it’s raining :P
Ven is now known as Guest48770
<RX14> now thats a matrix
<oprypin> O_O
<RX14> oh wow
<RX14> the build has been running for a DAY on one of these PRs
<RX14> that's just incredible
<unshadow> RX14: nice job!
zipR4ND has joined #crystal-lang
<RX14> well
<RX14> my PR isn't going to start for a few days
<RX14> who on earth's idea was this
<FromGitter> <sdogruyol> lol
<RX14> to make their test suite > 24h
<FromGitter> <sdogruyol> :D
<RX14> and travis of course serializes
<FromGitter> <sdogruyol> travis is probably angry
<RX14> so if there's more than 1 PR a day you don't even get STARTED on
<RX14> if you make ANY changes to the toolset directory your build takes >24h
<RX14> if not then it's *only* 2h
<RX14> that is
<RX14> if you update any language version it runs ALL tests
<RX14> ok i'll run them locally
<unshadow> XD
sp4rrow has joined #crystal-lang
<FromGitter> <mverzilli> folks, if you've got a minute this is an important question and we could really use your feedback: https://github.com/crystal-lang/omnibus-crystal/pull/17
<FromGitter> <sdogruyol> sure
bmcginty has quit [Ping timeout: 276 seconds]
<RX14> the omnibus github repo scares me
<RX14> it seems way too complex for what it does
<RX14> @sdogruyol logging false is broken
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <sdogruyol> @RX14 i'm not sure why it's not working
<FromGitter> <sdogruyol> because it's working on travis and my local
<RX14> well i'm in the process of debugging it
<FromGitter> <sdogruyol> thank you chris
<RX14> it might turn out not to be logging false
<RX14> but some other logging
<RX14> @sdogruyol somehow it happens when testing but nowhere else
<FromGitter> <sdogruyol> can you try `Kemal.config.logging = false` instead
<RX14> when in the techempower stuff
unshadow has quit [Quit: leaving]
zipR4ND has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
<FromGitter> <elorest> Is there a way to send a hash to a crystal method without {}. this works in ruby. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=590a47a85f3e76601ee6db27]
<FromGitter> <bew> don't think so, why do you want that?
<FromGitter> <fridgerator> you can send it like `name: "isaac"`, and `**args` the initialize method will be a named tuple
<FromGitter> <elorest> so **args is namedtuple but *args is just tuple?
<FromGitter> <elorest> thanks
<FromGitter> <fridgerator> :+1:
<FromGitter> <elorest> If it takes a named tuple I wouldn’t alternatively be able to pass it a hash? Currect?
<oprypin> elorest, correct. keys can't be dynamic.
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 260 seconds]
Raimondii is now known as Raimondi
<FromGitter> <luislavena> @elorest when using `#[]` on a NamedTuple, the checks are done at compile time if the key is a Symbol, if you assign the symbol to a variable, the check is done at runtime. You can also use `#fetch`
<FromGitter> <luislavena> You can also turn the named tuple into a Hash with `to_h`
<FromGitter> <luislavena> https://play.crystal-lang.org/#/r/1yyt
<RX14> I'm probably going to try to make a library which extends HTTP::Context with a Component system
<RX14> it seems to be a good solution for the HTTP::Context mess
<FromGitter> <luislavena> @RX14 what mess specifically?
<RX14> monkey patching HTTP::Context
<RX14> and getting handlers to play with each other across frameworks
<FromGitter> <luislavena> The only extension I've added to HTTP::Context is to expose a single item of my framework.
<FromGitter> <luislavena> so you access it from a handler like `ctx.beryl.params...` or `ctx.beryl.session`
<RX14> well kemal doesn't do that...
<RX14> monkey-patching it is messay anyway
<FromGitter> <luislavena> maybe because kemal encourages direct access to `ctx`?
<FromGitter> <luislavena> I have that behind a class that does the dereferencing
<RX14> hmm
<RX14> we had a discussion about this before
<RX14> and I remember being concerned but not exactly why
<FromGitter> <luislavena> maybe, I think.
<FromGitter> <luislavena> That is how I use it, if direct usage from the middleware stack, need to do `ctx.beryl.something`, from by class, have access to it.
[spoiler] has quit [Ping timeout: 240 seconds]
kellabyte_ has joined #crystal-lang
dannyAAM_ has joined #crystal-lang
[spoiler] has joined #crystal-lang
Lex[m]1 has joined #crystal-lang
maxpowa_ has joined #crystal-lang
maxpowa has quit [Ping timeout: 240 seconds]
kellabyte has quit [Ping timeout: 240 seconds]
Lex[m] has quit [Ping timeout: 240 seconds]
dannyAAM has quit [Ping timeout: 240 seconds]
maxpowa_ is now known as maxpowa
kellabyte_ is now known as kellabyte
Aytan72 has quit [Remote host closed the connection]
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 260 seconds]
<RX14> aha, got the kemal bug
<FromGitter> <Sija> what was it?
<RX14> using a before_all ahndler
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Aytan72 has joined #crystal-lang
Guest48770 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has joined #crystal-lang