ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<oprypin> it's all about web frameworks here sadly
<FromGitter> <fridgerator> "fast as c slick as ruby" will attract a lot of web people
<FromGitter> <fridgerator> imo
<oprypin> well im just plugging my framework, had to have used it obviously
<FromGitter> <fridgerator> i'll check it out, and the examples
<FromGitter> <renich> :(
<FromGitter> <fridgerator> dang @oprypin you put a lot of work into this
<FromGitter> <fridgerator> documentation is great
hightower4 has quit [Ping timeout: 255 seconds]
Disrecollection has quit [Ping timeout: 246 seconds]
<FromGitter> <johnjansen> has anyone done a multi factor sort ⏎ ergo RUBY `a.sort { |a, b| [a['foo'], a['bar']] <=> [b['foo'], b['bar']] }`
<FromGitter> <johnjansen> im trying to think this through, but nothing is happening up top right now ;-)
<FromGitter> <johnjansen> all elements are the same type, but the sort factors are of different types
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Client Quit]
bjmllr has quit [K-Lined]
<FromGitter> <bararchy> @fridgerator I've used glove and CrSFML , I got a better working examples using the 2nd , but I prefffer glove as its 100% Crystal
<oprypin> johnjansen, { not [
<oprypin> fridgerator, I'm just curious what made you exclude my lib from your initial list of choices
<FromGitter> <bararchy> oprypin , yeh ... Forgat about the shaders :/ it was hell to setup ... I guess doc wise and performance wise CrSFML is better , I also love the mainloop model and keyboard capture which is missing in glove
vifino has quit [Ping timeout: 246 seconds]
<FromGitter> <codenoid> sup, is my mysql package from shards doesnt support `` IS NULL `` function in SQL Query ?
Philpax_ has joined #crystal-lang
Groogy has joined #crystal-lang
<Groogy> Morning! ( ´_ゝ`)
<FromGitter> <sdogruyol> Good morning @groogy
<Groogy> What do people usually name their crystal projects after? Like in Ruby you want the word Ruby or start with the letter R
<FromGitter> <sdogruyol> ummm, mostly like ending with .cr
<oprypin> starting with cr
<FromGitter> <sdogruyol>
<FromGitter> <sdogruyol> a lot of projects for sure :P
<oprypin> name after some uh mineral
<FromGitter> <sdogruyol> hey @oprypin how are you doing
<oprypin> ok
<Groogy> was thinking crystal-clear or for my github repo
<FromGitter> <sdogruyol> BTW crystalshards got you covered for that, check the name generator :)
<Groogy> oh nice
<oprypin> that's for minerals
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> maybe we can improve that generator
<Groogy> could have it you provide some "seed" (i.e what it is) and it just "mineralify" the name
<Groogy> Like if you gave it specs it would become specium
<FromGitter> <sdogruyol> yeah makes sense
<FromGitter> <sdogruyol> we have @johnjansen who's actually really great with names :)
mark_66 has joined #crystal-lang
<Groogy> I do like crystal-clear since it plays with it's point of making self documenting code easier to write
<Groogy> contractium is also nice
<FromGitter> <sdogruyol> yup, i like it
<Groogy> how do you get things into the shard database?
<FromGitter> <crisward> I still like Dilithium... needs to be used for a super fast caching layer / framework.
<FromGitter> <sdogruyol> it uses Github API
<FromGitter> <sdogruyol> automatically indexes :P
<FromGitter> <sdogruyol> actually no db :D
<FromGitter> <sdogruyol> @crisward yeah, that's so cool :)
<Groogy> Haha or some kind of framework that just "Magically makes the entire thing work"
<Groogy> just like Star Trek plotline ;D
<FromGitter> <bararchy> Up Up we go :)
<FromGitter> <sdogruyol> @bararchy yup
<FromGitter> <sdogruyol> just passed 8500
<FromGitter> <sdogruyol> next stop is 10000!
<Groogy> oh is that stars?
<Groogy> I guess I got to star it as well
flaviodesousa has joined #crystal-lang
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> @groogy thank you, please help us reach 10k :P
<FromGitter> <martincsimpson> Hello all
<FromGitter> <martincsimpson> I'm just wondering - has there been much activity with crystal and it's new year goals? There hasn't been a blog update in a fairly long time, and I'm super interested in the project.
martin____ has joined #crystal-lang
<Groogy> I mean last blog entry was in march?
<FromGitter> <martincsimpson> Yes, last one was in march.
<Groogy> before that is february for version 0.21 and right now it is on version 0.23 I think?
<FromGitter> <bararchy> Yeha , v0.23
<FromGitter> <bararchy> But 0.23.1 is near
<FromGitter> <martincsimpson> Yeah, so I saw the 0.21 update, I assumed there would be an update for 0.22 and 0.23 (naively) haha
<FromGitter> <bararchy> There are changrlogs
<FromGitter> <martincsimpson> I just wanted to check on the project and see how things are proceeding... we're hoping crystal can get to v1.0 as our entire team is interested in using it.
<Groogy> yeah 0.23 tag on github was done 7 days ago
<Groogy> it looks like
<FromGitter> <martincsimpson> I'm going to check the change logs :) Thanks guys
<Groogy> so yes it seems very much alive :)
bjmllr has joined #crystal-lang
<FromGitter> <martincsimpson> I see support for CentOS has been dropped :(
<FromGitter> <akzhan> @martincsimpson CentOS support should be returned by 0.23.1 I suppose
<FromGitter> <martincsimpson> That's good enough
<FromGitter> <martincsimpson> :)
<FromGitter> <martincsimpson> Does anyone know the status of parallelism / concurrency?
<FromGitter> <bararchy> "Working on that (c)"
<FromGitter> <bararchy> hahaha
<FromGitter> <akzhan> Crystal is friendly to concurrency, but multithreading is not complete yet,
<martin____> @akzhan, we're currently using crystal in production with little to no problems at all.
<martin____> We're just all counting on the multi-threading coming to fruition :)
<FromGitter> <akzhan> @ martin____ you are crazy :)
<Groogy> what kind of production?
<martin____> We're serving over 12,000,000 hotel searches per day.... that kind of production
<FromGitter> <sdogruyol> @martin__ wow, that's amazing!! Are you using Kemal by any chance?
<martin____> We aren't, actually 90% of our infrastructure is written in ruby, including an in-house messaging queue
<martin____> However, our team got extremely excited about the speed gains of Crystal whilst maintainig ruby-like syntax, so we rebuilt our message-queue in crystal
<Groogy> oh speaking of ruby, is there a ruby-crystal binding library or something?
<FromGitter> <bararchy> martin___> Nice ! (ps ... why this nick ? so hard to mention hahah)
<martin____> ^ it was auto chosen, let me switch vack to gitter
<FromGitter> <martincsimpson> This is better.
<FromGitter> <martincsimpson> So,
<FromGitter> <bararchy> Yey !!
<FromGitter> <martincsimpson> Ruby Client:
<FromGitter> <martincsimpson> Java Client:
<FromGitter> <bararchy> @martincsimpson I use that :) for testing
<FromGitter> <martincsimpson> @bararchy use what?
<FromGitter> <martincsimpson> Oh nice :)
<FromGitter> <martincsimpson> The code is pretty terrible, admittedly - but it functions perfectly for our needs
<FromGitter> <martincsimpson> We're pushing ~5Gbit/second through it and it's not even breaking a sweat
<FromGitter> <martincsimpson> Once v1 comes out we're going to start re-writing our stack, but crystalmq was a proof of concept for us to see if it'd suit our needs
<FromGitter> <sdogruyol> @martin__ what're you using to server that hotel searchs?
<FromGitter> <martincsimpson> Our stack consists of Sinatra (ruby) on the front end to turn HTTP requests into Event Messages
<FromGitter> <martincsimpson> The event messages are sent through crystalmq to any number of waiting microservices (either java, ruby or crystalmq), which will in turn raise event messages back
<FromGitter> <sdogruyol> if you're using Sinatra i think you can easily switch to Kemal
<FromGitter> <martincsimpson> Yes, we're looking at moving to kemal in the long-term.
<FromGitter> <sdogruyol> that's great to hear
<FromGitter> <martincsimpson> But before we commit to that kind of investment, I wanted to make sure the project is still on track :D
<FromGitter> <sdogruyol> feel free me to ping me :)
martin____ has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> you mean Kemal or Crystal
<FromGitter> <martincsimpson> I will, thanks for that.
<FromGitter> <martincsimpson> Both
<FromGitter> <martincsimpson> I've investigated Kemal already, but failed to get it to run.
<FromGitter> <sdogruyol> well Kemal is actively being developed for the last 2 years
<FromGitter> <sdogruyol> it's still alive and kicking :metal:
<FromGitter> <martincsimpson> I think I was using a mismatch of crystal / kemal versions to be honest
<FromGitter> <martincsimpson> That's why we decided to wait until v1.0 is out - then hopefully the breaking changes will stop :)
<FromGitter> <sdogruyol> i can help you with that for sure
<FromGitter> <sdogruyol> :)
<FromGitter> <martincsimpson> Alright, we'll reinvestigate it next sprint and I'll be in touch
<FromGitter> <martincsimpson> You're here usually?
<FromGitter> <martincsimpson> Oh one thing, does Kemal support websockets yet?
<FromGitter> <sdogruyol> Ofc
<FromGitter> <sdogruyol> It's been supported from the beginning
<FromGitter> <sdogruyol> This blog post may interest you @martincsimpson
<FromGitter> <martincsimpson> Looks good, I'll check it out
<FromGitter> <martincsimpson> @sdogruyol holy crap that's some good throughput :)
<FromGitter> <sdogruyol> Thanks
<FromGitter> <martincsimpson> When we've benchmarked crystalmq we're seeing an average of 150,000-200,000 messages per second are processed. It's amazing
<FromGitter> <sdogruyol> Awesome!
<FromGitter> <martincsimpson> This is why we're so excited about crystal
<RX14> @martincsimpson with how many producers/consumers?
<FromGitter> <sdogruyol> Yeah Crystal is great at performance
<RX14> i assume that's pretty IO bound and each message is sent to a lot of consumers
<FromGitter> <martincsimpson> @RX14 this was with two producers / two consumers.
<RX14> seems a bit low then
<FromGitter> <martincsimpson> @RX14, you're completely correct. The more consumers there are the worse the performance becomes.
<FromGitter> <martincsimpson> @RX14 we actually got limited by network bandwidth.
<RX14> ah that makes sense then
<RX14> if crystal can do 100k HTTP requests per second I would have guessed at 500k+
<FromGitter> <martincsimpson> That being said, even with hundreds of consumers we're still not bottlenecked in production.
<FromGitter> <martincsimpson> Plus, the code could use a severe rewrite, but we've just not got the bandwidth at the moment
<RX14> yeah i can see that haha
<FromGitter> <martincsimpson> One of the issues we faced with crystal was debugging - we're missing the tools from Ruby a lot such as pry
<FromGitter> <sdogruyol> We got some great people here who can help you with performance issues / tricks @martincsimpson
<FromGitter> <martincsimpson> Plus, Thread.abort_on_exception doesn't seem to play nicely.
<RX14> yeah you do have to do puts debugging
<RX14> you can sort of get away with gdb for simple code
<FromGitter> <martincsimpson> @sdogruyol that'd be awesome, I'd like to get the project to a point where it's usable by everyone wtihout looking at the code going "WTf"
<RX14> but it can't understand complex variables
<FromGitter> <sdogruyol> Happy to help @martincsimpson :)
<FromGitter> <martincsimpson> @RX14, yes puts debugging is where we're at unfortunately. We've been seeing some issues with sockets not being closed but it's been nigh-on impossible to debug when Threads are involved.
<FromGitter> <molovo> Has anyone done a write up on basic performance tips/tricks for Crystal? I’d be interested in reading that
<Groogy> also thanks again @RX14 for yesterday, as soon as I get really indepth knowledge of crystal I'll stop bothering you about questions :P
<FromGitter> <akzhan> you may use llbm debugger, even in VSCode IDE
<RX14> llvm debugger is actually worse than gdb currently
<RX14> because it decided to treat all unknown DWARF languages as unusable
<RX14> whereas gdb falls back to C
<RX14> which means you can see some local vars using gdb but not lldb
<RX14> none at all using lldb*
bjz has joined #crystal-lang
<FromGitter> <sdogruyol> @molovo yeah
<FromGitter> <molovo> Sweet, thanks
<Groogy> I did find it funny, the same performance tricks kind of carried over to crystal from ruby :P
<Groogy> or well some of them
<RX14> well the performance tricks go much deeper
<RX14> and there's a lot of ruby performance tricks that you can safely ignore and LLVM optimises them to the same thing
<Groogy> Well with ruby you have a tendency as a new person to create tons of immediate objects as well
<FromGitter> <sdogruyol> @molovo also check
<RX14> well that's going to be a performance trick with any language with a GC
<FromGitter> <molovo> Nice, that’s useful too
<RX14> well those benchmarks used to be very broken
<FromGitter> <martincsimpson> That's pretty cool
<FromGitter> <sdogruyol> @groogy indeed, Ruby flame graphs are always full of unnecessary allocations / objects
<RX14> somehow icyleaf's laptop always said the last executed testcase in the benchmark was always the fastest by a lot
<Groogy> I am super happy though that blocks gets inlined by Crystal
<RX14> so I had to run all the benchmarks on my desktop so that there was accurate results
<Groogy> chache warmup maybe? ;D
<FromGitter> <sdogruyol> @Groogy yeah, i also really ilke that
<RX14> well benchmark.ips does warmup runs
<FromGitter> <sdogruyol> Kemal uses blocks and it gets inlined by default <3
<RX14> which is the weird part
<Groogy> I know was just kidding
<RX14> it does some callibration runs to work out how often to sample the time
<Groogy> and cache warmup shouldn't make that big of a difference
<RX14> to avoid overhead as much as possible
<Groogy> it has some and it shouldn't make things way too out of proportion
<RX14> Groogy, i assume it was power management of some kind on OSX
<Groogy> ah yeah
<RX14> a lot of those benchmarks end up as nop-loops anyway
<Groogy> the cpu throthling up and down would have way bigger impact
<FromGitter> <molovo> Turboboost most likely. It takes a while for the CPU to ramp up under load
<RX14> because of llvm
<Groogy> my replication of Ruby Blocks in C++ also gets inlined
<RX14> yeah inlining of blocks is really nice
<Groogy> would be cool if the VM on Ruby could do some runtime optimizations
<RX14> well jruby is getting pretty fast
<Groogy> but that one has the virtual machine of Java to back it
<Groogy> so it has hotspot optimization and everything
<RX14> yes
<RX14> it's good
<FromGitter> <sdogruyol> LLVM <3
<Groogy> though coolest feature of jruby is that you can access any Java and ruby code seamlessly between the two environments
<Groogy> that's only reason I liked it
<Groogy> you could get comparable speed in Rubinius I think and I helped improving their C interface for rbSFML
<Groogy> though for obvious reasons I couldn't get rbSFML working on jruby
<RX14> you could but it would be a lot more effort
<Groogy> yeah
<Groogy> Though we had JavaSFML so that one worked in jruby
<FromGitter> <martincsimpson> @sdogruyol thanks for that ;) Hopefully reddit doesn't roast it too hard
<RX14> i have to say it's pretty roastable...
<RX14> but if it works it's great
<FromGitter> <sdogruyol> it's okay :)
<FromGitter> <martincsimpson> It is indeed. Pull requests always welcome
<FromGitter> <sdogruyol> we have an active reddit community
<FromGitter> <sdogruyol> it's good to have more content
<RX14> well if you want an in-house rewrite maybe PRs would be best left until after that
<RX14> i have too much to do already...
<FromGitter> <martincsimpson> Probably a good idea. Yes
<FromGitter> <sdogruyol> meanwhile we also have an active StackOverflow tag
<FromGitter> <martincsimpson> Hopefully we'll get to it soon.
<FromGitter> <sdogruyol> please ask your question for more visibility and searchability
<FromGitter> <martincsimpson> I lurk the cyrstal subreddit frequently actually
<Groogy> oh there's a crystal subreddit
<FromGitter> <sdogruyol> sure
<FromGitter> <martincsimpson>
<FromGitter> <sdogruyol> it's getting a lot traction lately
<FromGitter> <sdogruyol> up to 1.3k
<Groogy> subscribed
<FromGitter> <sdogruyol> cool!
<FromGitter> <martincsimpson> same
<RX14> i preferred r/crystal
<Groogy> so guess mostly now the reddit is just showing off projects?
<FromGitter> <sdogruyol> yeah, but it's unmaintained
<FromGitter> <martincsimpson> /r/crystal is also invite-only?
<Groogy> /r/crystal-lang would probably have been better
<FromGitter> <sdogruyol> @groogy mostly for community / project showcase, ann e.g
<RX14> it was less-used but the moderator was willing to give others access @sdogruyol
<RX14> it hardly matters but it would have been nice to have the shorter name
<FromGitter> <sdogruyol> yeah, agreed
<FromGitter> <sdogruyol> how can we reach the mod?
<RX14> it's too late for that now lol
hightower4 has joined #crystal-lang
<FromGitter> <sdogruyol> ugh
<RX14> there was a decision a while back over which subreddit to use
<RX14> and asterite went for the most-used instead of the one with the shorter name
<Groogy> it's also harder to make a community move
<Groogy> we had a problem with the /r/Stellaris (someon nabbed it before we could) but we integrated it into our network
<Groogy> but that moderator then went on a real... eeeh
<Groogy> hizzy fit
<Groogy> it took a lot of active engagement from both the network moderators and the company itself to move over to /r/StellarisGame
Raimondii has joined #crystal-lang
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> tough one
Raimondi has quit [Ping timeout: 260 seconds]
Raimondii is now known as Raimondi
bjz has quit [Ping timeout: 276 seconds]
bjz has joined #crystal-lang
<FromGitter> <codenoid> is crystal have a function for converting html to entities character ?
<FromGitter> <straight-shoota> what exactly do you mean by that?
<FromGitter> <codenoid> like ``&`` to ``&amp;``
<FromGitter> <straight-shoota> `HTML.escape`
<FromGitter> <straight-shoota>
<FromGitter> <codenoid> thanks ^^
hightower4 has quit [Ping timeout: 255 seconds]
<jokke> heya
<jokke> is 1.0 still planned for this year?
<RX14> well what do you mean by planned
<RX14> there isn't a planned release date for anything really
<Groogy> hope that it will have a release of 1.0 this year?
<Groogy> I guess?
<RX14> it'll be released when 1.0 is ready
<Groogy> I think it said that in a blog post that they "hoped" that 1.0 would be reached this year
<RX14> i doubt it'll be released this year
<Groogy> Same here, I'm new but looking at the ambition with resources available have a hard time seieng it reach 1.0
<Groogy> this year
<RX14> development has slowed down since that blog post
<FromGitter> <sdogruyol> unfortunately yes
<FromGitter> <akzhan> I’m doubt too. multithreading at early stages at April and no more commits.
<RX14> indeed
<FromGitter> <sdogruyol> and Ary is stepping up from the main core developer position
<FromGitter> <sdogruyol> stepping down*
<Groogy> ow :(
<FromGitter> <codenoid> :(
<RX14> i wish there was more transparency about that, just an official statement about ary stepping down to avoid confusion
<FromGitter> <sdogruyol> well, yeah it's not official. I'm just making assumption about his comments
<RX14> instead there was just the occasional hint in a github comment and the fact that his git email changed
<jokke> really?!
<jokke> oh noes
<FromGitter> <sdogruyol> i wish i could help
<jokke> ^
hightower4 has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> i mean we got great people here
<FromGitter> <sdogruyol> how about we all join forces and improve Crystal in every way
<FromGitter> <sdogruyol> we already have people PRing to compiler also
<FromGitter> <akzhan> Multithreading support issues arent not described well. It’s a half of work.
<RX14> the design and implementation in the multithreading branch has been discussed internally at manas meaning everyone outside doesn't really know what's going on
<RX14> that would be fine if there was progress
<RX14> but there isn't and because the design hasn't been documented it's very difficult to continue work
<FromGitter> <sdogruyol> i also think that it should be public as much as possible ofc
<FromGitter> <sdogruyol> i'm aware that not everything is ready-to share state e.g
<Groogy> also don't think multithreading is most important feature to finish
<Groogy> it is good to attract people I guess but it's more important to get the "rough edges" done in my opinion
<Groogy> like Windows support
<FromGitter> <martincsimpson> For me, the only blocker to using crystal is multi-threading
<Groogy> yeah but you are coming from an enterprise/server perspective right?
<FromGitter> <martincsimpson> Once I have that, we're going to steam ahead and through our developers on it - hopefully for the betterment of the language as a whole
<RX14> @martincsimpson what usecase?
<FromGitter> <martincsimpson> Yes, you're right @FromIRC
<Groogy> your consumer won't be buying directly your product
<FromGitter> <martincsimpson> correct
<FromGitter> <martincsimpson> @RX14, as i said earlier, we process around 12,000,000 searches a day (similar to
<FromGitter> <martincsimpson> This has a very heavy CPU load, and right now most of the services are single-threaded and in ruby.
<FromGitter> <martincsimpson> Crystal is already a speed-gain for us, but adding on proper multithreading would really increase our efficiency
<RX14> anything request-based and stateless can be scaled out without parallelism
<Groogy> not saying multi-threading shouldn't be done, and I think even if let's say current work on supporting that dies. Someone will take that torch eventually
<FromGitter> <martincsimpson> We're currently using java for all our multi-threading needs.
<FromGitter> <martincsimpson> @RX14, you are correct - and we scale heavily with 1000's of instances
<FromGitter> <martincsimpson> (this is why we use microservices - so we can scale individual services)
<FromGitter> <martincsimpson> However, there's one part that we're struggling with - and that's the itemization component (turning a list of prices into a quote)
<FromGitter> <martincsimpson> and we're using a java microservice for this, as the multi-threading gives us a massive advantage.
<RX14> if you can scale out to multiple machines then you can already scale out to multiple cores
<Groogy> I think what martin wants is to just unify as much as possible under crystal
<FromGitter> <martincsimpson> @groogy is correct
<FromGitter> <martincsimpson> However @RX14 what you are saying about scaling out to multiple cores is a half-truth
<FromGitter> <martincsimpson> We can scale out our searches to the point where a single hotel search can take 1-2 seconds, 4 seconds at the worst case
<FromGitter> <martincsimpson> And we can run those massively parallel - we process thousands per second... but they never really go under 1 second
<FromGitter> <martincsimpson> Why? Because there is one component in the search flow that needs to be multi-threaded, and if we split that out into many parallel services it gets slowed down by network IO
<FromGitter> <martincsimpson> So, our testing by using a java app instead of a ruby app shows that using multithreading we can reduce the time for a single search to around 300ms
<RX14> i see, that amkes sense
<FromGitter> <martincsimpson> It's been a long road I can tell you that ;)
<FromGitter> <martincsimpson> that's why i even started looking for crystal.
<FromGitter> <martincsimpson> Because i really dont like java :)
<FromGitter> <bew> :+1:
<Groogy> I am split about Java, their technology behind the virtual machine is pretty cool and it enables up a lot of awesome stuff like jruby
<Groogy> but Java as a language, meeeeeeh....
hightower4 has quit [Ping timeout: 240 seconds]
<RX14> i really don't fine java 8 that bad
<RX14> it's not great and it's not exciting but it's a solid language to do things in
<Groogy> oh it's been a solid language for long
<RX14> it's got a great ecosystem and the tooling is fantastic
<Groogy> but it's not like... Ruby where I fell in love
<Groogy> etc.
<Groogy> no passion :P
<Groogy> every relationship needs some excitement
<FromGitter> <martincsimpson> @groogy, you're exactly right
<FromGitter> <martincsimpson> Java is a SOLID language, it's tooling, it's speed, it's absolutely great
<FromGitter> <martincsimpson> but its not a joy to use, and the syntax hurts my eyes....
<FromGitter> <martincsimpson> Thats why crystal was so attractive. It's like having a smart and hot girlfriend
<FromGitter> <martincsimpson> hahaha
<Groogy> but that smart and hot girlfriend is a bit socially awkward and needs to "grow up a little" ;D
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <martincsimpson> Yes, exactly hahaha
<FromGitter> <martincsimpson> She falls over things quite frequently
bjz has joined #crystal-lang
<Groogy> so I guess C++ is then that teacher, a bit to the years but still looks pretty good, gotten some "upgrades"
<FromGitter> <akzhan> @martincsimpson look at Kotlin. It’s great for JVM
<FromGitter> <martincsimpson> Kotlin looks quite nice!
<FromGitter> <martincsimpson> what do you guys think of JRuby?
<FromGitter> <sdogruyol> @Groogy passion, love, Ruby <3
<FromGitter> <sdogruyol> @martincsimpson it's good but i don't like the long startup / warming time
<FromGitter> <sdogruyol> native code wins <3
<FromGitter> <martincsimpson> @sdogruyol agreed. I know the guy who started JRuby
<Groogy> Yeah I prefered Rubinius over JRuby
<FromGitter> <sdogruyol> @martincsimpson headius?
<FromGitter> <martincsimpson> Ola Bini
<FromGitter> <martincsimpson> He was working on it at ThoughtWorks
<FromGitter> <sdogruyol> oh cool
<FromGitter> <sdogruyol> @martincsimpson is your company a fortune 1000 by any chance?
<FromGitter> <sdogruyol> 12mm searches daily is not small :D
<FromGitter> <martincsimpson> @sdogruyol Nope, we're a small company in Thailand :)
<FromGitter> <sdogruyol> i'd not call that small :D
<FromGitter> <sdogruyol> guess you have 1+mm revenues already
<FromGitter> <martincsimpson> Yes, for sure
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <martincsimpson> But, our company only has around 30 people
<FromGitter> <sdogruyol> how about letting your company know about our fundraiser or better support :P ?
<FromGitter> <martincsimpson> Well, the good news is that's definitely on the cards
<FromGitter> <martincsimpson> Justification is there - but we need parallelism
<FromGitter> <sdogruyol> that's great to hear :)
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> you know what
<FromGitter> <sdogruyol> i actually compiled Crystal with parallelism support @martincsimpson
<FromGitter> <sdogruyol> it worked like a charm but the throughput wasn't that great
<FromGitter> <bararchy> btw @sdogruyol are you bussnessly (how do i spell that ?!) connected to Crystal ?
<FromGitter> <martincsimpson> Really? @sdogruyol why was that?
<FromGitter> <sdogruyol> @bararchy nope, why did you ask that :P
<FromGitter> <sdogruyol> @martincsimpson because it's an ongoing effort
<FromGitter> <martincsimpson> Oh I see, well fingers crossed.
<FromGitter> <akzhan> @sdogruyol can you write an issue to get current state, design and implementation of multi threading, detailed roadmap? ⏎ ⏎ It’s easy to develop with good roadmap.
<FromGitter> <sdogruyol> @martincsimpson
<FromGitter> <martincsimpson> If we're able to get parallism out the door, and stop the breaking changes I don't see why we cant contribute both time and money to further the cause :)
<FromGitter> <sdogruyol> @akzhan there's actually a wiki page for that
<FromGitter> <martincsimpson> @sdogruyol that's really cool!
<FromGitter> <sdogruyol> @akzhan
<FromGitter> <sdogruyol> @martincsimpson so throughput was not linear
<FromGitter> <martincsimpson> @sdogruyol ahhh secret features. I'm going to play around with this
<FromGitter> <bararchy> @sdogruyol I just like the way you activlly push for Crystal :) ⏎ @akzhan Did you play around with crystal-fann ?
<FromGitter> <sdogruyol> with single-threaded i was getting around 60k rps with parallelism support i got around 100k
<FromGitter> <sdogruyol> still a big improvement
<FromGitter> <sdogruyol> but there's definitely a room for more :)
<FromGitter> <sdogruyol> @bararchy thank you, i'm trying to do my best
<FromGitter> <sdogruyol> so basically if you're really CPU / IO bound then multi-thread will be a big big win @martincsimpson
<FromGitter> <akzhan> @bararchy no, it is far away from my topics :)
xiljin has joined #crystal-lang
<FromGitter> <sdogruyol> for my basic scenario it didnt make much difference
<Groogy> hmm where is the overhead? In context switching?
<Groogy> or?
<FromGitter> <martincsimpson> @sdogruyol you're right, we're basically CPU/IO bound. It'll be a massive win for us.
<FromGitter> <sdogruyol> @Groogy context switch, locks e.g
<Groogy> wondering if it's in a state for me to use it to process several agents at same time
<FromGitter> <sdogruyol> well i think you can compile that branch with Crystal 0.21.0
<RX14> why would being IO bound mean parallelism helps?
<FromGitter> <martincsimpson> @sdogruyol I wonder if I can compile crystalmq with the multi-threaded branch, it is only handling message IO after all. What do you think?
<RX14> surely if you're IO bound you spend your time waiting and have low CPU usage because you're waiting for IO
<FromGitter> <sdogruyol> Gustavo is the lead on multi-thread support @ggiraldez
<FromGitter> <martincsimpson> @RX14 - Network IO bound (if we implement a non-multithreaded solution)
<FromGitter> <sdogruyol> @martincsimpson if it's 0.21.0 compatible, you can. But you need a custom version of libgc
<FromGitter> <martincsimpson> @RX14 - CPU bound currently
<FromGitter> <martincsimpson> @sdogruyol I saw, no problem with the custom version of libc. Would be great if i could get this to work though. I'll have a play around with it. Thanks for the info
<FromGitter> <sdogruyol> @martincsimpson i'm sure you can compile :) You're welcome
<FromGitter> <sdogruyol> from the wiki ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ @martincsimpson []
<FromGitter> <martincsimpson> Ah
<FromGitter> <martincsimpson> network IO used FD's
<FromGitter> <martincsimpson> damn.
hightower2 has joined #crystal-lang
<FromGitter> <sdogruyol> :(
<FromGitter> <martincsimpson> Another question then
<FromGitter> <martincsimpson> any plans for couchbase support?
<FromGitter> <sdogruyol> sure
<FromGitter> <sdogruyol> you mean the db?
<FromGitter> <martincsimpson>
<FromGitter> <martincsimpson> Ah couchbase was a fork of couchdb
<FromGitter> <martincsimpson> wait... no it wasn't
<FromGitter> <martincsimpson> I wonder what the difference is
<FromGitter> <straight-shoota>
<FromGitter> <martincsimpson> That's interesting. Looks like we might be able to use it
<FromGitter> <martincsimpson> well, if there's a plan for Couchbase would be good too - because we can migrate our stack immediately. But I'll check out CouchDB see if its something we can utilise
<Groogy> Yay new computer parts today! Can reinstall Linux now and properly start playing around with Crystal instead of faking stuff through a X server on Windows
<hightower2> sdogruyol: these days it's a common pattern that someone creates a basic web-oriented service, whatever the specific that service/feature is, and then they create a web portal for accessing/using it. Are you aware of some "stock" portal projects that support standard things like user database, OAuth login, profile/settings page etc., which can then quickly be modified/upgraded to provide a specific service?
<Groogy> Martin are you also calculating for training time for your programmers though?
<Groogy> that was my biggest problem in getting my programmers switching to Git was motivating the time needed to train people
<Groogy> or well mine and mine, the companies programmers
<Groogy> but they're like my children ;D
<FromGitter> <martincsimpson> @groogy, we're allocating sprints to learn crystal, they're really excited about it. Their task is to build whatever the hell they want that will push the business forward.
splitty__ has joined #crystal-lang
<FromGitter> <martincsimpson> Luckily, I'm the one that get's to make the IT decisions around here (being a small company rocks)
<FromGitter> <martincsimpson> so as long as business needs are met its all good
<Groogy> ah nice, we had the seniors at paradox go "Well it's like SVN innit?"
<FromGitter> <martincsimpson> That's a paddlin'
<Groogy> so I spent a lot of effort of setting stuff up so people could learn it properly
<Groogy> though we are way more people than 30
<FromGitter> <martincsimpson> Yeah, I mean 30 is the entire company - the IT team is just 10 of those 30
<FromGitter> <martincsimpson> Right, I've got to run - home time.
<Groogy> When I started our entire company was 30 people :P
<Groogy> or well both companies, since we are split in two, development and publishing
<FromGitter> <martincsimpson> ah makes sense
<Groogy> cya!
<FromGitter> <martincsimpson> we're about to split in two actually :)
<FromGitter> <martincsimpson> anyone want a job in thailand? ahaha
<Groogy> As a summer job?
<Groogy> Favorite spot for Swedes during summer :P
<FromGitter> <martincsimpson> No summer jobs here ;)
<FromGitter> <martincsimpson> anyway, see you later
splitty___ has quit [Ping timeout: 240 seconds]
<Groogy> ah dang
<Groogy> cya
<FromGitter> <sdogruyol> @martincsimpson full time Crystal :P? That sounds awesome
<FromGitter> <sdogruyol> @Groogy cya
<FromGitter> <sdogruyol> @hightower sorry, i'm not sure if i understand that
sz0 has joined #crystal-lang
<Groogy> no I was saying bye to martin
<Groogy> :P
<Groogy> I'm still stuck at work
<FromGitter> <sdogruyol> oh sorry :D
<FromGitter> <sdogruyol> just remembered that you're a Swede, so there's still time to work :D
Philpax_ has quit [Ping timeout: 240 seconds]
<FromGitter> <tarvit> @faustinoaq Thank you
Philpax has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
Philpax has joined #crystal-lang
<jokke> RX14: java tooling is fantastic? :D
<jokke> yeah. gotta love ant! :D
<RX14> ant is shit
<RX14> but there's a lot of great tooling
<RX14> not all of it is great
<Groogy> ow yeah how is Cmake with crystal? Imagine not that good yet since there isn't really any ide/build system besides shard?
<RX14> crystal shouldn't really need a build system in any way
<RX14> only if you bundle extensions with your shard
<RX14> in which case you use shard's post install hook to execute make/cmake/a script of your choice
<Groogy> Well you have the whole "init" n stuff to setup a project structure to comply with what shards expect I guess?
<RX14> shards at it's core only really created the lib folder
<RX14> and crystal expects a lib folder in the cwd to look up shard requires
<Groogy> How does your workflow look like? I do: write code -> 'shards build' -> 'bin/run_exe'
<RX14> crystal spec expects a spec folder
<RX14> shards build is configurable
<RX14> the standard is src
<RX14> and i expect everyone to use src
<RX14> but it's the least enforced dir out of lib/spec/src
<RX14> oh actually nvm
<RX14> with the new require scheme you need to use src yes
<RX14> actually with the old one too
<RX14> never mind yeah you need to use src or shards won't work
<Groogy> could you describe how your workflow is so I can get a sense of what other more experienced crystaline people do?
<RX14> just crystal run
<RX14> and I use entr to automate rebuilding on source changes
<Groogy> and crystal just find dependencies by itself there?
<Groogy> entr?
<RX14> if you run shards, yes
<Groogy> oh I just used shards build to be sure that it could find the correct paths
<RX14> Groogy, shards places shards under lib/shard_name
<RX14> crystal always includes lib under the require path
<RX14> shards doesn't do any magic
<Groogy> yeah but I require them not relatively but just like require "glfw"
<Groogy> so crystal looks at ../lib always?
<RX14> no just lib
<RX14> you can't run the crystal compiler in a different directory to the project root
<Groogy> oh right so since I am building from root directory it finds it even if it is crystal run src/main.cer
<RX14> because thats the directory where the lib folder is placed
<Groogy> .cr*
<RX14> yes it's always relativce to your current directory
<RX14> it's really simple
<jokke> kiss :)
<Groogy> ugh I am so used to super big projects with over engineerd Cmake configurations
<Groogy> so I just assumed it can't be that convenient
<Groogy> for some dumb reason
<jokke> Groogy: well. crystal has a long way to go as well
<jokke> no support for compiled libs for instance
<RX14> that'll never happen jokke
<jokke> RX14: you think?
<jokke> that sucks
<RX14> it's fundamentally impossible
<FromGitter> <bew> what do you mean?
<jokke> RX14: no it's not.
vifino has joined #crystal-lang
<RX14> without changing the type system, it's impossible
<FromGitter> <bew> nvm I get it
<Groogy> Well it would need that you have an "extern" keyword which enforces you to specify the types
<jokke> RX14: why? if you'd specify a sort of header file acompanying the compiled lib
<Groogy> then it would work
<RX14> sure but that's really ugly
<Groogy> but think that goes against the spirit of what the devs want as well
<RX14> it's much better to simply design an incremental compiler
<RX14> and solve the problem in the compiler instead of pushing the problem to the devs
<jokke> RX14: but it's necessary to be able to build projects of the size of firefox or similar
<Groogy> but that means that eeeh.. .what is the word
<Groogy> libraries you pay for
<Groogy> becomes impossible to do
<RX14> thats crystal's main attraction
<RX14> a *really* smart compiler
<jokke> that's true
<RX14> Groogy, yup
<RX14> closed-source crystal libs are impossible
<jokke> i don't see why it shouldn't be possible
<FromGitter> <bew> note sure it's good, but I like it
<jokke> RX14: and not _quite_ true :D
<RX14> you can bind to a propriatery C library
<jokke> RX14: you can expose c functions from crystal code
<jokke> :)
<RX14> sure but then it's not a closed source crystal lib
<jokke> which you can then bind to in your application
<RX14> it's a closed source C lib
<RX14> with open source crystal bindings
<RX14> well maybe not open source
<RX14> but visible source
<jokke> yeah but what's wrong with visible bindings?
<RX14> nothing
<RX14> i'm just nitpicking and saying i'm technically correct ;)
<Groogy> nah that works
<Groogy> but it means you can't write it purely in Crystal
<jokke> you could publish a closed source crystal library which exposes c functions for which you write an open source interface in crystal
<jokke> sure it's a pain
<oprypin> you can write a lib in Crystal and export some C ABI and provide Crystal bindings
<oprypin> yay jokke was quicker
<jokke> but i'm sure that it could even be automated
<RX14> it's an absolutely massive pain
<oprypin> it's mostly a joke yeah
<Groogy> I mean you could potentially do it the good old COM way
<RX14> it's impossible to use crystal types at the interface, only structs
<RX14> no blocks
<Groogy> and provide definitions that are all abstract
<jokke> RX14: yeah
<RX14> no unions
<Groogy> and have a factory that fills them
<jokke> it's a crippled lib
<Groogy> that would kind of work right?
<jokke> RX14: well.. you would have to put some work into the bindings
<hightower2> When using YAML::PullParser, can I somehow "peek" into the upcoming content, or if value can be of different types I need to read it as string and then test that string for certain properties and convert to appropriate object?
<RX14> Groogy, you mean binary patching?
<jokke> so that it would feel "crystal-like" to use it
<Groogy> obj : ICoreObj = InitFramework() # Actually returns ImpCore
<RX14> the crystal compiler needs all code available to compile binaries
<Groogy> just empty abstract classes that define an interface and a creator creates the actual implemented object
<RX14> you can't have an ImpCore without the compiler knowing about it
<Groogy> yeah but InitFramework is a C exposed funciton
<Groogy> like someone said before
<RX14> but then it can only return C objects
<RX14> and you're back where you started
<Groogy> Oooooh
<FromGitter> <bew> RX14 yes you can, I did it :p
<FromGitter> <bew> (with a shared lib)
<Groogy> Well the original COM model used Structs with callbacks
<RX14> no unions no types no crystal
<Groogy> so that would work
<jokke> Groogy: you would have to put a lot of work to the bindings
<FromGitter> <bew> yeah, the hard stuff is to generated the bindings
<jokke> And it would probably be very much less performant since llvm can't optimize anything inbetween the app and the lib
<RX14> and there would still be no inlining
<RX14> and you have to invent your own stable ABI for crystal
<Groogy> a lot of properitary libraries still do this in c++
<Groogy> like Steamworks that I work with
<RX14> every crystal class stores an ID
<Groogy> So it wouldn't be that much different
<RX14> these ids are assigned sequentially based on the order of requires
bjz has joined #crystal-lang
<Groogy> most of the time, companies don't care about performance here and just cares about protecting their intellectual property
<RX14> crystal's internal abi is SO dynamic it's essentially impossible to do easilly
<Groogy> Yeah but then just do C structs that gets its members filled with callbacks back to Crystal code in the shared lib
<Groogy> that would technically work wouldn't it?
<RX14> still you can't pass crystal objects through the callback anythings
<Groogy> you can as long as it comes from the shared library
<RX14> there is no way to escape marshalling every data object to C
<RX14> nope Groogy
bastelfreak has joined #crystal-lang
<RX14> only primitives that exist in C
<RX14> ints, pointers, structs
<RX14> and not crystal structs, lib structs
fiete has joined #crystal-lang
<RX14> what do people do with propriatery ruby libs?
<RX14> you need to distribute ruby by source too
<RX14> the problem can't be that important
<Groogy> Nah it's possible, as long as the same data gets passed around and is wrapped properly. For instance so you have a Struct to represent the object in client code. That struct exists in the shared library as well, but it has a referenceis defined actually with the object type, while in the client code it is just a Void*
<jokke> RX14: i don't see the closed/open source problem but that it makes _really_ large projects very tedious to build
<jokke> since you will have to build everything
<Groogy> and the callbacks refer back to code in the Crystal code where it will just translate into a call o nthat object
<Groogy> and voila you can make a macro that populates this probably
<RX14> jokke, yeah but that's what the incremental compiler would be for
<Groogy> in Ruby they either write it in C or they scramble the source
<FromGitter> <bew> Groogy that works, yes
<RX14> Groogy, well the same obviously applies in crystal
<RX14> it's no worse at least
<Groogy> no but "these people doing it badly" doesn't mean that we should use that as an excuse :P
<Groogy> but I think as it is right now, you can work around it
<Groogy> as long as you can link against a Crystal lib
<jokke> RX14: i see so that _is_ possible?
<jokke> it tracks what source files are changed etc?
<RX14> yes it would do an AST diff ideally
<jokke> i see
<RX14> parsing files into the AST really really doesn't take much time at all
<jokke> rieally?
<jokke> *really
<RX14> like
<RX14> 10ms
<RX14> lol
<jokke> wow
<jokke> ok
<jokke> that's nothing
<RX14> the values never sound right to me
<RX14> but thats what --stats sayd
<Groogy> but the AST being compiled into a lib would be enough
<Groogy> I mean libs are just a collection of object files
<Groogy> zipped together
<Groogy> to put it bluntly
<RX14> what do you mean?
<Groogy> .a files are an archive of .o files
<jokke> Groogy: you mean *.a files?
<jokke> yeah
<Groogy> yeah
<Groogy> and object code is not finalized code
<RX14> a lib comprised of a serialised AST would be pointless
<RX14> if it takes 10ms to go from crystal source to the AST
<jokke> Groogy: it's not that easy though. crystal ignores everything that isn't being used for example
<RX14> and that the AST is so good that it can be turned back into crystal source using to_s
<RX14> which is done every time you use {{}} in macros
<Groogy> @jokke that's also why you have to do the extra lib declaration in Win compiler
<jokke> mmh
<Groogy> so it doesn't optimize away the stuff and generate proper symbols for them
<RX14> there's very very little ebnefit to storing an AST instead of crystal source
<jokke> RX14: except for making closed source libs possible :)
<jokke> but
<RX14> no
<jokke> you're right
<Groogy> well you can reverse engineer any binary
<RX14> you could still serialise the source out so easilly
<jokke> it's like "closed source java libs"
<Groogy> if there is enough debug information you can pretty much get the original source
<Groogy> but that extra step is usually "enough"
<RX14> i guess jokke
<RX14> yeah you're right
<RX14> there would be a procyon which would take a crystal AST and obfuscate it
<Groogy> like decompilers on C++ and C are so sophisticated nowdays
<jokke> RX14: :D
<RX14> oh procyon is a decompiler
<RX14> i forgot the name of that one java obfuscator
<RX14> darnit
<Groogy> there is also one for Ruby I remember
<Groogy> think there even exists for C/C++
<RX14> but then
<RX14> you could take the same obfuscator
<RX14> and serialise the obfuscated source to crystal source files
<RX14> and then you avoid the need for a stable binary AST format
<RX14> which means it's again pointless
<Groogy> oh right
<jokke> :)
<Groogy> the obfuscators for Ruby are the ones that make it into an exe
<RX14> ah yes but thats for obfuscating applications
<RX14> which is SUPER easy in crystal
<RX14> just add --release
<Groogy> yeah but that doesn't work for libs
<RX14> but neither does your link :)
<Groogy> no but just meant the one I was thinking of for Ruby
<Groogy> wasn't really what we were talking about
<jokke> RX14: i've noticed that --release sometimes (probably) optimizes too much, so that the app won't run correctly
<Groogy> I said "oh right" as in "ah crap"
<RX14> jokke, well then it's a bug
<jokke> same code works without --release
<jokke> yeah
<RX14> have you reported it?
<jokke> but it reminds me of gcc -O3
<jokke> :D
<Groogy> do you have a minimal example?
<jokke> no
<jokke> and no
<RX14> it doesn't optimise too much
<RX14> the problem is that the IR is wrong
<RX14> lol
<Groogy> I do remember an optimization bug which caused a constructor to completly break in Microsoft C++ V100 that just trashed the entire command list
<Groogy> that was a bitch to track down
<RX14> well at least i'd assume it's a crystal bug not a llvm bug
<Groogy> oh hey RX14, the TypeLiteral in a macro, that I put into a const array, does that after the macro run turn into the actual type I put in there?
<Groogy> i.e is it useful data after that point or is it just... "sometihng"?
<Groogy> i.e what happens to the AST data in the macro that I put into the array after that part of the compilation is done
<RX14> it expands i guess
<Groogy> so it would be WRAPPED_METHODS.first[0] # => the class that I got from @type
<Groogy> ?
<Groogy> or no idea
<FromGitter> <straight-shoota> yes, it should
<Groogy> ah if I try to access the constant then I get "Error in line 1: can't use underscore as generic type argument"
<Groogy> and as far as I know I have to use underscore to get the correct type for the tuple/array
TheGillies has quit [Ping timeout: 255 seconds]
krigare[m] has quit [Ping timeout: 246 seconds]
sija[m] has quit [Ping timeout: 240 seconds]
werthen[m] has quit [Ping timeout: 246 seconds]
braidn[m] has quit [Ping timeout: 246 seconds]
vegai has quit [Ping timeout: 255 seconds]
Lex[m] has quit [Ping timeout: 264 seconds]
thelonelyghost has quit [Ping timeout: 255 seconds]
davidbe[m] has quit [Ping timeout: 276 seconds]
MatrixTraveler[m has quit [Ping timeout: 276 seconds]
<FromGitter> <straight-shoota> you can use underscore only when the constant is used by macros only. when it is also accessed at runtime you need to specify a concrete type
<Groogy> and what type would that be so that it works both in runtime and macro when I provide it with a TypeLiteral?
<Groogy> since Class seems to be forbidden to use as a generic argument
<FromGitter> <straight-shoota> ah, right :/
<Groogy> don't really need it, just want to learn more
<Groogy> want to know every single in and out of the language
<Groogy> every single quirk ;D
<FromGitter> <straight-shoota> yeah
<FromGitter> <straight-shoota> I don't think it is currently possible
<FromGitter> <straight-shoota> You can use a specific class as type (like `CLASSES = [] of Foo.class`) but there of course is little value in that :D
jamesho287 has joined #crystal-lang
<Groogy> yeah, only reason I would use that for my contracts would be for debug information
<Groogy> like recording what class/function broke a contract etc
<Groogy> "toggle off the exception throwing but it still records broken contracts" kind of thing
<FromGitter> <straight-shoota> ok, so this would also work if you just save the class names as string
<Groogy> Yeah will probably figure out something
<Groogy> one array for macro info and one for simply runtime info
jamesho287 has quit [Client Quit]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
_whitelogger has joined #crystal-lang
MatrixTraveler[m has joined #crystal-lang
Philpax has quit [Ping timeout: 276 seconds]
MatrixTraveler[m has quit [Remote host closed the connection]
MatrixTraveler[m has joined #crystal-lang
<FromGitter> <straight-shoota> In Kemal is there a way to make path `/*` also match `/`? @sdogruyol
<FromGitter> <sdogruyol> nice question
<FromGitter> <sdogruyol> /** should match all routes including / but i'm not sure need to try first :)
<crystal-gh> [crystal] ysbaddaden opened pull request #4669: OpenSSL: use proper factories over direct allocation (master...cleanup-openssl-ssl-context-initializers)
<FromGitter> <crisward> @sdogruyol it doesn't.
<FromGitter> <crisward> Radix doesn't work like that, though I wish it did
<FromGitter> <crisward> Sure this could be made neater but it works. ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <renich> @hugoabonizio hey man, I am using scheduler. Bu, the main example, doesn't seem to work. Also, if I remove the exception handler, nothing happens. It just runs through it.
<FromGitter> <crisward> Kemal could have a method added to take multiple routes in an array, which would be nice ie. ⏎ ⏎ ```get [ "/", "/*" ] do |ctx| ⏎ "everything!" ⏎ end``` []
<FromGitter> <sdogruyol> @crisward PRs welcome for that :)
TheGillies has joined #crystal-lang
davidbe[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
vegai has joined #crystal-lang
Lex[m] has joined #crystal-lang
krigare[m] has joined #crystal-lang
thelonelyghost has joined #crystal-lang
werthen[m] has joined #crystal-lang
sija[m] has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hightower2 has quit [Ping timeout: 255 seconds]
<FromGitter> <renich> Hah! First issue reported on schedule ;)
baweaver is now known as baweaver_away
<FromGitter> <sdogruyol> @renich cool!
<jokke> @sdogruyol i was missing radix tree routes for websocket routes the other day in kemal
<FromGitter> <sdogruyol> @jokke really, how?
<jokke> it'd be cool if i could do sth like ws "/foo/:bar" do ...
<jokke> but i realized that it's not trivial
<FromGitter> <sdogruyol> @jokke that means a big change
<jokke> yes
<FromGitter> <sdogruyol> currently each websocket route is a different handler
<FromGitter> <sdogruyol> websocket lifecycle is different than http
<FromGitter> <renich> @sdogruyol :D
p0p0pr37 has quit [Quit: p0p0pr37]
p0p0pr37 has joined #crystal-lang
<FromGitter> <hugoabonizio> Hi @renich! Thanks for reporting, I saw your issue and I'm fixing it!
<FromGitter> <renich> @hugoabonizio you rock, man! :)
<FromGitter> <hugoabonizio> @renich Thank you! :)
<FromGitter> <hugoabonizio> hahaha
flaviodesousa has quit [Ping timeout: 255 seconds]
<FromGitter> <hugoabonizio> It seems that is having issues
<FromGitter> <hugoabonizio>
<FromGitter> <hugoabonizio> Error output ⏎ ⏎ /home/carcin/carcin/sandboxes/crystal/sandboxed_crystal0.22.0: error while loading shared libraries: cannot open shared object file: No such file or directory
<FromGitter> <straight-shoota> @jhass around?
mark_66 has quit [Remote host closed the connection]
<FromGitter> <renich> How can I retry within a begin/rescue statement?
<FromGitter> <renich> is there a retry keyword?
<FromGitter> <renich> btw, if you want to have a convenient google-chrome search for the Crystal docs, just add a custom search engines (right click bar > Edit search engines) and use this as URL: %s
<FromGitter> <renich> I use crdoc as keyword, so I can type: crdoc<tab>some search term
<FromGitter> <straight-shoota> take a look at this:
<FromGitter> <renich> @straight-shoota thanks! cool!
<FromGitter> <straight-shoota> for the search url you could also take `` which brings you directly to the doc page. ⏎ But it's not really a search, so you need to type the type name exactly.
<FromGitter> <renich> well, you can use %s
<FromGitter> <renich> this way, you limit google to search within that site
<FromGitter> <straight-shoota> yes, my suggestion does not include Google search, but takes you directly to the doc page instead
<FromGitter> <renich> hmm... it doesn't work well with latest... it worked fine with 0.23.0... odd
<FromGitter> <straight-shoota> depends on preference or what you require more, fast access to type docs where you know the name, or a fuzzy search in all the docs
<FromGitter> <renich> Well, maybe you're more familiar with the docs and the API. In my case, I still struggle to find File.write examples :D
<FromGitter> <hugoabonizio> I miss retry keyword too :pensive:
<FromGitter> <renich> @straight-shoota back to the retry thing... It is an RFC but not implemented yet, right?
<FromGitter> <straight-shoota> yeah, Google does not index paths in `/api/latest/*` because they're just redirects to the path where `latest` is replaces with the actual latest version
<FromGitter> <straight-shoota> So for the search, you need to skip the `/latest` and if you only want results from the latest version, replace it with `0.23` - you'll need to update this on subsequent releases
<FromGitter> <straight-shoota> correct, it is not implemented in the stdlib. But you can just copy the `retry` method from @lbguilherme's post to your codebase
AckZ has left #crystal-lang [#crystal-lang]
<FromGitter> <bararchy> How can I turn Array(Char) into a String ?
<oprypin> bararchy, .join
<FromGitter> <straight-shoota> wouldn't there be a more efficient way?
<FromGitter> <bararchy> .join is quite nice :)
<oprypin> straight-shoota, probably not. each char is a variable number of bytes. this operation has to be expensive
<FromGitter> <straight-shoota> yeah, right
<FromGitter> <renich> @straight-shoota yep, I can try that.
<FromGitter> <straight-shoota> ```code paste, see link``` []
<FromGitter> <straight-shoota> so it can be faster... but ugly
<FromGitter> <sdogruyol> wow
sagax has joined #crystal-lang
<oprypin> straight-shoota, that is incorrect behavior
<oprypin> >> chars = ['я', 'ї'];, chars.size))
<DeBot> oprypin: /home/carcin/carcin/sandboxes/crystal/sandboxed_crystal0.22.0: error while loading shared libraries: cannot open shared object file: No such file or directory -
<oprypin> right
<FromGitter> <sdogruyol> lol
<FromGitter> <bararchy> XD
<FromGitter> <sdogruyol> however join seems a bit slow
<oprypin> the result of that is "OW"
<FromGitter> <sdogruyol> 1) 65 microseconds per join
<FromGitter> <straight-shoota> yeah, this should only work with 8-bit characters
<FromGitter> <straight-shoota> @sdogruyol the absolute speed is very slow because of the VM where I am running the benchmarks
<FromGitter> <straight-shoota> Dunno why. If you try on your machine, it's probably gonna be much faster
<FromGitter> <straight-shoota> This is really odd... `.join` should be doing pretty much the same, yet is only half as fast ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <fridgerator> @oprypin I didn't exclude crsfml on purpose, I just searched crystalshards for 'game' and those are 2 that came up
<oprypin> fridgerator, huh but there are 21 results which include crsfml
<oprypin> bararchy, ` { |io| chars.each do |c| io << c end }` is the faster among the correct ways
<oprypin> but it's really rare to have an Array(Char) - are you sure that's what you have?
<oprypin> fridgerator, i'm curious about the "SEO" xD
<oprypin> oh wait, straight-shoota already wrote this
<FromGitter> <bararchy> oprypin I have an Array(Char) because it what I made :) it's a re-normalization of data back from the neural network
benner has left #crystal-lang [#crystal-lang]
<FromGitter> <straight-shoota> @oprypin do you have an idea why `` is twice as fast as `join`?
<oprypin> straight-shoota, join has 2n-1 operarations compared to build. a bunch of `io << ""`
<FromGitter> <straight-shoota> ah, because of `separator = ""`
<FromGitter> <straight-shoota> actually `io << separator if i > 0`
<oprypin> 2n-1
<FromGitter> <straight-shoota> yeah
<FromGitter> <straight-shoota> so this could easily be optimized for empty separator
splitty___ has joined #crystal-lang
splitty__ has quit [Ping timeout: 260 seconds]
splitty__ has joined #crystal-lang
splitty___ has quit [Ping timeout: 240 seconds]
<FromGitter> <straight-shoota> 2000 total shards on
<FromGitter> <hugoabonizio> :tada:
<FromGitter> <azzuwan> I'm really honestly want to know how you guys able to get involved in this like almost all the time. I barely have the time after work at the office. I am a bit jealous to be honest.
<FromGitter> <raydf> Hello everyone
<FromGitter> <raydf> How can i convert Array(JSON::Type) to Array(String)?
<oprypin> raydf, ` &.as(String)
<FromGitter> <raydf> @oprypin thanks
<FromGitter> <sdogruyol> @azzuwan it's all about being efficient i guess :P
<FromGitter> <sdogruyol> i'm working in a super busy startup + just got married
<FromGitter> <sdogruyol> yet somehow i figure out how to dedicate some time to Crystal :)
<FromGitter> <sdogruyol> @straight-shoota i was also waiting for this to announce on twitter, thank you :)
<FromGitter> <schoening> Pardon my ignorance but what happens if I set a property of a class to be a struct? Will that struct live in memory while the rest of the class lives on the heap?
<oprypin> schoening, think of it like this. by default data is stored contiguously with whatever other data is in the type. value types (e.g. structs) start off in the stack. a reference type (e.g. class) is always a pointer to the heap.
<oprypin> if a struct is inside a class, it means the class is a pointer to the heap, and the struct is stored in the heap contiguously with other data of the class
<FromGitter> <schoening> I think I get it. Because it got allocated the way it did its part of the heap memory because it's just part of the object? It gets malloc'ed like a struct in c would
<FromGitter> <schoening> @oprypin
<oprypin> i'm not sure
<oprypin> structs are stored "right here" and classes only store the pointer "right here", their data is always on the heap
<oprypin> "right here" is the stack by default
<oprypin> but once you've made the jump to the heap there's no going back to the stack
<FromGitter> <schoening> Ok. That "right here" explaination helped :p . If it wasnt obvious enough I have never had the option of stack and heap before :D
<FromGitter> <schoening> Thank you very much for the help
<oprypin> by the way malloc means get a pointer to newly allocated memory on the heap
<FromGitter> <schoening> gotcha
bjz has joined #crystal-lang
<crystal-gh> [crystal] chastell opened pull request #4674: Implement HTML.escape(string) in terms of HTML.escape(string, io) (
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <delef> Hi, help me with a union types, please. ⏎ ⏎ I have Hash(MapValue, MapValue)? ⏎ MapValue is alias: ⏎ alias MapValue = Nil | Bool | UInt16 | Int32 | UInt32 | Float32 | Float64 | String | Hash(MapValue, MapValue) | Array(MapValue) ... []
<oprypin> delef, hashtables should not store arbitrary data types. you will always get this kind of pain if you abuse them.
hightower4 has joined #crystal-lang
<oprypin> `{"city": {"geoname_id": 1277333, "names": {"de" => "Bengaluru", "en" => "Bengaluru", "es" => "Bangalore", "fr" => "Bangalore", "ja" => "バンガロール", "pt-BR" => "Bangalore", "ru" => "Бангалор"}}}`
<oprypin> suddenly you don't need any of the `.as`
<oprypin> i realize that you're probably meaning to work with a document-based database
<oprypin> in which case you don't have the option of using namedtuples
<oprypin> so you need to either deal with type casting pain or implement something like JSON.mapping
<FromGitter> <straight-shoota> for starters, you could alias the map type for example `alias MapType = Hash(MapValue, MapValue)` and use `MapType` (or whatever) instead of `Hash(MapValue, MapValue)`
<oprypin> i think it's totally fine.
<oprypin> delef, what's the problem you're getting with that code? looks great!
<FromGitter> <delef> Problem in the class result.
<oprypin> you must do the type casts as you're doing now, there is no other way
<oprypin> you're basically running into the same problems as - please carefully study all the options it provides, you need to pick one of them
<oprypin> they are: using type casts everywhere, or implementing JSON::Any, or implementing JSON.mapping
<oprypin> delef, you are getting runtime values and the compiler has absolutely no way of telling whether the thing you're calling right now is a Hash or an Int or anything else, you can't call [] on it, that's it :(
<FromGitter> <delef> it is a pain
<FromGitter> <delef> :(
<oprypin> that is what would allow nested traversal without casts
<FromGitter> <renich> guys, how can I write: "---\nfoo: bar" with YAML.builder? I am able to write: "---\nfoo:\n-bar" but this is not what I want...
<oprypin> renich, what data structure are you trying to represent with that? i dont get it
<FromGitter> <renich> @oprypin YAML
<oprypin> also does anyone actually bother with '---'
<Papierkorb> renich, those two YAML documents are not equivalent
<oprypin> foo: - bar would probably work
<Papierkorb> renich, the first one is a key `foo` with the value string `bar`, and the second is an array `foo` with only value being the string `bar`
<oprypin> oooh you want to *write* it
<FromGitter> <renich> Papierkorb: I know. I want to write the later
<oprypin> so it's just {"foo" => "bar"}
<oprypin> as opposed to {"foo" => ["bar"]}
<Papierkorb> renich, #sequence
<Papierkorb> renich, in there you're building an 'array'
<FromGitter> <renich> this is not what I want:
<FromGitter> <renich> It should be: content # => "---\nfoo: bar\n"
<FromGitter> <johnjansen> then why the sequence?
<Papierkorb> Just don't go into a sequence then:
<FromGitter> <straight-shoota> What's with the sequence?
<FromGitter> <straight-shoota> =)
<FromGitter> <renich> :D!
<FromGitter> <renich> And... can I pass it just a NamedTupple?
<Papierkorb> Do you already have a structure? Or do you want to build it from scratch?
<FromGitter> <renich> Papierkorb: didn't get it. I have a NamedTuple with to pairs inside.
<Papierkorb> `{ foo: "bar" }.to_yaml` will do what you want I guess
<FromGitter> <renich> Papierkorb: ah! Yes! Thanks.
<FromGitter> <johnjansen> seems like jumping right to YAML builder is a bit of a stretch, unless you really need to
bjz has joined #crystal-lang
<FromGitter> <renich> Ah, it didn't work. One of the members is JSON::Any
<FromGitter> <renich> @straight-shoota paying the price of inexperience and urgency... :S
<FromGitter> <renich> After this, I am gonna dive into it, I swear
<FromGitter> <renich> works now. Just added .to_s in the JSON::Any assignment
<oprypin> renich, you should call .as_* on JSON::Any
<FromGitter> <renich> changed it to .as_s
<oprypin> to_s is hacky
<oprypin> :)
<FromGitter> <renich> I am learning ;)
<FromGitter> <renich> Thanks oprypin
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hightower4> When using YAML::PullParser, can I somehow "peek" into the upcoming content, or if value can be of different types I need to read it as string and then test that string for certain properties and convert to appropriate object?
hightower4 has quit [Ping timeout: 255 seconds]
<oprypin> hightower4, please see
<oprypin> and keep in mind that there is no special treatment for numbers vs strings
<oprypin> it's either a string, a sequence, or a mapping
<oprypin> now, if you want to determine whether the upcoming thing is a string or a mapping, your question is still valid
hightower4 has joined #crystal-lang
<oprypin> btw never used pull parser and there are no docs, im just looking at source and guessing
bjz has joined #crystal-lang
<hightower4> oprypin, oh right, I was looking at Json's pullparser and expected that yaml had the same methods
<hightower4> Ok, that simplifies my task, thanks
<hightower4> so funny how devs have chosen "kind" instead of "type" or other more appropriate/less ambiguous word
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hightower4> Ok great, have it working, thanks
<hightower4> I would like the app to have a configurable database store (e.g. files, Pg, etc.). The choice is set in the config file. Where do I see examples of this modular/plugin architecture?
<oprypin> hightower4, don't know anything close to it
<oprypin> check out kilt, crystal-db
hightower4 has quit [Ping timeout: 260 seconds]