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
<c-c> How is serialization of objects (instances) possible in crystal?
<c-c> ie. does it have 'marshal'
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <straight-shoota> c-c, in stdlib you can only use JSON or YAML for serialization
<FromGitter> <straight-shoota> there is also https://github.com/Papierkorb/cannon for binary serialization
<FromGitter> <iambudi> block
<c-c> I'm wondering how would a game state be saved in a crystal program
<c-c> I guess yaml might be a possibility
<c-c> or each object must implement their own serialization/de logic
<FromGitter> <straight-shoota> depends on whether you want a text or binary format...
<c-c> cannon looks convincing
<FromGitter> <straight-shoota> yep
<FromGitter> <straight-shoota> haven't used it yet, but it looks really great
<c-c> I suppose my future game will have objects or structs with bunch numerical values (logic is in separate process), but theres a lot of them, so I suppose binary
vikaton has joined #crystal-lang
lacour has quit [Read error: Connection reset by peer]
lacour has joined #crystal-lang
lacour has quit [Quit: Leaving]
gcds has joined #crystal-lang
latemus has quit [Ping timeout: 240 seconds]
latemus has joined #crystal-lang
latemus is now known as Guest18932
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
<FromGitter> <pnloyd> I take is `abstract @inst_var` is not a thing?
<FromGitter> <pnloyd> I suppose since directly instances vars is bad practice it wouldn't much much sense.
<FromGitter> <pnloyd> And other reasons.
gcds has joined #crystal-lang
<FromGitter> <pnloyd> Is is possible to write code that instantiates an instance of a generic type parameter? (e.g to some "default" value, like 0 or "")
<FromGitter> <pnloyd> I see there's `#zero` on num types I think that's what I wanted.
rohitpaulk has joined #crystal-lang
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jackivan88 has quit [Ping timeout: 240 seconds]
jackivan88 has joined #crystal-lang
duper has joined #crystal-lang
<FromGitter> <Rinkana> @c-c if you're still here, you might want to look into Groogy's rendering engine: https://github.com/Groogy/boleite And mine rendering engine: https://github.com/lirith-engine/lirith
vikaton has quit [Quit: Connection closed for inactivity]
<FromGitter> <ansarizafar> @asterite RX14 Check this https://www.youtube.com/watch?v=7rx9fSUG8H0 How V8 is optimizing GC
alex`` has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
sz0 has joined #crystal-lang
RickHull has quit [Quit: Page closed]
jackivan88 has quit [Ping timeout: 246 seconds]
claudiuinberlin has joined #crystal-lang
<FromGitter> <ansarizafar> Does Crystal provide native handlers for unhandled exceptions and sigfaults?
<Groogy> c-c wait you implementing concurrency using interprocess communication in Ruby?
<Groogy> Holy shit that has to be a living nightmare
<Papierkorb_> Groogy: Doing that right now. It's not really that bad.
<Papierkorb_> It mainly sucks because you have to use forks
<Papierkorb_> OTOH, hilariously enough, the benefits are that a crashing worker doesn't take your whole application down
<Groogy> Problem I am seeing with syncing a game state over IPC is going to be nightmarish hellish
<Papierkorb_> Groogy: IPC class based on pipe(2) and Marshal does wonders.
<Papierkorb_> Ah for gaming it's not useful
<Papierkorb_> of course
<Groogy> and the overhead of serialization and deserilization compared to threads
<Papierkorb_> But usually, such workers work for multiple seconds at a time, so it's not really an issue
<Groogy> I mean unless he has a sort of game where the different processes are increadibly independent from each other
<Papierkorb_> But then, you don't really write games in Ruby
flaviodesousa has joined #crystal-lang
<Papierkorb_> Maybe small scripts (I think RPGMaker used Ruby?), but not "everything"
<Groogy> Yeah but different use case
<Groogy> my experience in ruby, every second it involved iteration it would slow down the application a lot
<Groogy> eh don't know how to explain that better
<Papierkorb_> Ruby isn't useful for real-time stuff, nuff said
<Groogy> but my impression was whenever I added a Hash or Array it would have a cascading effect in my code to eventually mean everything is going to get slower
<Papierkorb_> Where "oh that 1ms" really worsens the user experience
<Papierkorb_> I'm really missing the fibers/channel from crystal in ruby though. would've made that ruby code here much easier
mark_66 has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <pnloyd> I'm just getting my first fibers experience and I'm becoming hooked.
<FromGitter> <pnloyd> So convenient.
<Groogy> Hmmm even if they aren't concurrent maybe I should use them for processing entities just to have an architecture that's a bit future proof
claudiuinberlin has joined #crystal-lang
<Papierkorb_> pnloyd, "Now how do I use select() .. No select .. how do I do this? ... It does it automatically?!"
claudiuinberlin has quit [Client Quit]
<FromGitter> <pnloyd> To many questions?
<Papierkorb_> pnloyd, Nah just basically how everyone starts out :)
<Papierkorb_> (Me included)
<FromGitter> <pnloyd> Ok because I have one and it's and like the other's it revolves around blocks
<FromGitter> <pnloyd> And iterators..
<Papierkorb_> Just ask?
<FromGitter> <pnloyd> I have such a method ⏎ ⏎ ```def i_yield_things ⏎ some_ary.each { |i| yield i }``` [https://gitter.im/crystal-lang/crystal?at=59f19209b20c6424294c4a85]
<FromGitter> <pnloyd> woops
<FromGitter> <pnloyd> I have such a method ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59f1926a614889d4750047a3]
<FromGitter> <pnloyd> somehow consume*
<Papierkorb_> What's the question?
<FromGitter> <pnloyd> Can I someone call reduce on items being yielded instead of using a block.. I think what I want is for `i_yield_things` to actually produce an iterator
<FromGitter> <pnloyd> But I don't know how to do that.
<FromGitter> <pnloyd> I want to reduce my yielded items.
<Papierkorb_> You can't, or rather, there's nothing in the stdlib to turn a yielding method into an iterator
<Papierkorb_> You can do that using channels and fibers, but the performance is quite bad. Nothing I'd generally advise
<Papierkorb_> In that case, collect the yielded items into an array first, and then post-process that
<FromGitter> <pnloyd> This is code in a simulation. :(
<FromGitter> <pnloyd> I'm worried doing that a thousand times every simulation step will be a bad performance hit.
<Papierkorb_> Two good-performance solutions: 1) provide an Iterator-returning version of your calculation, and then process that 2) Collect stuff into an Array first, process that later
<Papierkorb_> Depending on your workload, the array might kill it, or might turn out to not be that bad after all
<FromGitter> <Qwerp-Derp> What's the diff between `initialize` and `self.new`?
<Papierkorb_> pnloyd, I'd say, try the array solution first, as that's really easy. If it turns out to be too slow you can still refactor
claudiuinberlin has joined #crystal-lang
<FromGitter> <pnloyd> @Papierkorb Thanks I'll try building an array.
<Groogy> @Qwerp-Derp, one allocates memory and calls initialize on that memory, one just initializes the memory
<Papierkorb_> Qwerp-Derp, #initialize is what you generally provide. It sets up your instance. .new also allocates memory. Basically, `.new` calls `.allocate`, and then your `#initialize`
<Papierkorb_> Qwerp-Derp, you should rarely need to override `.new`. Haven't needed it once
<FromGitter> <Qwerp-Derp> Hmmm, it's just because I've seen it in the Crystal source code
<Groogy> hmm actually curious, how do the default initializers work? Is there a method in allocate that makes sure the default initializers are performed or is there some magic happening around #initialize?
<Papierkorb_> Groogy: #initialize is magic (@var checks), .new is auto-generated if you don't provide one.
<Papierkorb_> Well only magic w.r.t. doing additional checks. it's a normal method otherwise
<Groogy> yeah but I am just trying to grasp like
<Groogy> I define my own #initialize
<Groogy> where does the default initializer magic happen?
<Papierkorb_> the compiler provides one if it makes sense
<Groogy> in my #initializer method?
<Groogy> initialize*
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_> If you don't have an #initialize, and your object can be default constructed, an empty #initialize is provided
Ven has joined #crystal-lang
Ven is now known as Guest84182
<Groogy> I know but if I define one myself, where does it add the code to initialize the variables I don't in the initialize method but in the default initializer part
<Groogy> i.e is it done in allocate? If I do Foo.allocate -> will variables be initialized?
<Groogy> or does it inject the default initializers to every #initialize?
<Papierkorb_> I'd expect that to happen in #initialize before your code
<Papierkorb_> You could try, make the @var default value raise
<Papierkorb_> So, in #initialize
claudiuinberlin has joined #crystal-lang
<Groogy> cool
cyberarm has quit [Ping timeout: 248 seconds]
cyberarm has joined #crystal-lang
<Papierkorb_> Oh well, here we go swordfighting-on-office-chairs
<FromGitter> <sdogruyol> lol
<FromGitter> <bew> And Groogy : https://play.crystal-lang.org/#/r/2ys4
<FromGitter> <bew> So yes, it init the other vars before the initialize!
Guest84182 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gloscombe has joined #crystal-lang
<FromGitter> <Qwerp-Derp> Argh Crystal nil types are super frustrating
<FromGitter> <Qwerp-Derp> ```@display.listener.listen(mouse_pos) if (display = @display) && display.listener```
<FromGitter> <Rinkana> How so?
<FromGitter> <Qwerp-Derp> Both `@display` and `@display.listener` are nilable types
<FromGitter> <Qwerp-Derp> But none of them are caught in the `if` statement
<Papierkorb_> Crystal just prevented a race condition
<FromGitter> <Rinkana> Do they need to raise?
<FromGitter> <Rinkana> Because you can just just `.try` or if they need to raise use `.not_nil!`
<Papierkorb_> Try chain `@display.try(&.listener).try(&.listen(mouse_pos))` or one less try but with an `if var =`
<FromGitter> <Rinkana> And you have `(display = @dishcandanty )`
<FromGitter> <Rinkana> `(display = @display)`
<FromGitter> <Rinkana> Shouldent that be `(display == @display)`
<FromGitter> <Qwerp-Derp> So the final statement is ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59f1a2094ff065ac1879b632]
<FromGitter> <Qwerp-Derp> Is there any way to make this simpler?
<Papierkorb_> ... without the if
<FromGitter> <Qwerp-Derp> Oh yeah
<Papierkorb_> Please check up on `Object#try`
<FromGitter> <mvlootman> which require statement would I need to instantiate the Compiler class (e.g. compiler = Compiler.new ) ? ⏎ I am looking at the Crystal::Playground module and I don't see any specific require statements. ⏎ However I get an undefined constant Compiler
<Papierkorb_> iirc, "compiler/crystal"
<FromGitter> <bew> And it's probably `Crystal::Compiler`
<FromGitter> <mvlootman> the require "compiler/crystal" gives me Please use `make crystal` to build the compiler, or set the i_know_what_im_doing flag if you know what you're doing.
<FromGitter> <bew> Try `compiler/crystal/compiler`
<FromGitter> <mvlootman> that expands a few macros and gives me the error: undefined constant Program
<FromGitter> <mvlootman> the Playground module Crystal::Playground is inside the Crystal module under compiler is that the reason that works there (calling Compiler.new etc.)?
<FromGitter> <bew> Try `compiler/crystal/*` (but it's probably overkill)
<FromGitter> <bew> Or require `compiler/crystal/program` too
<FromGitter> <mvlootman> undefined constant LinkAttribute. ⏎ Should I be calling Compiler class directly?
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <mvlootman> I want to compile some (generated) crystal code, ofcourse I could shell the crystal executable instead of instantiating the Compiler directly
<FromGitter> <bew> Just require with * (see ex above)
<FromGitter> <mvlootman> I tried compiler/crystal/* but that gave the undefined constant LinkAttribute
<FromGitter> <bew> Ah x)
<FromGitter> <bew> Weird
<FromGitter> <mvlootman> also tried compiler/crystal/** that gave an error: /usr/bin/ld: /opt/crystal/embedded/lib/../lib/libgc.a(os_dep.o): undefined reference to symbol '_end' ⏎ //usr/lib/x86_64-linux-gnu/libffi.so.6: error adding symbols: DSO missing from command line ⏎ collect2: error: ld returned 1 exit status
<FromGitter> <mvlootman> that is why I was wondering if this is a valid/good approach
<FromGitter> <bew> I was about to suggest that (2 stars)
<FromGitter> <bew> I don't know.. i think you can report an issue on GitHub, it looks like a bug, but no idea why
<FromGitter> <mvlootman> I am not sure if its a bug or that I am doing it wrong 😄
<FromGitter> <bew> Does compiling the compiler works or do you get this error too?
gcds has joined #crystal-lang
<FromGitter> <mvlootman> I would need to try that, haven't done that before
<FromGitter> <mvlootman> perhaps there lies the problem
<FromGitter> <bew> I'd say, make sure your os is up-to-date too
<FromGitter> <bew> Your libs etc
<Papierkorb_> iirc, crystal itself also uses **, I don't see much wrong with doing it like that
<FromGitter> <mvlootman> i am running Crystal 0.23.1 [e2a1389] (2017-07-13) LLVM 3.8.1 not build from sources
<FromGitter> <mvlootman> i will build it from the master branch and see if that works
<FromGitter> <mvlootman> I get similar error running make
<FromGitter> <mvlootman> when installing the required libraries there are some errors
<FromGitter> <mvlootman> E: Unable to locate package libevent-core-2.0-5 and package libevent-extra-2.0-5 and libevent-pthreads-2.0-5
<Papierkorb_> sounds like your package index is outdated. `apt update`
<FromGitter> <mvlootman> apt update said no updates. I just upgraded to Ubuntu 17.10
<FromGitter> <yxhuvud> perhaps you removed third party srouces when upgrading? It is really irritating that it removes all the ppa's every time with no easy way to reenable thm .
<FromGitter> <mvlootman> apt-get install shows libevent-core-1.4-2 libevent-core-2.1-6 for libevent-core so that is newer than 2.0-5
<FromGitter> <mvlootman> @yxhuvud could very well be
<FromGitter> <mvlootman> ok make seems to work now (i missed installing bdwgc )
<FromGitter> <mvlootman> make ran without errors, it compiled crystal in the bin folder. however running it gave error : error while loading shared libraries: libgc.so.2: cannot open shared object file: No such file or directory. I think my lib versions are messed up
<Papierkorb_> make clean, make again
<FromGitter> <bew> Papierkorb, `make again` is not a valid target :P
<FromGitter> <mvlootman> make clean ⏎ make ⏎ when running ./build/crystal: ⏎ ./crystal: error while loading shared libraries: libgc.so.2: cannot open shared object file: No such file or directory [https://gitter.im/crystal-lang/crystal?at=59f1ad31e44c43700a7d27cc]
<Papierkorb_> Yup, you just wrecked your installation. Is your crystal binary built for a previous version of Ubuntu?
<FromGitter> <mvlootman> how can I tell?
<Papierkorb_> Maybe dpkg-query can tell you. I don't use Ubuntu though
<FromGitter> <mvlootman> running ldconfig solved the issue
flaviodesousa has quit [Ping timeout: 240 seconds]
Guest18932 has quit [Quit: leaving]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFJvb
<crystal-gh> crystal/master 4b75571 Johannes Müller: Add option `--output` to `crystal docs` generator (#4937)...
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFJfN
<crystal-gh> crystal/master 4d587a3 Max Gurela: Change properties key to _properties_ to reduce chance of conflict (#5180)
<FromGitter> <ansarizafar> Ruby written in go https://github.com/goby-lang/goby#documentation
<travis-ci> crystal-lang/crystal#4b75571 (master - Add option `--output` to `crystal docs` generator (#4937)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293083226
<DeBot_> https://github.com/crystal-lang/crystal/pull/4937 (Add option `--output` to `crystal docs` generator)
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <sdogruyol> that's not Ruby..
<FromGitter> <ansarizafar> Ruby like syntax
flaviodesousa has joined #crystal-lang
<travis-ci> crystal-lang/crystal#4d587a3 (master - Change properties key to _properties_ to reduce chance of conflict (#5180)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293086319
<DeBot_> https://github.com/crystal-lang/crystal/pull/5180 (JSON: Change properties key to _properties_ to reduce chance of conflict)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_> Why though? Was there someone who was fed up with Go so much they implemented basically-ruby?
<Papierkorb_> I mean getting to that point is no small feat, but what's the intended use-case?
claudiuinberlin has joined #crystal-lang
<Groogy> according to the github page
<Groogy> to write concurrent microservices
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #5057: Add time formatters for days with ordinal suffix. Includes specs and docs. (master...add_ordinal_date_formatters) https://git.io/vd3kG
Ven has joined #crystal-lang
Ven has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 258 seconds]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vFJnD
<crystal-gh> crystal/master fce8cba Ary Borenszweig: XML: missing forwarding of `variables` argument
<crystal-gh> crystal/master e602cd0 Ary Borenszweig: Merge pull request #5137 from asterite/bug/5063-xml-variables...
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
megalapa has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Client Quit]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#e602cd0 (master - Merge pull request #5137 from asterite/bug/5063-xml-variables): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293137636
<DeBot_> https://github.com/crystal-lang/crystal/pull/5137 (XML: missing forwarding of `variables` argument)
dannyAAM has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 258 seconds]
megalapa has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
dannyAAM has quit [Client Quit]
dannyAAM 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]
rohitpaulk has quit [Ping timeout: 248 seconds]
snsei has quit [Remote host closed the connection]
claudiuinberlin has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
Disrecollection has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
<FromGitter> <zyriuse75> do you know how to call crystal code with NUKLEAR https://github.com/vurtun/nuklear
<FromGitter> <zyriuse75> ?
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFJKs
<crystal-gh> crystal/master df3399f Michael Petö: Fix UNIXServer example in docs (#5181)...
gcds has quit [Remote host closed the connection]
gcds has joined #crystal-lang
<FromGitter> <bew> How to call crystal code with Nuklear? Or use Nuklear from Crystal code?
<FromGitter> <zyriuse75> 😄 i mean how to use nuklear fro crystal or Tcl/TK . sorry for the mistake :(
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vFJiy
<crystal-gh> crystal/master 4e079f9 Ary Borenszweig: Merge pull request #5184 from luislavena/restrict-type-on-http-params-encode...
<crystal-gh> crystal/master 488dda7 Luis Lavena: Avoid misleading error message in HTTP::Params.encode...
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
Disrecollection has quit [Quit: Leaving.]
<travis-ci> crystal-lang/crystal#4e079f9 (master - Merge pull request #5184 from luislavena/restrict-type-on-http-params-encode): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293208253
<DeBot_> https://github.com/crystal-lang/crystal/pull/5184 (Avoid misleading error message in HTTP::Params.encode)
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFJSh
<crystal-gh> crystal/master 844cc6e Johannes Müller: Add docs to expectations methods (#5092)...
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vFJ9m
<crystal-gh> crystal/master 54a7fc3 TSUYUSATO Kitsune: Fix to complete filename for `crystal tool` subcommands (#5158)...
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <bew> from Crystal you'll probably need to do a binding to the C library, so you can call code located in the Nuklear lib!
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> <bew> (I don't see why you're mentionning Tcl/TK, as a solution in one language is probably not applicable for another language)
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]
mark_66 has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#54a7fc3 (master - Fix to complete filename for `crystal tool` subcommands (#5158)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293235560
<DeBot_> https://github.com/crystal-lang/crystal/pull/5158 (Fix to complete filename for `crystal tool` subcommands)
<travis-ci> crystal-lang/crystal#844cc6e (master - Add docs to expectations methods (#5092)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293234495
<DeBot_> https://github.com/crystal-lang/crystal/pull/5092 (Add docs to expectations methods)
rohitpaulk has quit [Ping timeout: 248 seconds]
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jnerula has left #crystal-lang ["WeeChat 0.4.2"]
rohitpaulk has joined #crystal-lang
RickHull has joined #crystal-lang
gcds has joined #crystal-lang
gcds has quit [Quit: Textual IRC Client: www.textualapp.com]
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
Ven has joined #crystal-lang
Ven is now known as Guest6907
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gloscombe has quit [Quit: WeeChat 1.9.1]
rohitpaulk has quit [Ping timeout: 240 seconds]
Guest6907 has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
Ven_ has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vFUUl
<crystal-gh> crystal/master c5d8543 Luis Lavena: Avoid misleading error when using HTTP::Client form options...
<crystal-gh> crystal/master c79f437 Ary Borenszweig: Merge pull request #5185 from luislavena/restrict-http-client-form-hash-types...
linuksz has joined #crystal-lang
<linuksz> I have a problem with the following:
<linuksz> server: http://sprunge.us/gYSj
<linuksz> client: http://sprunge.us/aMFS
<linuksz> When I compile the server with the --release flag, it fails
<linuksz> Without --release, it sometimes works
<linuksz> What's wrong?
<travis-ci> crystal-lang/crystal#c79f437 (master - Merge pull request #5185 from luislavena/restrict-http-client-form-hash-types): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293294394
<DeBot_> https://github.com/crystal-lang/crystal/pull/5185 (Avoid misleading error when using HTTP::Client form options)
<FromGitter> <crisward> Could be this - https://github.com/crystal-lang/crystal/issues/4719 ?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <r3bo0t> Try with `—release —no-debug`
<linuksz> doesn't work
<linuksz> accept: Invalid argument (Errno)
<FromGitter> <r3bo0t> this normally happens, as for release mode crystal compiler takes long time to build it consumes too much memory on your server.
<FromGitter> <r3bo0t> “--release --no-debug"
Ven_ has quit [Ping timeout: 248 seconds]
<linuksz> but compiling other things with --release works
<FromGitter> <r3bo0t> when it takes quite long time to build some particular crystal service it fails on smaller VPCs
<linuksz> but it isn't at compile time
<FromGitter> <r3bo0t> and by default crytal builds with --debug true flag, which addons in memory consumption :)
<linuksz> it is a runtime exception
<FromGitter> <r3bo0t> as @crisward mentioned above as well
<FromGitter> <r3bo0t> go through that thread, it will really help you to understand the problem.
Ven has joined #crystal-lang
<FromGitter> <r3bo0t> Even I am very new to Crystal, so not countable for wrong assumption :P
Ven is now known as Guest20545
<FromGitter> <r3bo0t> @crisward @sdogruyol how to manage connection_pool for (crystal-db + crystal-mysql) from kemal application. ⏎ I keep getting `Exception: (DB::PoolTimeout)` after sometimes on my Kemal application ⏎ seems like I keep exhausting my connection pool :|
<FromGitter> <asterite> lunksz: can you try with master? it might be fixed there. Maybe it was this https://github.com/crystal-lang/crystal/pull/5059 (not sure)
Guest20545 has quit [Ping timeout: 248 seconds]
<FromGitter> <r3bo0t> @asterite how should be release db connection with `scalar` and `exec` commands in crystal-db?
Ven_ has joined #crystal-lang
<FromGitter> <r3bo0t> I can’t seems to find it anywhere
<linuksz> @asterite, doesn't seem do it would be the problem.
<linuksz> my laptop has 2GiB RAM, and a Core2Duo 1,8GHz cpu
<linuksz> how much time would it be to compile the compiler?
<FromGitter> <crisward> @r3bo0t I don't think you have to
<FromGitter> <asterite> You don't need to compile the compiler, just download the repo and set CRYSTAL_PATH to the `src` directory
<FromGitter> <r3bo0t> @crisward but I keep getting (DB::PoolTimeout) after using server for sometime
<FromGitter> <crisward> @r3bo0t Are you just using scalar and exec ? not query?
<FromGitter> <r3bo0t> and once I restart the server, it works like charm
<FromGitter> <r3bo0t> using query as well
<FromGitter> <crisward> query can hold onto connections, until you manually release them, depending on if you're using a block or not
claudiuinberlin has joined #crystal-lang
<linuksz> @asterite, it doesn't work with CRYSTAL_PATH set
<linuksz> 0.23.1 is installed on my system, and master has too much difference
<FromGitter> <r3bo0t> with query I am mostly using blocks only cc: @crisward
<linuksz> i have to compile the compiler
<FromGitter> <crisward> All your deps up to date?
<linuksz> how much time would it take?
<FromGitter> <r3bo0t> Yes, just update few hours back
<FromGitter> <crisward> Also mysql, postgres or sqlite?
<FromGitter> <r3bo0t> mysql (crystal-mysql)
<FromGitter> <asterite> linuksz you can report a bug, maybe someone can help you (I didn't see it happen on mac osx and that's all I have)
<FromGitter> <asterite> someone else reported the same issue some days ago, not sure it was you though
<linuksz> @asterite: the server code snippet works fully with --release flag?
<FromGitter> <crisward> I had an issue, when I had an sql error with the wrong fields would leak connections. I did a pull request which I think got merged.
<FromGitter> <r3bo0t> @asterite most of the Macs now a days run with 8GB of RAM and SSD (so even swap is very fast). In small VPC sometimes swap is actually not present.
<FromGitter> <r3bo0t> @crisward let me look into the same a bit more once. Thanks.
<FromGitter> <crisward> If you have any sample code, I don't mind taking a look
<FromGitter> <crisward> yep it was merged
<FromGitter> <crisward> When do you open your connection pool, when the server launches ?
<FromGitter> <ondreian> been a couple months since I've been able to work with Crystal, but did something change with the way `Macro#run` works? ⏎ I get a fairly uninformative error of: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59f239cbb20c642429504445]
<FromGitter> <r3bo0t> @crisward its not optimised yet :P
<FromGitter> <crisward> Looks ok, nothing obviously wrong. 😕
<FromGitter> <asterite> linuksz: yes, just compiled with --release on mac and it works fine
<linuksz> @asterite, what version do you use?
<FromGitter> <crisward> @r3bo0t where is `Repo` created ?
<FromGitter> <asterite> 1) 23.1
<linuksz> @asterite, released, or master?
<FromGitter> <r3bo0t> In `src/config/application.cr`
Ven_ has quit [Ping timeout: 240 seconds]
<FromGitter> <r3bo0t> `Repo = DB.open(ENV["DB_URI"]? || "mysql://root@localhost/database_name?initial_pool_size=5&max_pool_size=10&max_idle_pool_size=10"`
<FromGitter> <crisward> No db errors?
<FromGitter> <r3bo0t> no
<FromGitter> <asterite> linuksz released
<linuksz> so it is maybe a Linux issue
<linuksz> is it possible to use connectionless UNIX sockets?
<FromGitter> <r3bo0t> linuksz: if you compile the same code on linux machine with more RAM (say 4 or 8 GB) with good SWAP memory, it will work there too.
<FromGitter> <r3bo0t> I had the same issue on smaller EC2 instance, I tried the same on larger EC2 machine and it worked fine for me.
<FromGitter> <r3bo0t> @crisward for `query` is it the right approach, ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59f23cac210ac26920359d3e]
<FromGitter> <crisward> you shouldn't need the rs.close
<FromGitter> <crisward> it does that when the block ends
<FromGitter> <r3bo0t> hmm
<FromGitter> <crisward> I'd use Repo.query_all
<FromGitter> <r3bo0t> what about the `query_one?`
<FromGitter> <r3bo0t> I also used this at few places
<FromGitter> <crisward> If you only want one result use query_one?, again it closes itself.
<FromGitter> <r3bo0t> `user = Repo.query_one? "select rec_id, fname, lname, profile_img_url from user where rec_id=#{to}", as: {Int32, String | Nil, String | Nil, String | Nil}`
<FromGitter> <r3bo0t> something like this
<FromGitter> <r3bo0t> hmm okay
<FromGitter> <crisward> Should be fine. I use DB mapping for all my results, but it's the same principal
<FromGitter> <r3bo0t> okay, then I'm clueless for now :). will debug the same after break.
<FromGitter> <r3bo0t> thanks @crisward for your time.
<FromGitter> <crisward> No problem, leave me a message if you find it, always like to know about avoidable problems. 😄
<FromGitter> <r3bo0t> sure.
linuksz has quit [Ping timeout: 248 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest34872
rohitpaulk has joined #crystal-lang
<FromGitter> <ondreian> I tracked down the cached `macro_run` in `.cache/crystal`
<FromGitter> <ondreian> i think something got borked with my libraries, trying to sort through that now: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59f246e45a1758ed0f5321f4]
alex`` has quit [Quit: WeeChat 1.9.1]
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <unreadable> Why isn't crystal adopting the RAII design?
<FromGitter> <unreadable> I find it very easy and powerful in the same time..
<Papierkorb> RAII in the sense of immediate deallocation like in C++?
<FromGitter> <unreadable> yup
<FromGitter> <unreadable> Rust something like this
<FromGitter> <unreadable> When the class goes out of scope, it gets rid of it
<Papierkorb> quite powerful indeed. but there's not much that'd really really benefit from it
<FromGitter> <unreadable> Why? Getting rid of the GC wouldn't be better?
<Papierkorb> "Getting rid of GC" isn't easy. See Rust.
<Papierkorb> And what obstacles that brings
<Papierkorb> it dramatically influences the language design
<FromGitter> <unreadable> well, rust says it all
<Papierkorb> Rust is much harder to use because of that
<FromGitter> <unreadable> But would implementing the RAII design in crystal be hard?
<FromGitter> <unreadable> Rust lifetimes kills me
<Papierkorb> I once came from C++ to Ruby (well, and later Crystal), leaving my beloved RAII behind.
<Papierkorb> Honestly?
<Papierkorb> I never actually missed it after the first few months
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <unreadable> Fair enough
<Papierkorb> So, what are the use cases? 1) QDebug() was great: You do << and then after the statement ends, it gets output with on a new line. Great. But we have string interpolation, which is much easier to use 2) MutexLocker is great: Leave the method and it gets unlocked. Fantastic. But we have blocks, you could do e.g. `mutex.lock{ do something while locked }; not_locked_anymore_here`
<Papierkorb> RAII is a good concept in a language like C++, but we have many other language patterns which make other paradigms more useful overall
<FromGitter> <unreadable> `mutex.lock { ..code.. }` seems to clean comparing to go wow
<Papierkorb> That pattern is already used all over crystal outside mutexes :)
<Papierkorb> E.g., for database transactions.
<Papierkorb> `db.transaction{ do; something; in; the; transaction }` <- ROLLBACK if any exception was thrown, COMMIT otherwise. Can't do much wrong with that
<FromGitter> <unreadable> I'm starting to love the ruby syntax more and more
<Papierkorb> unreadable, well my two use-cases above are simply those I still remember from my time with C++/Qt - If you know of others, lemme know
<FromGitter> <unreadable> or i'd better say crystal's syntax
<Papierkorb> Yah well those parts are really Rubys invention .. or maybe they copied it from somewhere else too ;)
<FromGitter> <unreadable> Perl hehe
<FromGitter> <unreadable> there a funny twitter psot
<FromGitter> <unreadable> can't find it now
<FromGitter> <unreadable> *post
<Papierkorb> And boy did it suck that you had to overload operator<< all the time to dump your structures into a log.
<Papierkorb> in C++ that is
<FromGitter> <unreadable> well, that's right. Never coded c++ in production, but I'm thinking of getting a part time job on embedded devices with c
jackivan88 has joined #crystal-lang
_whitelogger has joined #crystal-lang
Disrecollection has joined #crystal-lang
<crystal-gh> [crystal] luislavena opened pull request #5188: Relocate and document Time::DayOfWeek (master...refactor-day-of-the-week) https://git.io/vFU2J
<bmcginty> Is there any reason crystal would be closing file descriptors in a sub-sub-process, after a dobule fork? I've done .reopen on my std* objects to point to /dev/null, and they stay around for a while, then they're just closed. very odd.
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<oprypin> D: