RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
<FromGitter> <fridgerator> Is it just me, or is the crystal channel becoming busier?
<FromGitter> <Sija> Had the same feeling @fridgerator
<FromGitter> <Sija> @j8r IMHO inheritance works best if u need hierarchy, like `Number` from stdlib, composition OTOH is especially useful in cases where u need to “wrap” another class with added / changed functionality, like for example simple in-memory cache store which could wrap `Hash` for keeping internal data, just my 2c
Groogy1 has quit [Ping timeout: 246 seconds]
baweaver is now known as baweaver_away
moei has joined #crystal-lang
<FromGitter> <watzon> Hey guys, it's been a bit
rohitpaulk has joined #crystal-lang
baweaver_away is now known as baweaver
<FromGitter> <kolyaio> Currently reading the Crystal by program it’s nice 🙂
<FromGitter> <fridgerator> crystal by program?
JuanMiguel has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <fenicks> Good morning from Paris
<FromGitter> <dscottboggs_gitlab> bonjour?
<FromGitter> <fenicks> @dscottboggs_gitlab Yes, bonjour
<FromGitter> <dscottboggs_gitlab> hooray I got it right haha
<FromGitter> <fenicks> I have an issue when compiling my program with OpenSSL on CentOS 7: ⏎ [dynamic]: `error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory` ⏎ [static]: `SSL_connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed` ⏎ ⏎ Thanks for your help [https://gitter.im/crystal-lang/crystal?at=5bb07026271506518d94dd9d]
<FromGitter> <fenicks> I see a difference for OpenSSL version between my desktop and the server: ⏎ [Ubuntu 18.04 desktop]: `OpenSSL 1.1.0g 2 Nov 2017` ⏎ [CentOS 7 server]: `OpenSSL 1.0.2k-fips 26 Jan 2017` ⏎ ⏎ Probably a custom installation to upgrade the CentOS7 to version 1.1.0 could works ? Or I will try to run inside a ubuntu 18.04 docker container. [https://gitter.im/crystal-lang/crystal?at=5bb077095af48530683b33ff]
JuanMiguel has quit [Quit: This computer has gone to sleep]
<FromGitter> <fusillicode_twitter> I'm also encountering an error with libssl but I think that they're totally unrelated 😞
<FromGitter> <fusillicode_twitter> On Mac Os Mojave :( ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb07fe81c100a4f290b4f1b]
<FromGitter> <sam0x17> is there a way to define a destructor in crystal? I'm wrapping a C binding and this class needs to execute some particular code when it gets de-allocated / garbage collected
<FromGitter> <codenoid> my type : `{} of String => Int32 | Int64`
<FromGitter> <girng> how does `?` work
<FromGitter> <girng> https://play.crystal-lang.org/#/r/54hp/edit for example, should this return `true`?
<FromGitter> <proyb6> @fusillicode
<FromGitter> <codenoid> `temp_res.to_a.sort_by { |key, value| value }.to_h.to_json`
<FromGitter> <girng> hello @watzon welcome back
<FromGitter> <fusillicode_twitter> @proyb6 thanks a lot 🙇. Btw I didn't investigate my issue because I was already using docker for building and running but let me try it :)
<FromGitter> <proyb6> No problem:)
<FromGitter> <fusillicode_twitter> @proyb6 ok JFYI it worked like a charm ;) ⏎ Anyway I'm still surprised by how fast the compiler runs...I'm really working by coding and running `docker build . -t my-app && docker run myapp`
<FromGitter> <dscottboggs_gitlab> @gring it's the ternary (https://en.wikipedia.org/wiki/%3F:) operator
<FromGitter> <girng> https://play.crystal-lang.org/#/r/54i7/edit how can i support regular `lol` and `lol?`?
<FromGitter> <girng> (without copying the same method code)
<FromGitter> <dscottboggs_gitlab> so it requires an alternative case, you could do ⏎ ⏎ ```puts true if test ⏎ # or ⏎ puts test? true : false``` [https://gitter.im/crystal-lang/crystal?at=5bb087581e23486b93671379]
<FromGitter> <girng> interesting, thanks
<FromGitter> <dscottboggs_gitlab> > how can i support regular `lol` and `lol?`? ⏎ ⏎ how about ⏎ ⏎ ```def lol ⏎ lol? ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bb087b11c100a4f290b7d2a]
<FromGitter> <dscottboggs_gitlab> that's how I usually do it
<FromGitter> <kingsleyh> Where is that Crystal jobs website?
baweaver is now known as baweaver_away
sagax has quit [Ping timeout: 252 seconds]
<FromGitter> <kingsleyh> Great thanks
<FromGitter> <fenicks> @fusillicode_twitter Try to install `openssl-devel` package
<FromGitter> <fusillicode_twitter> @fenicks I think I've already fixed the issue by following what @proyb6 pointed out :)
<FromGitter> <fusillicode_twitter> https://github.com/crystal-lang/crystal/issues/6875
<FromGitter> <kingsleyh> Hmm there are no jobs
<FromGitter> <fenicks> @fusillicode_twitter Ok
<FromGitter> <dscottboggs_gitlab> @kingsleyh yeah :(
<FromGitter> <kingsleyh> I wanted to list a job
<FromGitter> <kingsleyh> But doesn’t seem to allow that
<FromGitter> <dscottboggs_gitlab> oh weird
<FromGitter> <kingsleyh> Just a short piece of work
<FromGitter> <kingsleyh> Maybe only they post the official jobs
ashirase has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
<FromGitter> <vladfaust> Wow, there is someone with a job, nice! I’m the maintainer of CrystalJobs, and currently there is no functionality of jobs themselves 😅 I’m working on it and it’s going to be released this week I guess
<FromGitter> <vladfaust> For now you could ask someone in the chat, I’m sure you’ll find someone, Kingsley
* FromGitter * dscottboggs_gitlab begs
Tortice has joined #crystal-lang
<FromGitter> <kingsleyh> Hey @vladfaust great - I filled out my profile and hit Save but when I go back my profile is empty
<FromGitter> <kingsleyh> Also my piece of work isn’t a proper full time job it’s more of a small piece of work
<FromGitter> <kingsleyh> That I would usually advertise on a freelancer site
<FromGitter> <vladfaust> Yep, profiles are moderated manually at the moment, will add you soon
<FromGitter> <kingsleyh> Anyway if anyone wants to get paid a small amount of money to code some Crystal - please let me know
<FromGitter> <vladfaust> I’m available for $50/hour, if that’s ok, drop me an email
<FromGitter> <bajro17> hi if someone know how to generate in amber api with new and edit
<FromGitter> <bajro17> when I generate normal it generate me without new and edit
<FromGitter> <bajro17> `resources "/drivers", DriversController, except: [:new, :edit]`
<FromGitter> <bajro17> its ok I find solution :)
<FromGitter> <crystallangjobs> Hello Crystal devs, I have created a job board with less barrier to post your profile in one place! Let me know if anyone interested or if you prefer Vlad Faust's site. ⏎ https://github.com/crystallangjobs/crystallangjobs/
JuanMiguel has joined #crystal-lang
<FromGitter> <bajro17> @crystallangjobs you can do different to people can post there jobs if they search for crystal programmers
<FromGitter> <bajro17> @vladfaust just display programmers
<FromGitter> <bajro17> but anyway we need as much more is possible projects with crystal to be in production
<FromGitter> <bajro17> to people see how awesome is crystal lang
<FromGitter> <Sija> @sam0x17 `def finalize`
<FromGitter> <sanderhahn> Hello all, playing a round with Crystal a bit and trying to use an abstract class but it gives me `abstract 'def Request(Params)#call(params : Params)' must be implemented by AddRequest`
<FromGitter> <sanderhahn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb0bbeec7bf7c366294482e]
<FromGitter> <sanderhahn> What am i doing wrong here?
JuanMiguel has quit [Quit: This computer has gone to sleep]
Heaven31415 has joined #crystal-lang
<Heaven31415> Hi
<Heaven31415> Is it possible to have a macro and a method defined with the same name in the same scope?
<FromGitter> <crystallangjobs> @bajro17 No problem, I have updated the Readme for organizations/startups to seek Crystal Devs. Great thanks for the suggestion!
<FromGitter> <bajro17> @crystallangjobs You most welcome :)
<FromGitter> <bajro17> @crystallangjobs just it will be better if you make site instead use only repo
<FromGitter> <bajro17> probably also will be good to use crystal to make site :)
<FromGitter> <ohenepee> I hit a bug doing something "probably" non-idiomatic
JuanMiguel has joined #crystal-lang
<JuanMiguel> is someone using Kemal with WebSockets? Have you found any problem with client disconnecting and causing exceptions on the server?
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
Tortice has quit [Read error: Connection reset by peer]
<FromGitter> <vladfaust> Excuse me, can I safely check if a variable is initialized? ⏎ ⏎ ```x = uninitialized Int32 ⏎ # Some code ⏎ if x # May cause a memory leak``` ⏎ ⏎ I'd like to avoid additional `initialized_vars` list if possible [https://gitter.im/crystal-lang/crystal?at=5bb0def3ef4afc4f28fa273f]
<FromGitter> <vladfaust> Some kind of `initialized?(x)`
<FromGitter> <vladfaust> Okay, ended up with `initialized = {} of String => Bool`
<FromGitter> <Prutheus> Hello. What does it mean when I declare the type of my variable to be a class but with the `?` symbol behind the name of the class? what stands the `?` for? e.g. here: ⏎ ⏎ ```class Test ⏎ # ... ⏎ end ⏎ ⏎ a : Test?``` [https://gitter.im/crystal-lang/crystal?at=5bb0e2e4600c5f642331e35e]
<FromGitter> <j8r> @Prutheus `Test?` == `Test | Nil`.
<FromGitter> <Prutheus> oh yeah right ^^
JuanMiguel has quit [Quit: This computer has gone to sleep]
Tortice has joined #crystal-lang
DTZUZO has quit [Ping timeout: 272 seconds]
JuanMiguel has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> so, i have a str date `"2018-09-21"`
<FromGitter> <codenoid> 1) how to convert it to crystal datetime ⏎ 2) how to get x.day.ago from `[1]`
<FromGitter> <codenoid> `wrong number of arguments for 'Time.parse' (given 2, expected 3)`
<FromGitter> <codenoid> `Time.parse(time : String, pattern : String, location : Location)`
<FromGitter> <codenoid> what is `Location` ?
Heaven31415 has quit [Remote host closed the connection]
<FromGitter> <ammarfaizi2> Interesting... the documentation doesn't explain about Location parameter.
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/54ma
<FromGitter> <codenoid> temp patch i use momentjs
<FromGitter> <Prutheus> Now an other question: I am using Hedron (LibUI interface) for a gui task. Here is my script: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Why? I do not understand how Procs works ... :/ [https://gitter.im/crystal-lang/crystal?at=5bb0ee44600c5f64233221f5]
<FromGitter> <Blacksmoke16> need to tell it what tz that time is from, since it cant parse it from the string
<FromGitter> <codenoid> https://play.crystal-lang.org/#/r/54md cool
<FromGitter> <codenoid> thankyou
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <Blacksmoke16> if you have a string that has the tz in it
<FromGitter> <Blacksmoke16> like
<FromGitter> <Blacksmoke16> `2017-06-06T13:12:32Z` you wouldnt need the location
<FromGitter> <Blacksmoke16> i think
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/54mh
<FromGitter> <Blacksmoke16> mainly because in that specific format the `Z` denotes UTC
<FromGitter> <codenoid> but `, expected 3`
<FromGitter> <codenoid> https://play.crystal-lang.org/#/r/54mh well, okay
rohitpaulk has quit [Ping timeout: 252 seconds]
JuanMiguel has quit [Quit: This computer has gone to sleep]
<FromGitter> <Prutheus> Can anybody answer my question?
<FromGitter> <j8r> `Proc(Hedron::Button, Nil)` not `Proc(Hedron::Button, (Process | Nil))`
<FromGitter> <j8r> make sure to always use `Nil`, not enventually `Process`
<FromGitter> <Prutheus> But why is it Process there? When I comment my run_bot and stop_bot lines, it is ok, but when the proc functions calls these lines, then the type is wrong
<FromGitter> <Prutheus> I dont use Process directly, just call functions which use them ... I dont know why Process appears in Proc call
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> You do Process.new
<FromGitter> <bajro17> I need help with json to postgres save
<FromGitter> <bajro17> "join_date": "2016-08-12T18:33:17.157Z",
<FromGitter> <bajro17> in postgres base it is date type
<FromGitter> <Sija> @ohenepee please, report it at the issue tracker
<FromGitter> <Prutheus> @j8r but why is this then in my Proc? How does a Proc works? And how to solve my issue ? I need to perform a Process.new
<FromGitter> <Sija> @Prutheus because your `#run_bot` method returns `Process` (remember about implicit returns, like in Ruby)
<FromGitter> <j8r> put a `nil` at the end
<FromGitter> <Sija> I’d suggest changing `#run_bot` declaration to `#run_bot(…) : Nil`, in this way you’ll be sure there’s no return value
<FromGitter> <Sija> and btw, it’s better than putting `nil` at the end
<FromGitter> <j8r> yes, didn't know the type restriction trick
<FromGitter> <Sija> same goes for `#stop_bot` (to be extra sure)
<FromGitter> <j8r> we can do the `: Nil` for virtually all methods?
<FromGitter> <Sija> @j8r yep
<FromGitter> <Sija> and it shows in docs, which is a bonus point
JuanMiguel has joined #crystal-lang
<FromGitter> <vladfaust> Still implementing typed params as a shard. A piece of my code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bb10eb1271506518d983bd7]
<FromGitter> <vladfaust> This makes both cases work: ⏎ ⏎ ```params({ ⏎ foos: Array(Int32) | Nil, ⏎ bars: Array(Int32)?, ⏎ })``` [https://gitter.im/crystal-lang/crystal?at=5bb10f06435c2a518e2fa8a4]
<FromGitter> <vladfaust> Ah, nevermind, just sharing emotions
<FromGitter> <girng> @vladfaust :-D
<FromGitter> <Prutheus> thanks
<FromGitter> <codenoid> <3
JuanMiguel has quit [Quit: This computer has gone to sleep]
<FromGitter> <girng> why does using a `?` on a crystal's hashkey work, but not for a regular method or bool value??
<FromGitter> <girng> for an API to support the `?` the developer needs to add support for a `?` method
<FromGitter> <girng> i was just thinking `?` was a global thing where it could be used on anything to check true or false lol
<oprypin> glad you figured it out
<FromGitter> <girng> ty. i figured i should just dive into directly into the source code before asking my questions xD
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <Sija> @girng nope, it’s just a convention, similarly to `!` - as in Ruby
Heaven31415 has joined #crystal-lang
<FromGitter> <Sija> haha, RTFM man!
<FromGitter> <Sija> or code for that matter
<Heaven31415> hi
<FromGitter> <Sija> howdy
<FromGitter> <elorest> Hey everyone.
<FromGitter> <codenoid> long time no c @elorest
<FromGitter> <girng> @Sija =]
<FromGitter> <girng> what happens to `123123`, after its left the scope of the `method`, does it get free'd by the GC at a later time or?
<FromGitter> <girng> for example, https://play.crystal-lang.org/#/r/54n9 in C++ i could write a `void` function and change the value of name if i passed by reference
<FromGitter> <girng> but it seems here, it's passed by value, right? so is that code i just linked essentially a tiny, tiny memory leak?
<FromGitter> <Sija> nope, it’s passed by copy
<FromGitter> <Sija> to change the value you’d need to use `pointerof(test)`
<FromGitter> <Sija> and from C++ side take it as `int*` argument (or `void*` and cast it manually)
<FromGitter> <girng> interesting so crystal lets use use pointers if we wanted?
JuanMiguel has joined #crystal-lang
<FromGitter> <Sija> sure
<FromGitter> <bew> @Prutheus I'd suggest to change the return type of `button_clicked`to Nil, instead of changing `run_bot`'s return type
<FromGitter> <bew> Because, if you change the implementation of `button_clicked`, you may get another error like this.. If you force it to return nil, you can change the implementation, and it'll still always return nil
<FromGitter> <Sija> 👍
return0xe has joined #crystal-lang
<FromGitter> <Sija> has any1 here upgraded to macOS Mojave? if so, I’m curious is there a noticeable perf difference in comparison to older versions? (I’m on 10.11 atm so it’d be a 3 version jump - having 2013 MBA with 8gb of RAM, so not that much for today’s standards…) thanks!
return0e has quit [Ping timeout: 245 seconds]
return0xe has quit [Remote host closed the connection]
return0e has joined #crystal-lang
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 252 seconds]
Tortice has quit [Remote host closed the connection]
baweaver_away is now known as baweaver
JuanMiguel has quit [Quit: Saliendo]
<FromGitter> <girng> @Sija that's very cool. gonna read the gitbook page on that some more
<FromGitter> <girng> i'm trying to convert this question https://stackoverflow.com/a/20916980
<FromGitter> <girng> here is what I got so far: https://play.crystal-lang.org/#/r/54ny
<FromGitter> <girng> am i doing that right?
<FromGitter> <girng> my `distance_between(a, b)` is going to be run in a 15hz game loop. so i'm not sure if i should be copying values to the method every tick. a and b will be coming from my players x and y position in the game world
<FromGitter> <girng> would this be a good use case to use the pointerof, and check it by reference instead?
<FromGitter> <bajro17> @rishavs do you plan to make more post on this series about cove?
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
druonysus has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
<FromGitter> <codenoid> something in kemal make my application slow :/ ⏎ sometimes the request not loaded ⏎ sometimes need to trigger 1 request with the next request ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5bb1420f5af48530683f9f62]
<FromGitter> <dscottboggs_gitlab> is there any way to view the full source that a macro generates?
<FromGitter> <codenoid> fixed with route caching
<FromGitter> <dscottboggs_gitlab> I found it, `crystal tool expand`
<FromGitter> <dscottboggs_gitlab> @girng here's my implementation - a simple refactoring of your own. It really helps to get into the object-oriented mindset when writing crystal
<FromGitter> <dscottboggs_gitlab> https://play.crystal-lang.org/#/r/54ot
<FromGitter> <Sija> @dscottboggs_gitlab also `{{ debug }}`
<FromGitter> <dscottboggs_gitlab> what's that do?
davic has quit [Ping timeout: 268 seconds]
<FromGitter> <Sija> will print the generated macro in the scope
<FromGitter> <dscottboggs_gitlab> when you try to run or build it?
davic has joined #crystal-lang
DTZUZO has quit [Ping timeout: 272 seconds]
<FromGitter> <Sija> yep
<FromGitter> <Sija> https://carc.in/#/r/54oy
<FromGitter> <dscottboggs_gitlab> ah, I'm trying to expand it from the other end, but I guess I could go to the source and expand that instead.
<FromGitter> <dscottboggs_gitlab> gotta go for now though
<FromGitter> <codenoid> i don't belive in benchmark result
Tortice has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> @dscottboggs_gitlab thanks
<FromGitter> <girng> so you can do `def initialize(@x : Int64, @y : Int64) end` is the same as calling @x = x inside the method?
<FromGitter> <girng> it's a shorthand way of doing it or somehting?
<Heaven31415> yes, it is
<FromGitter> <girng> cool, well that is going to save me some lines of code =]
<FromGitter> <girng> i got a couple of class initializers that could use that way :D
<FromGitter> <girng> my question on reddit has over 600 views :D
<FromGitter> <girng> i'm popular!
DTZUZO has joined #crystal-lang