ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
<crystal-gh> [crystal] paulcsmith opened pull request #6146: Helpful error when constant not found (master...ps-6122-undefined-constant-error) https://git.io/vhZL1
<FromGitter> <sam0x17> is it possible to run a shell command at compile time?
<FromGitter> <sam0x17> want to zip up a directory for use with the baked_file_system shard
<FromGitter> <sam0x17> automatically
<FromGitter> <S-YOU> example: `` ` git_version = {{`(git describe --tags --long --always 2>/dev/null) || true`.stringify.chomp}}```
<FromGitter> <sam0x17> haha thanks ended up with almost exactly that construction just now from experimenting
<FromGitter> <sam0x17> I ended up just doing a .includes?("_") in my case since I don't care about the result
<FromGitter> <sam0x17> but needed valid crystal code
<FromGitter> <S-YOU> Not sure this is the use case, but there is `{% begin %}` and `{% end %}`, just to exec macros.
<FromGitter> <sam0x17> ah, that might be better
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
<FromGitter> <codenoid> where i can meet all of him ? https://pbs.twimg.com/media/C_pC7H2UQAAHNM9.jpg
ua has quit [Ping timeout: 264 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <Grabli66> Hi! How to call self constructor inside a constructor? https://play.crystal-lang.org/#/r/46ij
<FromGitter> <S-YOU> `new(0, name)`
<FromGitter> <Grabli66> this 'initialize' doesn't explicitly initialize instance variable '@id' of One :(
<FromGitter> <S-YOU> then set @id = 0, on that initialize
<FromGitter> <Grabli66> But it's initialized in base constructor, why crystal does not see that? :)
<FromGitter> <Grabli66> @bew it works. But it looks strange :)
Philpax has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
csk157 has joined #crystal-lang
pbodev1 has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 260 seconds]
p0p0pr37_ is now known as p0p0pr37
Nathanaelle has quit [Ping timeout: 256 seconds]
Nathanaelle has joined #crystal-lang
<FromGitter> <j8r> Of course @r00ster91 I mean how having the terminal width/length in Crystal
alex`` has quit [Ping timeout: 276 seconds]
DTZUZO has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
<crystal-gh> [crystal] bcardiff opened pull request #6147: Allow HTTP::Client to use ipv6 addresses (master...fix/uri-ipv6) https://git.io/vhZ0l
alex`` has quit [Ping timeout: 248 seconds]
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 256 seconds]
p0p0pr37_ is now known as p0p0pr37
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 260 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <bendietze_twitter> Hi there, i am wondering: kemal allows to disable logging just with two words "logging false" somewhere in Crystal code. What happens here? This aren't official keywords? These aren't vars? No assignment? Why is the compiler capable to understand this? Where can i read more about this (not kemal, Crystal and compiler)
<FromGitter> <j8r> `logging` should be a top level method, and `false` an Boolean argument
<FromGitter> <bendietze_twitter> Hehe, yes, you are right for sure :-) oh, it could be so easy
<FromGitter> <bendietze_twitter> In Crystal are many percent-symbols, like %i, %q, %Q, ... and aliases like p for puts - are there tables or lists of them for better overview? I don't know where to find them all :-)
<FromGitter> <yxhuvud> p is not an alias for puts
<FromGitter> <bendietze_twitter> But I saw it and it works?
<FromGitter> <bendietze_twitter> I tried it yesterday
<FromGitter> <yxhuvud> Both prints stuff, but not the same stuff. p is meant for debug printing and is basically doing p something.inspect
<FromGitter> <yxhuvud> *puts something.inspect
<FromGitter> <bendietze_twitter> Ah, ok, also I have to look more at debugging to find such aliases I don't know? :-)
<FromGitter> <bendietze_twitter> Thank you all
<FromGitter> <bendietze_twitter> I asked this question about logging false on stackoverflow too, tagged with crystal-lang and kemal. An reviewer removed the crystal-lang tag and added a text tag. I wrote, this must be wrong, it must be a feature of Crystal, not of kemal and not of text - this happens everytime I ask there - someone changes my tags to the wrong... Don't understand stackoverflow... Thinking, they are tuning for tiobe
<FromGitter> ... and co. But, ok, the tag crystal-lang was right, for sure?
<FromGitter> <vladfaust> @codenoid I know guy in the center, he's Kemal author, but who're on the sides?
<FromGitter> <j8r> Quite sure it's Brian and Ary
<FromGitter> <vladfaust> Oh nice
<FromGitter> <hmans> What's going on, Crystal friends?
Ven`` has joined #crystal-lang
<faustinoaq> @hmans Doing PHP this week at work :( Enjoying crystal in my spare time :)
<FromGitter> <bendietze_twitter> Sounds hard :)
Ven` has joined #crystal-lang
Ven` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
ua has joined #crystal-lang
Ven`` has quit [Ping timeout: 256 seconds]
<FromGitter> <faustinoaq> Oh, .NET Core 2.1 is really fast https://blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/ 😅 🚀
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
Ven` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <manveru> 29 imports tho :P
<FromGitter> <manveru> still impressive, i should try F# some day
<FromGitter> <bendietze_twitter> Woow... Could become faster than Java
alex`` has joined #crystal-lang
<FromGitter> <Grabli66> How you dare to post such info, crystal is the fastest one. :)
TCZ has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<faustinoaq> @Grabli66 I use .NET at work/college XD
<faustinoaq> I hope to use crystal someday, though :)
duane has quit [Ping timeout: 256 seconds]
<faustinoaq> C# is nice but sometimes too much verbose XD
<FromGitter> <Grabli66> And i use .net at work. And use crystal in pet projects. Hate .net :)
TCZ has quit [Quit: Leaving]
alex`` has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
alex`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
<FromGitter> <bendietze_twitter> @faustinoaq I hope to use crystal someday ... LOL 😄
<FromGitter> <bendietze_twitter> @Grabli66 😄
<FromGitter> <bendietze_twitter> I spent some time with C# and .net, it is nice, but - not mine
<faustinoaq> "Fix for our CPU affinity logic, thanks to the TechEmpower benchmarks I found out that when creating many workers process they were all being assigned to a single CPU core" https://dantti.wordpress.com/2018/05/29/cutelyst-2-4-0-released/
<faustinoaq> Interesting ^^
<wuehlmaus> i am exploring Go after a long time not looking at it. Crystal is sooo much shorter, but what really impresses me is the sheer speed of compilation of go.
Philpax has quit [Ping timeout: 276 seconds]
<faustinoaq> Maybe we should check if `reuse_port` is working as expected on all CPU cores
duane has joined #crystal-lang
<faustinoaq> ^^ Using https://lamada.eu/dstat-graph/#
<faustinoaq> Looks like crystal CPU usage is a bit strange
Philpax has joined #crystal-lang
<faustinoaq> Oh, I just tried https://doc.rust-lang.org/1.5.0/book/rust-inside-other-languages.html#the-problem and looks like crystal version only took 0.007s in my machine
<faustinoaq> So, even crystal is single core, is faster than Ruby+Rust multicore :D
csk157 has quit [Quit: WeeChat 2.1]
<FromGitter> <bew> Probably because of the ruby interpreter machine that needs to start and all
<FromGitter> <bew> Try rust only? :P
<FromGitter> <bendietze_twitter> Yeah, interesting - what's about Rust vs Crystal in this case? However, where is Crystal storing, stack or heap?
<FromGitter> <yxhuvud> crystal can store in both
<FromGitter> <bew> It depends on what you're storing
<FromGitter> <S-YOU> I got upto 50% performance gain with Crystal + h2o on my machine, ... for Hello, World!
<FromGitter> <bendietze_twitter> Yeah, sorry, just clicked wrong, Crystal stores BitInt as standard on heap, right? How do I choose between stack or heap, for example, with Int64?
<FromGitter> <S-YOU> a = 1_i64 for stack? or Malloc(Int64).new(1)?
<FromGitter> <bendietze_twitter> Ah, ok, thanks
<FromGitter> <codenoid> lol, i can't check is bson "array" have value ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b100e1de26c847ac8a77c98]
<FromGitter> <codenoid> .size
<FromGitter> <S-YOU> you might need to cast to something specific first. like .to_s.size
Ven`` has quit [Read error: Connection reset by peer]
<FromGitter> <yxhuvud> That is a horrible type if I ever saw one
<FromGitter> <codenoid> ``` makarov = JSON.parse v["carouselmedia"].to_s ⏎ puts makarov.size``` [https://gitter.im/crystal-lang/crystal?at=5b100f5bc712f56125498227]
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
Ven`` has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 256 seconds]
p0p0pr37_ is now known as p0p0pr37
DTZUZO has joined #crystal-lang
<FromGitter> <codenoid> 😟
Guest98178 is now known as robacarp
robacarp is now known as Guest89592
<FromGitter> <HCLarsen> Anyone ever use the Hash.new function with a block? There's no documentation on how to use it.
Guest89592 has quit [Quit: Guest89592]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
johndescs has quit [Ping timeout: 240 seconds]
johndescs has joined #crystal-lang
<FromGitter> <bendietze_twitter> And the source doesn't help?
<FromGitter> <HCLarsen> Reading the source is the last resort. Asking a question comes before that.
<RX14> reading the source takes little time
<RX14> asking a question takes ages
<RX14> I can't remember how Hash.new with a block works
<RX14> i'd read the source lol
<FromGitter> <HCLarsen> You might want to learn how to tell time then, because it took me less than a minute to type that question.
<RX14> and it took you over 5 minutes to get an answer
<RX14> looking at the source only takes a minute or two
<RX14> but yeha its just a block that returns a default value if the key doesn't exist
<RX14> it takes the hash and the key as arguments
<RX14> and so you can insert to the hash inside the block if you want
<FromGitter> <j8r> Reading the specs easier and more instructive than the implementation
<RX14> depends
<FromGitter> <j8r> *on how to use the method
<FromGitter> <j8r> At least, for me, I'm more productive on directly reading examples for how-to
<RX14> for learning how hashes work, yeah i'd look for examples
<RX14> if I was learning this specific detail about hashes but I already knew how they work i'd go for impl
<RX14> it all depends on the person anyway
<FromGitter> <j8r> Nevertheless to get lost in the Crystal code is really instructive :-)
<FromGitter> <j8r> Sometimes I see amazing piece of codes, hiding somewhere
<FromGitter> <HCLarsen> But where do the key and value come from? Using a block is easy enough, but I don't see any indication of where these values come from.
<RX14> when someone uses fetch on the hash and the key isn't there
<RX14> fetch or []
<RX14> [] calls fetch
<RX14> so you use hash["foo"] and you'd normally get an exception
<FromGitter> <HCLarsen> I meant for the block in the Hash#new method.
<RX14> but with the block arg, the block is called instead
<RX14> yes
<RX14> that block
<RX14> the block in the .new isn't called inside .new at all
<RX14> it's just stored for fetch to use
<FromGitter> <bendietze_twitter> Sorry, don't want to reduce you to read the source, but asking what would you do could take longer than asking, if
<FromGitter> <HCLarsen> Ok then.
<RX14> >> h = Hash.new { |hash, k| p hash, k }; h["foo"]; nil
<DeBot> RX14: ^ - https://carc.in/#/r/46p2
<RX14> oops
<FromGitter> <HCLarsen> Not really Ben. I asked the question, went on to other things, only checked back every few minutes when there was a reply. Overall, not much time spent at all.
<RX14> I find switching tasks like that draining
<RX14> so i'll always try and work it out
<RX14> because "switching tasks for 5 mins until the question is answered" would ruin my hour
<FromGitter> <HCLarsen> Besides, being human, I like talking to other humans. It's a funny little quirk.
<RX14> >> h = Hash(String, Nil).new { |hash, k| p hash, k }; h["foo"]; nil
<DeBot> RX14: {} - more at https://carc.in/#/r/46p3
<FromGitter> <bendietze_twitter> Ok Chris, we are going to discuss where we don't want to discuss. I am very new to Crystal and cannot help you a lot, but my first thought was to look at hash.cr and i thought it was easy to read. So I expected, you would answer: I looked the source but i cannot construct the following thing: ... I am here to ask questions too and I was only switching between your chat and the source to look if i can
<FromGitter> ... construct the following in my thoughts to learn it myself 😄 but, when I am blurring this textfeld here, it sends my half written text and so I stopped writing complete 😄
<FromGitter> <bendietze_twitter> And please understand: my english is bad 😄
<FromGitter> <HCLarsen> It's all good Ben, English isn't the easiest language in the world to understand. Blame the Welsh.
snsei has quit [Remote host closed the connection]
snsei_ has joined #crystal-lang
<faustinoaq> @HCLarsen You make me remember this: https://github.com/crystal-lang/crystal/issues/2394 XD
<FromGitter> <faustinoaq> > I got upto 50% performance gain with Crystal + h2o on my machine, ... for Hello, World! ⏎ ⏎ @S-YOU Amazing!!! ✨
snsei_ has quit []
snsei has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <Grabli66> Is it faster than java, now? :)
<FromGitter> <bendietze_twitter> @Grabli66 Crystal isn't a competitor to Java ;-)
<FromGitter> <bendietze_twitter> Like .net ;-)
<FromGitter> <vlazar> Are there h2o bindings for Crystal already?
Nathanaelle has quit [Read error: Connection reset by peer]
<FromGitter> <bendietze_twitter> 😄 please never Esperanto 😄
Nathanaelle has joined #crystal-lang
<FromGitter> <j8r> Toki pona is better https://en.m.wikipedia.org/wiki/Toki_Pona
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
<oprypin> no
<FromGitter> <vlazar> @S-YOU how are you using h2o with Crystal and what benchmark you run, something similar to plain text hello world from techempower benchmarks?
<FromGitter> <bendietze_twitter> 😄
FromGitter has quit [Ping timeout: 255 seconds]
FromGitter has joined #crystal-lang
<faustinoaq> @Grabli66 h2o is the fastest thing by far :) https://www.techempower.com/benchmarks/previews/round16/
<FromGitter> <Grabli66> I know
<faustinoaq> Interesting h2o does some tricks here ^^
<faustinoaq> To be even faster cloud vs metal
<faustinoaq> ^^ lol. An "easy" chat example
<faustinoaq> ^^ Looks good IMO ;)
<faustinoaq> ^^ Would be nice something similar on crystal ;-)
alex`` has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
<FromGitter> <hmans> Any plans on adopting .then/.yield_self in Crystal? https://bugs.ruby-lang.org/issues/14594
alex`` has quit [Ping timeout: 244 seconds]
alex`` has joined #crystal-lang
<FromGitter> <vlazar> @faustinoaq looks like mruby in h2o should only be used for simple stuff https://h2o.examp1e.net/configure/mruby.html ⏎ ⏎ > With H2O, users can implement their own request handling logic using mruby, either to generate responses or to fix-up the request / response. ⏎ > The interface between the mruby program and the H2O server is based on Rack interface specification. ⏎ > It should be noted that as of
<FromGitter> ... H2O version 1.7.0, there are limitations when compared to ordinary web application server with support for Rack such as Unicorn: ... [https://gitter.im/crystal-lang/crystal?at=5b104db8ba1a351a68dce36c]
<FromGitter> <Flaque> Hey possibly dumb question: Is it possible to make a macro that cuts off content? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b104e4a99fa7f4c0634fdfb]
<FromGitter> <vlazar> libh2o OTOH is more interesting, Crystal bindings might give some interesting benchmark results ;)
<RX14> @Flaque you're looking for `skip_file`
<RX14> @vlazar they'll be useless reasults
<RX14> because it'll be impractical to use libh2o on a real crystal app
<RX14> better to do something actually useful like optimize crystal's stdlib
<FromGitter> <faustinoaq> @vlazar oh, ok 👍
<FromGitter> <Flaque> Huzah thank you @RX14
<FromGitter> <vlazar> @RX14 sure, the more Crystal the better!
<FromGitter> <faustinoaq> RX14, I think you're right 👍
<RX14> remember that benchmarks aren't a game
<RX14> if the benchmarks aren't realistic they don't mean anything
<FromGitter> <vlazar> lol, but it is (an interesting game)! :)
<FromGitter> <faustinoaq> Yeah XD
<FromGitter> <vlazar> seriously though, benchmarks are hard of course, correctly interpreting results is even harder
<FromGitter> <vlazar> something like a set of standard benchmarks for stdlib and never(almost) slowing things down would be nice, but I don't think that should be high priority now, Cryystal is already very fast
<FromGitter> <faustinoaq> Yeah, I think crystal can be "fast enough" :D
<txdv> but can it beat go and rust?
<RX14> no
<RX14> it shouldnt aim to
<RX14> it should aim to be as fast as it can for crystal's tradeoffs and crystal's level of abstrcation
<RX14> for crystal, being fast isn't as important as being easy to read, and easy to maintain
<Yxhuvud> it is surprisingly often it is possible to be fast though, while maintaining the other ones.
<RX14> yes, for sure
<RX14> but i don't think we will end up as fast as rust in some places
<RX14> we'll always have some kind of GC with GC overhead
<RX14> and we'll probably never have iterators as good as rust's
<FromGitter> <bendietze_twitter> Yes, maybe, but - i am a newbie to Crystal - I can write my code in minutes - and without headache - and than? Yes, you are right - it's a very fast binary
<FromGitter> <bendietze_twitter> 😜💪
<FromGitter> <yxhuvud> What makes rust operators great?
<FromGitter> <yxhuvud> Damn auto correct
vikaton has joined #crystal-lang
<FromGitter> <Flaque> Hey could someone with more experience than I tell me if my library is a dumb idea? It's a little macro that checks if a c library exists on a user's system before running the compiler and then gives them a friendly error message in standard Crystal instead of defaulting to the underlying clang errors. See: https://github.com/Flaque/useslib
<oprypin> idea is not dumb, implementation kinda is :|
<RX14> @Flaque have you seen that 0.25.0 will annotate the linker error message with a helpful message?
<oprypin> maybe it's fine, even, but it just seems like a risk of things not working in more cases than before
Nathanaelle has quit [Ping timeout: 256 seconds]
<RX14> which is why annotating the linker error makes sense, because it's already failed lol
Nathanaelle has joined #crystal-lang
<FromGitter> <Flaque> @rx14 I have not, Im glad I asked 😅
Nathanaelle has quit [Ping timeout: 240 seconds]
<RX14> one of my favourite PRs
<FromGitter> <bendietze_twitter> Where can i find infos about 0.25.0 ?
<FromGitter> <bew> In the near future :P
pbodev1 has quit [Quit: ChatZilla 0.9.93 [Firefox 56.0/20170903140023]]
<FromGitter> <bendietze_twitter> 💯
<FromGitter> <bendietze_twitter> 😄
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
notdaniel has joined #crystal-lang
TCZ has joined #crystal-lang
TCZ has quit [Quit: Leaving]
alex`` has quit [Ping timeout: 240 seconds]
duane has quit [Ping timeout: 240 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang