ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | 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
DTZUZO_ has quit [Ping timeout: 255 seconds]
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
FromGitter has quit [Ping timeout: 246 seconds]
FromGitter has joined #crystal-lang
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter> <iambudi> Just wondering if SO_REUSEPORT in server.listen(true) works on Sierra ? wrk test shows it does not make any differences wether use true or not.
<FromGitter> <iambudi> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59e9447ef7299e8f530c3802]
Kug3lis has joined #crystal-lang
<Kug3lis> That feeling then after ~2h of self-fking u manage to compile crystal on arm :D
<Kug3lis> Is there posibility to limit processes of crystal running then running make? because I ran into the problem that it runs and tries to fork but I have only 512mb ram and 8 cores so it tries to fork too much :D
<Kug3lis> apparently threads option is ignored by compiler...
<FromGitter> <faustinoaq> Kug3lis, Did you try `crystal build --no-debug --threads=1 foo.cr` ? Also Try to increase the swap memory at least 2GB
<Kug3lis> I am running make on crystal :)
<Kug3lis> P.S. I am running on really slow microSD card so swapping is out of question the whole system freezes
<Kug3lis> the problem is that it forks it's processes witch runs with over 200mb of ram...
<Kug3lis> it makes another copy of 200
snsei has joined #crystal-lang
jaitaiwan has quit [Quit: ZNC - 1.6.0 - http://znc.in]
jaitaiwan has joined #crystal-lang
<FromGitter> <faustinoaq> Kug3lis, Are you trying to compile Crystal using make on 512MB RAM ? sounds like a challenge 😅
<FromGitter> <faustinoaq> so many related issues here 👉 https://github.com/crystal-lang/crystal/search?utf8=%E2%9C%93&q=memory&type=Issues
<Kug3lis> I gave up as I already had compiler crystal bin :D
<Kug3lis> i mean I understand it works fast in normal environments :D but still I want to run it on 256MB :D
jaitaiwan has quit [Client Quit]
<FromGitter> <faustinoaq> Kug3lis, Do you want to compile crystal programs using 256MB of RAM ? I think is pretty possible, maybe you need to use some tricks, I remember codepinic (https://github.com/codepicnic) had environments running crystal on 256MB
<Kug3lis> no no I am will be just running in 256MB already compiled :D
<Kug3lis> P.S. I am building now another schematic with freaking 4GB ram :D fuck this shit :D
jaitaiwan has joined #crystal-lang
<FromGitter> <fridgerator> after compiling, the ram usage is really minimal
<FromGitter> <fridgerator> I like to use docker to compile locally and deploy the binary
<Kug3lis> yep thats why I going with Crystal...
<FromGitter> <faustinoaq> Kug3lis, Yeah, memory footprint is very minimal
<Kug3lis> doesnt apply for me :D I am running Crystal on this badboy friendlyarm.com/index.php?route=product/product&product_id=197
<Kug3lis> ok I am going to the bed... 3:40AM here...
Kug3lis is now known as Kug3lis_off
<FromGitter> <faustinoaq> Good night! 😴
<FromGitter> <faustinoaq> > Just wondering if SO_REUSEPORT in server.listen(true) works on Sierra ? wrk test shows it does not make any differences wether use true or not. ⏎ ⏎ @iambudi Did you try launching more processes? ⏎ ⏎ ```for i in $(seq 1 $(nproc --all)); do ⏎ ./server & ⏎ done ⏎ ⏎ wait``` [https://gitter.im/crystal-lang/crystal?at=59e964fa5c40c1ba79c266db]
<FromGitter> <faustinoaq> Try ☝️
snsei has quit [Remote host closed the connection]
jaitaiwan has quit [Quit: ZNC - 1.6.0 - http://znc.in]
jaitaiwan has joined #crystal-lang
jaitaiwan has quit [Client Quit]
jaitaiwan has joined #crystal-lang
jaitaiwan has quit [Quit: ZNC - 1.6.0 - http://znc.in]
jaitaiwan has joined #crystal-lang
DTZUZO_ has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
DTZUZO_ has quit [Read error: Connection reset by peer]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<FromGitter> <Rinkana> I have three different code styles for one method. What would be the preferred method that also keeps performance in mind: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59e9971f614889d475d9b46f]
flaviodesousa has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest65906
mark_66 has joined #crystal-lang
<FromGitter> <iambudi> > > @iambudi Did you try launching more processes? ⏎ ⏎ ```for i in $(seq 1 $(nproc --all)); do ⏎ ./server & ⏎ done ⏎ ⏎ wait``` ⏎ ⏎ Well, i open 4 terminal tabs and each runs ./server ... [https://gitter.im/crystal-lang/crystal?at=59e9a280614889d475d9f18b]
<FromGitter> <iambudi> I have 4 cpu cores.
claudiuinberlin has joined #crystal-lang
alex`` has joined #crystal-lang
Guest65906 has quit [Read error: No route to host]
Ven_ has joined #crystal-lang
fiete is now known as xfiete
xfiete is now known as fiete
jokke is now known as portwolf
<FromGitter> <Papierkorb> @Rinkana, All of them will perform the same. They could have differing error margins though. With that, I'd prefer the first method if `DEG2RAD` isn't useful for anything else.
portwolf has quit [Disconnected by services]
jokke has joined #crystal-lang
jokke is now known as mac_mario
<FromGitter> <Papierkorb> @Rinkana, however you can check it yourself using the `Benchmark` lib (Bundled with the stdlib: `require "benchmark"`). Make sure to test with a `--release` build
mac_mario is now known as jokke
jokke is now known as Luyin
Luyin is now known as jokke
<FromGitter> <Papierkorb> @Kug3lis, those nano pi's look interesting. No idea for what, but interesting
Kug3lis_off is now known as Kug3lis
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven is now known as Guest16823
<FromGitter> <montychen> it is a bug of array
<FromGitter> <montychen> it is a bug of Array ` ary = Array.new(3, [1]) ⏎ ary # => [ [1], [1], [1] ] ⏎ ary[0][0] = 2 ⏎ ary # => [ [2], [2], [2] ] ` ary should be [ [2], [1], [1]] , but the result is [ [2], [2], [2] ] [https://gitter.im/crystal-lang/crystal?at=59e9ae96614889d475da2fa7]
<FromGitter> <montychen> it is a bug of Array ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ ary should be [ [2], [1], [1]] but the result is [ [2], [2], [2] ] [https://gitter.im/crystal-lang/crystal?at=59e9af3801110b7231dbf819]
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<FromGitter> <Papierkorb> @montychen Not a bug. You pass in the array there by reference. All objects inside that new outer array point to the same array object.
<FromGitter> <Papierkorb> Use the yielding version of `Array#initialize` to return a unique array for each
<FromGitter> <montychen> 3Q!
<FromGitter> <montychen> thanks
Kug3lis is now known as Kug3lis_off
<FromGitter> <iambudi> @faustinoaq Tried with shell script you provide. It's slower around 30% than without using it. Wierd.
jaitaiwan has quit [K-Lined]
_whitelogger has quit [K-Lined]
_whitelogger has joined #crystal-lang
Guest16823 has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
flaviodesousa has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Ven is now known as Guest83993
Guest83993 has quit [Client Quit]
<crystal-gh> [crystal] RX14 closed pull request #5150: AST: fix incorrect `to_s` for ImplicitObj (master...bug/4289-implicit_obj_to_s) https://git.io/vddLk
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vddpn
<crystal-gh> crystal/master 6c9c851 Ary Borenszweig: Playground: missing instrumentation of HashLiteral (#5147)
<crystal-gh> [crystal] RX14 closed pull request #5149: Compiler: don't type generic type instance var initialization on non-instantiated generics (master...bug/4291-generic-type-initialization) https://git.io/vddfu
Ven_ has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jfontan has quit [Remote host closed the connection]
jfontan has joined #crystal-lang
jfontan has quit [Remote host closed the connection]
jfontan has joined #crystal-lang
<travis-ci> crystal-lang/crystal#6ee6bd2 (master - Compiler: don't type generic type instance var initialization on non-instantiated generics (#5149)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/290387068
<DeBot_> https://github.com/crystal-lang/crystal/pull/5149 (Compiler: don't type generic type instance var initialization on non-instantiated generics)
<FromGitter> <Qwerp-Derp> Yee, used the `abstract` keyword for the first time!
<FromGitter> <Qwerp-Derp> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59e9d6a0b20c6424292742b3]
<FromGitter> <Rinkana> I've made a benchmark for the style tests. It seems that `angle * {{Math::PI / 180}}` is the fastest: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59e9d6e032e080696e039779]
<FromGitter> <Papierkorb> What's your code? How did you run it?
Ven has joined #crystal-lang
Ven is now known as Guest21513
Ven_ has quit [Read error: Connection reset by peer]
<FromGitter> <krypton97> Benchmarks module
<FromGitter> <krypton97> The third version has a small stack allocation, which is not needed
<FromGitter> <Rinkana> Full source can be seen here: https://play.crystal-lang.org/#/r/2xhx if you want to test it on your computer
Groogy2 has joined #crystal-lang
<FromGitter> <sdogruyol> yo @RX14 have you ever thought of migrating crane to crystal-community e.g
<crystal-gh> [crystal] asterite opened pull request #5151: Semantic: before setting a number as free variable, check if exists with a different value (master...bug/2699-static-array-restriction) https://git.io/vdFf5
<jsn-> asterite, oh btw, apparently your patch (StaticArray) improves the time of switch version by 8 seconds, tail-call version by ~2 seconds; do you have any clues as to why it might be so, by chance?
<FromGitter> <sdogruyol> which patch?
claudiuinberlin has joined #crystal-lang
<jsn-> just a little fix to my useless microbenchmark
claudiuinberlin has quit [Client Quit]
<FromGitter> <sdogruyol> ah an interesting repo
<FromGitter> <sdogruyol> how's your road trip with Crystal so far @jsn?
<FromGitter> <sdogruyol> hope you liked it
<FromGitter> <asterite> jsn-: llvm knows the size of static array (can't change) so probably can optimize it better. In go I see you also use the same type
<jsn-> sdogruyol, yeah, i like it alot so far
<RX14> @sdogruyol not until it's finished lol
<jsn-> asterite, yeah, i understand how it works, but why the speed up is different with different dispatch -- that's what puzzles me
<RX14> i.e. never
<FromGitter> <sdogruyol> @asterite is this introduce any overhead to current object model https://github.com/crystal-lang/crystal/issues/2733
<FromGitter> <sdogruyol> introducing*
<FromGitter> <sdogruyol> @RX14 lol
<FromGitter> <asterite> jns-: it's different code, I doubt it will compile to the same thing, but I don't know
<FromGitter> <asterite> sdogruyol: I don't know. But it's not a bug, just a feature
jfontan has quit [Quit: The Lounge - https://thelounge.github.io]
<Groogy2> actually on the Object type reference issue. I would kind of prefer it to not allow Object
<Groogy2> but the other types yeah definetly
Groogy has quit [Disconnected by services]
<RX14> Object has some real valid usecases but it can be abused a lot too
<FromGitter> <sdogruyol> yeah, that feature would simplify using data structures in a great way
Groogy2 is now known as Groogy
<crystal-gh> [crystal] asterite opened pull request #5152: Docs: don't link libs or types inside libs (master...bug/3072-docs-dont-link-libs) https://git.io/vdFUK
<RX14> placing objects in datastructures is often not what you want
Groogy_ has joined #crystal-lang
<Groogy> I mean I would be fine with Reference and Value as the lowest you could reference
<FromGitter> <sdogruyol> not just objects
<FromGitter> <sdogruyol> I meant for generics e.g
<FromGitter> <asterite> I think the way it's done in Go is the best way. interface{}, casting, and good (although probably slow) reflection
<Groogy> if you need to be able to hold any kind of data, I would probably just use generics
<Groogy> which I already kind of do
claudiuinberlin has joined #crystal-lang
<FromGitter> <sdogruyol> Crystal with interfaces, sounds interesting :P
<FromGitter> <sdogruyol> I also agree that Go has done a great job on interfaces though
<Groogy> you can do var : Enumerable right?
<FromGitter> <asterite> No, you can't
<FromGitter> <sdogruyol> no @Groogy
<RX14> why not?
<RX14> its just a module
<Groogy> that would be great though
<RX14> oh wait, Enumerable(T) you can surely
<Groogy> yeah but it won't check "oh Foo includes Enumerable" is my guess
<FromGitter> <asterite> it's generic
<Groogy> I meant in an argument
<FromGitter> <asterite> I think you can do `var : Enumerable(Int32)`
<FromGitter> <asterite> but you don't want to know how is that implemented (nor how generics are implemented)
<RX14> Groogy, you can do anything in an argument
<RX14> you can do foo : object in method args
<Groogy> var : Enumerable(Array(Int32))
<Groogy> that works
<RX14> @asterite I think adding go-style interfaces would not fit in crystal though
<RX14> plus doesn't that approach really affect the amount of safety you can get?
<RX14> I struggle to find much use of storing say Hash(String, Object) outside being able to add arbitrary metadata to say HTTP::Handler
<RX14> for things like an ECS you can just make the components include a module
<RX14> i've never really wanted to store arrays of objects
<Groogy> lol someone implemented go-style interfaces in C++
<Groogy> I don't know about Go but that's interesting way to implement stuff
<Groogy> he makes everything function pointers when he doesn't need to, but it's pretty cool
<FromGitter> <asterite> Yes, I guess for now you can use the "define a module and include it in the types you want" trick
<RX14> @asterite but i find it hard to find cases where that's not a good idea anyway
<FromGitter> <sdogruyol> that's not so obvious and not user-friendly at all
<RX14> because with an entity in an ecs you'd want to have some guarantees like perhaps it has a name
<RX14> it's not common either
<RX14> you can use Object to avoid learning the type system and how to write clean crystal code
<FromGitter> <asterite> what's ecs?
<RX14> entity component system
<FromGitter> <sdogruyol> @RX14 you got your point there but not everyone wants that. Sometimes it's get things done
<FromGitter> <Papierkorb> The language shouldn't help you write shit code. But it shouldn't restrict those who know what they're doing either.
<FromGitter> <sdogruyol> ^
<RX14> the problem is i struggle to find an example of when you'd want that when you know what you're doing
<FromGitter> <sdogruyol> it shouldnt get in your way (ever).
Guest21513 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> that's why I love Ruby at first
<FromGitter> <Papierkorb> But I've also seen too many permanent temporary shit solutions already
<RX14> there's also the practicalities to consider
<FromGitter> <sdogruyol> @RX14 not everyone knows as much as you do
<FromGitter> <sdogruyol> that's for sure :P
<RX14> ok but what difference does that amke
<FromGitter> <Papierkorb> RX14, for me the real fix would be that a module of only abstract methods is automatically "inherited" by everything satisfying it
<FromGitter> <Papierkorb> Which is what you usually actually want
<RX14> if its impractical saying that people don't know it's impractical doesn't make it easier to implement lol
<RX14> i.e. Value types make no sense
<RX14> therefore Object is a union of Value and Reference
<RX14> Reference as a type would be OK
<FromGitter> <Papierkorb> @sdogruyol At least those who came here with awful "everything is a hash" code were eager to learn the correct way, and subsequently turned their code into reasonable code.
<RX14> but still the callsite dispatch impl would be messy
<RX14> and long
<RX14> and slow
<FromGitter> <Papierkorb> Yeah Reference and Value should be allowed, Object not really. That auto-heap-boxing would be arcane, it would turn the already non-obvious pass-by-value into a pass-by-dunno nightmare
<RX14> @Papierkorb with a language where you don't need to even define argument types i really don't like that idea
<FromGitter> <sdogruyol> @Papierkorb I'm also thinking about the ones who dont bother to come here or elsewhere and just stops using Crystal e.g
<RX14> you can't have a 100% retention rate
<FromGitter> <Papierkorb> @sdogruyol Sucks, but to be honest, if you didn't look for help (of any kind, not only this chat room), then you wouldn't accept help either, and wouldn't be happy in Crystal either
<RX14> if they can't figure it out and won't get help then what can we do?
<FromGitter> <Papierkorb> So, is it really a loss?
<RX14> I don't want to make the language worse to make it easier for beginners
<RX14> making the language easy for beginners is great
<RX14> but if you do that by using hacks it's bad for everyone
<FromGitter> <Papierkorb> That person will bonk their head at the next language too
<FromGitter> <sdogruyol> that's a possibility
<Groogy> also current way in how to solve it, wouldn't make it easier
<FromGitter> <Rinkana> And every language has it's quirks
<Groogy> it would make it a living nightmare
<FromGitter> <sdogruyol> however I wouldn't want that (as much as possible though)
<RX14> I created a kilobyte+ struct for interfacting with the SDP8 orbital prediction C code
<RX14> and you do NOT want Value being 2KiB long
<Groogy> honestly, the best is just to get really dedicted people right now until it is a state where it is viable for live productions
<Groogy> I mean there's early adopters but they are crazy :P
<FromGitter> <Papierkorb> Yes, as much as possible. I'm a huge fan of great documentation (Qt Project <3), good and (from the languages POV) logical structures, and so on. But truth is, if you don't want to grow, you accept stagnation, and that's fine, as long it doesn't become of our issues
<RX14> Papierkorb, check out this abomination: https://github.com/RX14/predict.cr/blob/master/src/predict/ext.cr#L10
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> that's a big.... struct
<Groogy> what library is that?
<RX14> sourcecode is in that github repo
<RX14> it's for orbital prediction Groogy
<RX14> it has a *lot* of parameters for the orbital model
<RX14> it always takes an Elset* though
<RX14> so it's not being moved around much if at all
FromGitter has quit [Ping timeout: 258 seconds]
<Groogy> huh cool
<Groogy> anyway back to writing gui code ^^
<RX14> its probably the second favourite library i've written
<RX14> after fast_irc.cr
claudiuinberlin has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest72916
<crystal-gh> [crystal] asterite closed pull request #5151: Semantic: before setting a number as free variable, check if exists with a different value (master...bug/2699-static-array-restriction) https://git.io/vdFf5
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vdFLg
<crystal-gh> crystal/master 4075f9c Ary Borenszweig: Docs: don't link libs or types inside libs
<crystal-gh> crystal/master 74a30e8 Ary Borenszweig: Merge pull request #5152 from asterite/bug/3072-docs-dont-link-libs...
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jfontan has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<Groogy> Is there a nice quick way to count how many occurances of an element is in an array?
<travis-ci> crystal-lang/crystal#74a30e8 (master - Merge pull request #5152 from asterite/bug/3072-docs-dont-link-libs): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/290427565
<DeBot_> https://github.com/crystal-lang/crystal/pull/5152 (Docs: don't link libs or types inside libs)
<Groogy> ah there now I found #count
<Groogy> was pretty sure it would exist but somehow my eyes skipped it in the list
<Groogy> hmm I am getting this error when my contract generates code:
echProton has joined #crystal-lang
<echProton> The compiler is written in Crystal, right?
<Groogy> Yeah the compiler is written in Crystal
<echProton> Stupid question, what compiled the compiler?
<Groogy> it originally wasn't written in Crystal
<Groogy> i.e older versions of the compiler can compile the new version and as such the development goes forward. It's pretty common
<echProton> Thank you
<Groogy> anyway the code that fails to compile for me: https://pastebin.com/TF8UnJyW
<Groogy> I can't see where the "unterminated parenthesized expression" occur
<pabs> Groogy: self.contract_ensures_parent=(return_value, foo)
<Groogy> :/
<Groogy> hmm then I need to generate the code somehow bit differently...
echProton has quit [Ping timeout: 260 seconds]
Guest72916 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DissonantGu1le has joined #crystal-lang
<Groogy> there we go
DissonantGuil3 has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest33067
gcds has joined #crystal-lang
<Groogy> hmm why do I get macro must be defined before this point but is defined later, when I am including the module defining it before that point :/
<Groogy> oh I'm dumb nvm...
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<RX14> Groogy, https://crystal-lang.org/api/0.23.1/Enumerable.html#count%28%26block%29-instance-method
<RX14> actually youw ant the one below
Guest33067 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> yeah I found it
<gcds> Maybe someone has hidden plugin or editor with nice autocompletion for Crystal? :D After working with JetBrain IDE's its hard to work with Crystal :D
<Groogy> VS Code with Faut's plugin
<gcds> hmm vs code
<Groogy> supports debugging, symbol lookup and everything
<Groogy> VS Code is like one of the few hidden gems made by microsoft
Ven_ has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<Groogy> RX14 you know if there is a insert_sorted or something like that?
<RX14> i dont think so
<RX14> i had to do it manually
<Groogy> hmm dang
<RX14> using a bsearch and an insert call
<RX14> i have code tho
<RX14> just a sec
<Groogy> I want to cache shapes for my widgets and not store a reference back to the widget (could use WeakRef but don't wanna overuse it)
<Groogy> and was thinking of using the object id as a good way to sort things in the array and then do binary search
<RX14> PR welcome :)
<Groogy> arr.insert val { search method } that wouldn't be too weird right?
<RX14> ??
<Groogy> I mean if I do a PR to add sorted insert to array
<RX14> but why
<RX14> why not just sorted_insert
<Groogy> well yeah name isn't important meant the signature
<RX14> oh you mean like
<RX14> arr.sorted_insert(item) { |x| item.foo <= x.foo } ?
<Groogy> yeah
<RX14> yeah looks good
<RX14> wouldn't it make sense to provide overloads to bsearch_index, and sorted_insert which don't take a block
<Groogy> how do you mean?
<Groogy> on the first one
<RX14> for example they just compare x
<RX14> like
<RX14> bsearch_index(foo) == bsearch_index { |x| foo <= x }
<RX14> actually
<RX14> no
<Groogy> ah you mean just when it's just comparing primitive values right?
<RX14> well anything that implements <= surely
<RX14> sortable things implement <=>
<RX14> which means they implement <=
<RX14> perhaps bsearch_by too
<RX14> bsearch_by(item, &.foo) == bsearch { |x| item.foo <= x.foo }
claudiuinberlin has joined #crystal-lang
<RX14> and similar versions for bsearch_index and the proposed sorted_insert
alex`` has quit [Read error: No route to host]
alex`` has joined #crystal-lang
<Groogy> beserch_by? where's that defined?
<RX14> in my mind
<RX14> it was a proposal
<RX14> i didnt make it clear
<Groogy> yeah, what would it do?
<RX14> well as I defined it
<RX14> above
<RX14> with that equivalence
<Groogy> I mean there is one for objects and not indexes
<Groogy> or what would be the difference?
<RX14> that it takes a block which maps x to what it sorts by
<RX14> instead of a block which returns true/false
<RX14> which is a bit ugly
<Groogy> ugh now time for specs, I am not good with making specs
<RX14> are you writing a PR?
<Groogy> yeah just forked
<Groogy> "inserts value at right place" is so.. dumb <_<
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<RX14> it "inserts value correctly"
<gcds> Groogy: but that extension does not support stdlib autocompletion right?
<RX14> why not gcds
<RX14> the stdlib is just crystal code
<gcds> Yeah but I try like HTTP:: cmd + space and nothing much appears relevant
<Groogy> eh problem is only that it doesn't know where the crystal code is
<RX14> did you require "http"
<Groogy> but I think you can configure that where to look
<gcds> Groogy oh yeah makes sense :D I though it would use CRYSTAL_PATH
<RX14> it does, surely
<RX14> if it doesn't it's dumb
<RX14> i;ve never used it
<RX14> surely just it looks at the actual symbols that are in your namespace
<RX14> i.e. have been required
<RX14> and it surely uses the standard require method
<gcds> hmm I just looked over configuration but nothing mentions paths or etc of src
<RX14> perhaps it doesn't look at `crystal env CRYSTAL_PATH`
<RX14> gcds, you did require "http" right
<RX14> ??
<Groogy> well just ask Faust if it does
<Groogy> eh don't remember his full gitter name but find it and just do @ him
<Groogy> also I am screwing up here with blocks, I want to provide a blockless variant of the function but I donno what I am fucking up xD
<RX14> well
<RX14> its just stupid then gcds
<gcds> oh well its not like I expected much :D
<gcds> ok now the stupid question, how I can pass a object method as callback I forgot
<Groogy> &.method
<Groogy> ?
<gcds> hmm so when why I get wrong number of arguments for 'yyy#xxx' (given 0, expected 1)
<Groogy> I think it is @faustinoaq ?
<Groogy> maybe
<gcds> do I need provide which kind of argument it will get?
<Groogy> @faustinoaq gcds have a question for you
<RX14> oh wait
<RX14> this isn't the language server is it
<RX14> this is just using crystal tool?
<gcds> I guess
<RX14> thats weird then
<RX14> it should complete just fine
<gcds> nvm, so how I should pass an method instead of block? I tried &object.method but I gent wrong argument number error
<RX14> what are you trying to do in long block syntax
<RX14> and then i'll tell you the shorthand )if any)
<gcds> mm?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> what are you trying to do in block syntax?
<gcds> long story short: I want to set my class method to be called in HTTP::WebSocketHandler &proc
<Groogy> hmm trying to pass a block to bserach_index is not going as I want it to :/
<RX14> oh
<RX14> gcds, like HTTP::WebSocketHandler.new { |ws, ctx| foo(ws, ctx) } ?
<RX14> there's not really a shorthand for that
<gcds> yeah
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gcds> ahh ok
<Groogy> alright PR almost done, just gotta write documentation, read through guidelines and then I'll push and ask for a pull request
<jsn-> btw, I think I was able to make crystal compiler die with something like stack overflow on proc type inference recursion
<jsn-> but i don't have any way to reproduce it at the moment
<RX14> procs dont really have type inference?
<RX14> like you have to specify the argument types
<RX14> so what do you mean
<Groogy> they don't but you can work around it with some pretty code
<Groogy> you can have other things do the type inference for you
<jsn-> RX14, isn't e.g. return type infered?
<Groogy> it depends on use case though etc.
<RX14> yeah, can be
<RX14> i think
<gcds> hmm, what I am doing wrong then defining type?
mark_66 has quit [Remote host closed the connection]
<RX14> gcds, needs more context
<RX14> like
<RX14> it needs a larger code snippet
<gcds> I was defining @proc type as this @proc : Proc(HTTP::WebSocket, HTTP::Server::Context) like any other class instance variable
<crystal-gh> [crystal] Groogy opened pull request #5153: Implemented #sorted_insert for Array using binary search. (master...sorted_insert) https://git.io/vdFaS
<Groogy> there, hopefully it ain't completley shit
<RX14> gcds, well surely something around it is messing up the parser
<RX14> i need a full snippet
<gcds> wtf, I deleted that file and tried to replicate the same code works now...
<Groogy> there was probably someething you missed
<gcds> maybe
<RX14> Groogy, you use insert in the examples lol
<Groogy> oh lol dang it xD
<RX14> it's called sorted_insert
<Groogy> yeah crap copy paste error
<RX14> Groogy, you don't need the &block and typically we leave it out
<Groogy> just need to squash the commit I guess and force push it up again
<Groogy> eh when I tried I needed it because of the overload?
<RX14> you use yield
<RX14> it detects automatically
<Groogy> ah right alright
<Groogy> write all of it in the pull request so I don't miss anything
<RX14> Groogy, isn't it before the lowest index where the block returns true for the doc
<Groogy> no, it is highest index you return true for, and lowest index you return false for
<Groogy> I guess?
<Groogy> Your code was doing it backwards I believe the one you showed
<RX14> looking at your example
<RX14> x.size >= var.size
<RX14> going from the left
<Groogy> you insert 2, means 1 returns true while 3 returns false
<RX14> x.size == 1
<RX14> var.size == 2
<RX14> 1 >= 2 # => false
<RX14> the block returns false
<RX14> surely it should be inserted at index 0
<RX14> its confusing to me too lol
<Groogy> inserting 2 will give us that 1 >= 2 is false, yeah and 3 => 2 is true
<Groogy> hmm so I wrote it reverse way around (I tried to keep it in line with how it was written in bsearch_index)
<RX14> Groogy, check your NTP
<RX14> you committed 2 hours from now
<Groogy> NTP?
<Groogy> oh
<RX14> network time protocol
<Groogy> crap windows screwed up the internal clock it seems
<RX14> i'm saying your UTC is broken
<RX14> yeah Groogy
<RX14> you can fix that
<RX14> there's an option on whether the bios RTC is in utc or local
<RX14> windows requires it local
<RX14> unix keeps it utc
<RX14> which is sane
<Groogy> there that should fix it
<RX14> but linux it's configurable
<RX14> and windows not
<Groogy> nah I should told linux to update from network
<RX14> so switch rtc to local and ntp sync
<Groogy> so they'll have to battle it out I guess
<RX14> well i'd do both to prevent it in the future
<Groogy> anyway back to the documentation text
<Groogy> so it should be "before the index where block returns true and after the index where the block returns false#
<Groogy> or hmm
<RX14> im confused
<RX14> is the bsearch_index doc wrong?
<RX14> oh no nvm
<RX14> it should be inserts before the first element where the passed block returns true
<RX14> and a `` See `Indexable#bsearch_index` ``
<Groogy> for the shorthand without a block: "# Insert *object* before the element where *object* is smaller than."
<RX14> no
<RX14> just say insert it in order
<RX14> or insert to preserve ordering
<RX14> also mention the array must be soreted constraint for both
<Groogy> "Array must be sorted or empty prior to invoking this method."
<Groogy> adding another spec as well
<Groogy> for empty array
<Groogy> is it okay to use #shuffle in the test? Since it uses a random generator donno if that would taint the global namespace or something
<RX14> no lol
<Groogy> no as in not okay right?
<RX14> no as in it's fine
<RX14> what could it taint?
<RX14> we seed the random generator from urandom
<Groogy> well since it is probably not random using noise you probably can't "go back" to where the DEFAULT random was
<Groogy> which means it's been modified between tests
<RX14> it's not between tests though
<RX14> it's in a test
<RX14> if we wanted a predictably seeded prng we'd make that a feature of the spec harness
claudiuinberlin has joined #crystal-lang
<RX14> and not make it so brittle that using it in an unsuspecting test would break everything
claudiuinberlin has quit [Client Quit]
<Groogy> there done ^^
<Groogy> should also be correct time stamp?
<Groogy> ah no it isn't dang it, I have to fix that
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<gcds> RX14 do remember my struggle of serialport stuff? Here is my lib https://github.com/aurimasniekis/serialports (I copied libserialport binding from Sija implementation) but still its not perfect because I tried to make it bit nicer because libserialport lib is not nicely done...
FromGitter has joined #crystal-lang
<oprypin> `Unhandled exception in spawn: SSL_connect: Success (Errno)`
<oprypin> aaaand the process keeps running
<oprypin> y u do dis crystal.
<Groogy> huh RX14 what is this error from travis? Formatting produced changes, is it just the formatting of the code?
<oprypin> Groogy, run crystal tool format
<oprypin> your code does not conform to that. bot runs format, sees changes and fails
<oprypin> one of the least helpful possible errors
<gcds> oprypin I think it's because STDLib so code formatting should match
<Groogy> oh wow it was literally a trailing whitespace in a comment xD
snsei has joined #crystal-lang
gcds has quit [Ping timeout: 240 seconds]
Kug3lis_off is now known as Kug3lis
gcds has joined #crystal-lang
<gcds> Wait is JSON.mapping only one way?
<oprypin> gcds, for my best guess of what you meant, no, it isn't
<gcds> ech, so it provides to deserialize but not serialzie oh well...
<Groogy> I don't use JSON mapping
<gcds> Groogy what do you use?
<Groogy> eh my kind of own wrapper around YAML
<Groogy> (which also has a mapping alternative)
<oprypin> gcds, what are you saying? i said it's not one way
<oprypin> and your remark confirmed my guess
<Groogy> ooooh I read it wrong what you said, I thought you said gcds as "is the only way"
<Groogy> nvm you most probably want JSON.mapping
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcds has joined #crystal-lang
snsei has quit [Remote host closed the connection]
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcds has joined #crystal-lang
<Kug3lis> freaking god spent like 5h today trying to figure out why Serialport does not want to write.... opened mode: READ...
gcds has quit [Quit: Textual IRC Client: www.textualapp.com]
Kug3lis is now known as gcds
<FromGitter> <paulcsmith> I'm working on some changes to the Heroku build pack where I need to `shards install`, but I can't figure out how to do it. When I try it I get `shards: command not found`
<FromGitter> <paulcsmith> Does anyone know how the build pack does it? https://github.com/crystal-lang/heroku-buildpack-crystal/blob/master/bin/compile
<FromGitter> <paulcsmith> I've gone through the whole repo and can't find how it installs the shards
<FromGitter> <crisward> @paulcsmith think it uses crystal deps, this is just an alias of shards install
<FromGitter> <paulcsmith> @crisward Ah you're right. Thank you :) I'll give that a shot
<FromGitter> <crisward> I've modified it quite a bit, updated the GC to actually give memory back to the OS after it's released from crystal.
<FromGitter> <crisward> I've also got a dev branch which runs sentry, for dev restarts. We use it with dokku.
<FromGitter> <paulcsmith> Cool! Checking out your fork now
<FromGitter> <paulcsmith> In mine I added the option to include a `crystal_post_compile` hook so you can optionally install other command line tools that rely on Crystal. In this case, the Lucky CLI
<FromGitter> <crisward> Some of the changes rely on pulling binaries from our website, so probably only useful to us. You should take a look at dokku if you haven't already. It allows you to create a self hosted heroku. We run it on 14 servers, very nice common deploy target. We have php, node and crystal websites running with it.
<FromGitter> <crisward> Actually I think we have a python too..
claudiuinberlin has joined #crystal-lang
<FromGitter> <paulcsmith> I really like the Heroku postgres features though. Auto backup, high availability, failover. All that jazz. If I don't need that, dokku looks sweet
<FromGitter> <paulcsmith> It uses heroku build packs right?
<FromGitter> <paulcsmith> Also Heroku review apps. So nice
<FromGitter> <crisward> Yes, it uses heroku buildpacks. It also has plugins for postgres, redis etc. Though you'd have to manage fail over yourself. We use the mysql dokku plugin with a million users a month website, so it can work at a reasonable scale. Though I completely understand giving that problem away.
kubaxvx has quit [Quit: WeeChat 1.6]
kubaxvx has joined #crystal-lang
<FromGitter> <paulcsmith> @crisward That's pretty sweet.
kubaxvx has quit [Client Quit]
<FromGitter> <paulcsmith> It looks like you made it so that the crystal binary is installed so you can call `crystal`, but I'm not sure where/how you did that. Could you point me to where in your fork you do that?
kubaxvx has joined #crystal-lang
kubaxvx has quit [Client Quit]
kubaxvx has joined #crystal-lang
<FromGitter> <crisward> It uses curl, pretty sure it creates a curl url from memory, the pulls it in from github.
<FromGitter> <crisward> After that I pull in our patched versions of libgc and libssh. The garbage collector has just been compiled with a flag to return memory to the server. I think libssh was a later version to get around some issues with the old one in the buildpack.
<FromGitter> <paulcsmith> Sweet. Thanks!
<FromGitter> <crisward> We usually use the no-release branch, it's the same without the --release flag. For web apps the added compile time of release isn't always worth the wait. The performance is quicker, but the latency online means a 3ms quicker response time is unnoticeable. I think it'd be worth it on high traffic sites, but we're only using crystal on small scale projects until it's post v1.
<FromGitter> <paulcsmith> Interesting point. Release definitely takes awhile :P
<FromGitter> <crisward> I think it was crystal 0.22 which forced the issue, the build pack was broken for that version as with --release it sometimes never compiled. It was an LLVM bug which was updated in 0.23.1
<FromGitter> <crisward> Looking forward to the next version. A ton of stuff has been updated and bugs squashed. Seems to be slow to arrive, pretty sure they closed all the tags issues a few weeks back.
kubaxvx has quit [Quit: WeeChat 1.6]
snsei has joined #crystal-lang
kubaxvx has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
kubaxvx has quit [Quit: WeeChat 1.6]
snsei has joined #crystal-lang
<Groogy> there isn't a macro that let's you delete an already defined method right?
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<oprypin> that's not the right terminology, and no, there isn't anything like that
tompaw has joined #crystal-lang
tompaw has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
<FromGitter> <krypton97> nice work with the sdl2 crystal bindings, got it working from first try
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <krypton97> I don't know if the team improved the compilation speed or it's because of the c bindings, but it's seems to build much faster
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <asterite> I guess it's because of the c bindings
<FromGitter> <asterite> Hmmm... I just realized recursive aliases are totally useless. We can remove them from the language :-)
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Groogy has quit [Quit: WeeChat 1.9]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<crystal-gh> [crystal] maxpowa opened pull request #5154: Allow chaining Array methods (master...array-reject-compact-select-chaining) https://git.io/vdbII
baweaver is now known as lemur
lemur is now known as baweaver
<FromGitter> <asterite> If you are interested to know why, I just created https://github.com/crystal-lang/crystal/issues/5155
<FromGitter> <paulcsmith> I'm having a bit of trouble running a crystal program on Heroku. I get this strange error that I can't figure out: ````--: 1: --: cc: not found ⏎ Error: execution of command failed with code: 127: `cc "${@}" -o '/app/.cache/crystal/app-lib-lucky_web-src-run_macros-generate_asset_helpers.cr/macro_run' -rdynamic -lpcre -lm -lgc -lpthread /app/.heroku/crystal/src/ext/libcrystal.a -levent -lrt -ldl
<FromGitter> ... -L/usr/lib -L/usr/local/lib````
<FromGitter> <paulcsmith> Any ideas?
<FromGitter> <asterite> it seems there's no cc executable there?
<FromGitter> <paulcsmith> @crisward Did you ever run into this with your build pack ^
<FromGitter> <paulcsmith> Is cc a package that needs to be installed or something? I can't find anything on Google about it
snsei has joined #crystal-lang
<FromGitter> <asterite> cc is the c compiler
<FromGitter> <faustinoaq> > Is cc a package that needs to be installed or something? ⏎ ⏎ @paulcsmith Yeah, cc is an allias to a c compiler, you can try installing `clang` ot `gcc`
<FromGitter> <paulcsmith> Ah ok. I'll try that. Thanks for the tip :)
snsei has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] asterite opened pull request #5156: Detect recursive structs through tuples, named tuples and recursive aliases (master...bug/recursive-struct) https://git.io/vdbmq
<crystal-gh> [crystal] asterite closed pull request #5154: Allow chaining Array methods (master...array-reject-compact-select-chaining) https://git.io/vdbII
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<travis-ci> crystal-lang/crystal#7bbb400 (master - Merge pull request #5154 from maxpowa/array-reject-compact-select-chaining): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/290636641
<DeBot_> https://github.com/crystal-lang/crystal/pull/5154 (Allow chaining Array methods)
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <faustinoaq> > If you're a great programmer, they're going to make you that much greater, they're going to let you become a God, and live entirely in a universe of your own abstractions. ⏎ ⏎ http://onsmalltalk.com/languages-of-the-gods ⏎ ⏎ Interesting post [https://gitter.im/crystal-lang/crystal?at=59ea818132e080696e076c20]
<FromGitter> <funny-falcon> Hello, people.
<FromGitter> <funny-falcon> Could you tell, why there is a lot of visibility modifiers, but instance variables are accessed fluently? ⏎ `bin/crystal eval 'struct T; @a = 1; end; h=T.new; p h.@a'`
<FromGitter> <funny-falcon> How instance variable could be hidden from such direct access?
alex`` has quit [Ping timeout: 255 seconds]