ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
devil_tux has quit [Ping timeout: 248 seconds]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tu1 has joined #crystal-lang
devil_tux has quit [Ping timeout: 272 seconds]
devil_tu1 has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
devil_tux has quit [Read error: Connection reset by peer]
devil_tux has joined #crystal-lang
rohitpaulk has joined #crystal-lang
DTZUZO has joined #crystal-lang
martinium has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
duane has quit [Ping timeout: 244 seconds]
devil_tux has quit [Read error: Connection reset by peer]
ht_ has joined #crystal-lang
martinium has quit [Quit: Textual IRC Client: www.textualapp.com]
devil_tux has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
absolutejam has joined #crystal-lang
ht_ has quit [Quit: ht_]
devil_tux has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
<absolutejam> can I access a method from a module outside the module?
<absolutejam> I've normally used classes in a module but in this case it doesn't make a lot of sense
absolutejam has quit [Ping timeout: 244 seconds]
absolutejam has joined #crystal-lang
absolutejam1 has joined #crystal-lang
<absolutejam1> Hash#key? doesn't seem to be a thing?
<absolutejam1> I'm just getting `undefined method 'key?' for Hash(String, String)`
<absolutejam1> oh, old version of the docs
<absolutejam1> derp
absolutejam has quit [Ping timeout: 244 seconds]
sorcus has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 268 seconds]
<dingenskirchen> uh could it be that the IRC bridge is dead?
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
DTZUZO has joined #crystal-lang
<dingenskirchen> @FromGitter, can you hear me?
devil_tux has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 268 seconds]
absolutejam has joined #crystal-lang
duane has joined #crystal-lang
<frojnd> Hi there
<frojnd> dingenskirchen: we hear ya
<dingenskirchen> hey
<dingenskirchen> nice that you can hear me, the gitter bot, however, does not.
<frojnd> Hm trying to migrate db in Lucky but I keep getting: Unhandled exception: Unexpected error while running migrations: duplicate key value violates unique constraint "users_nick_name_index" (Exception) My migration looks like this: add nick_name : String, unique: true, fill_existing_with: "nick_" + ran_string
<frojnd> And then a bit down I have private def ran_string (0...8).map { (65 + rand(26)).chr }.join end
<frojnd> Looks like ran_string is not being called for some reason
lucasb has joined #crystal-lang
<jokke> hm anyone know what's wrong with this? https://p.jokke.space/x7cW/crystal
ht_ has joined #crystal-lang
<dingenskirchen> @jokke
<dingenskirchen> it's a bit odd
absolutejam has quit [Ping timeout: 258 seconds]
sagax has quit [Quit: Konversation terminated!]
<jokke> uuuhhhh
<jokke> AMAZING
<jokke> but indeed odd
<jokke> thanks dingenskirchen
<dingenskirchen> ^^
<jokke> another question: the thing about assigning non-nilable instance variables from a macro
<jokke> ah i think i remember what the workaround was
<jokke> yup
<jokke> just wrap the initializer in {% begin %} {% end %}
sagax has joined #crystal-lang
absolutejam has joined #crystal-lang
duane has quit [Ping timeout: 244 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
absolutejam has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
duane has joined #crystal-lang
absolutejam has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
absolutejam has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #crystal-lang
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Quit: Saliendo]
ht_ has quit [Quit: ht_]
duane has quit [Ping timeout: 245 seconds]
teardown has quit [Read error: Connection reset by peer]
teardown_ has joined #crystal-lang
teardown_ is now known as teardown
<absolutejam> guys
<absolutejam> gals
<absolutejam> horses
<absolutejam> can I decompile a crystal build?
<absolutejam> I accidentally clobbered a single .cr file before committing
<absolutejam> and the last `crystal run` was the working file
<dingenskirchen> I don't think so
<dingenskirchen> does your editor have undo-after-save functionality?
<absolutejam> I closed
<absolutejam> accidentally
<dwdv> Is is possible to specify a descending sorting order here? `.sort_by! { |word| word.size }` Or is this only doable with with `.sort! { |a, b| b.size <=> a.size }`?
<dingenskirchen> then I'm afraid I'm out of tricks absolutejam
<dingenskirchen> dwdv unless I'm misunderstanding you, would there be a problem with `sort_by!{…}.reverse` ?
absolutejam has quit [Ping timeout: 268 seconds]
absolutejam has joined #crystal-lang
<dingenskirchen> also regarding your earlier message, dwdv, how about this method? https://crystal-lang.org/api/0.29.0/String.html#split%28separator%3AChar%2Climit%3Dnil%2C%2A%2Cremove_empty%3Dfalse%2C%26block%3AString-%3EUNDERSCORE%29-instance-method
<dwdv> Damn, dingenskirchen , that works indeed. Thanks a bunch.
<dingenskirchen> as far as I see the code it doesn't allocate an array
<dwdv> Oh, will try that, gimme a sec.
sorcus has quit [Ping timeout: 250 seconds]
<dwdv> Perfect, quite a bit faster, thanks again!
<dingenskirchen> np ^^
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #crystal-lang
teardown has quit [Ping timeout: 272 seconds]
<absolutejam> rewrote it anyway, thanks
<absolutejam> was fresh in my mind
<absolutejam> :bn
<absolutejam> :bp
<absolutejam> oops
<absolutejam> func : Proc(Commando::Command, Nil) | Nil,
<absolutejam> if @func.not_nil @func.call(myarg) end
<absolutejam> that's throwing a compile time Nil error
<absolutejam> But I'm explicitly checking for it...?
<robacarp> you need to save it to a local variable
<robacarp> if not_nil_thing = @func.not_nil; not_nil_thing(myarg); end
<dingenskirchen> absolutejam, can you paste that into carc.in or play.crystal-lang.org? my client is displaying it a bit weirdly
<jokke> today i could code crystal at work again after a few weeks break because of another project written in c++ and boy oh boy did it feel good. I almost danced on my way home to day it lifted up my mood so much. Crazy how much a language you care about can make a difference.
<jokke> i was also sooooooo much more productive
<jokke> *today
<dingenskirchen> heh ^^
<jokke> dingenskirchen: you don't happen to live in frankfurt and wanna join our company? :) we're crystal friendly :)
<jokke> just guessing from your nick that you're german
<dingenskirchen> While I'm near-ish Frankfurt, as in inside Germany, I'm neither finished with school nor seeking a carrieer in IT
<dingenskirchen> but I appreciate the offer!
<jokke> hehe :)
<jokke> i was half joking. :P I know nothing about you after all :P
<jokke> dingenskirchen: may i ask what you want to do instead?
<absolutejam> jokke: I've been writing Elixir and moving to Crystal for the other 50% is great.
<absolutejam> A colleague was trying to get me to write an app in Go, but I couldn't bring myself to it.
<absolutejam> Just need package maturity to help out with that choice
<dingenskirchen> it's vague but I'm looking at what opportunities there are in pharmaceutics, jokke
<dingenskirchen> still have some time to settle on something though :)
<jokke> absolutejam: hah yeah i had to write go once and i really can't understand the hype around it... :/
<dingenskirchen> I'm still somewhat torn between Crystal and D tbh
<dingenskirchen> both are pretty elegant in their own ways and I actually built _something_ with Crystal, hm.
<dingenskirchen> Elixir sounds nice, and I mostly write functional-ish code already, but I've not really looked into it much
<jokke> absolutejam: rust i can relate to
<jokke> but go...
<jokke> dingenskirchen: i think there's no one size fits all solution
<dingenskirchen> indeed
<jokke> crystal is good for what i use it for: web, micro services, streaming. It comes with a very extensive standard lib which is nice to quickly get going
<jokke> rust on the other hand is great if you need to write really robust code with as little side effects as possible without going full functional (and often losing performance in the process)
<jokke> at least that's my take
<absolutejam> https://play.crystal-lang.org/#/r/78vu dingenskirchen
<jokke> but i haven't used rust that much
<jokke> absolutejam: that's not how not_nil! works
<absolutejam> I feel like I could get behind go for some microservice kinda thing, but it's just sooooo verbose and strict
<absolutejam> o
<absolutejam> dingenskirchen: I love Elixir. The syntax, the message passing, the functional-ness
<jokke> dingenskirchen: don't do unless else
<absolutejam> the actor model is amazing and suits my brain well
<dingenskirchen> heh fair :P
<jokke> also maybe just use a guard clause :)
<absolutejam> oh !nil? works
<absolutejam> wait
<absolutejam> !foo.nil?
<jokke> just turn it around
<absolutejam> Thought I'd tried that
<jokke> if foo.nil? .. else
<absolutejam> makes sense
<absolutejam> ty
<dingenskirchen> yeah elixir's guard clauses are one thing I really miss in crystal
<dingenskirchen> i often find myself prefixing my code with a dozen or so
<dingenskirchen> `raise "Whatever" unless foo`'s that ensure various preconditions
<absolutejam> pattern matching is great too
<absolutejam> At first it looked so alien
<absolutejam> Rust has it too, right?
<jokke> yeah
<jokke> it's nice
<jokke> but idk. you can do almost everything you would do with pattern matching in a case when
<absolutejam> Elixir gives you destructuring at the same time
<absolutejam> def some_func(%SomeStruct{foo: value_i_want} = bar), do: IO.puts value_i_want
<dingenskirchen> what I really really liked was the pipe operator or D's UFCS, which is a similar concept
<absolutejam> Nim has that
<dingenskirchen> ew
<absolutejam> And I really liked it
<dingenskirchen> :P
<dingenskirchen> so instead of going foo(bar(baz))) you go baz.bar().foo()
<absolutejam> I went to Nim when I thought crystal was still too lacking (and when I needed Windows support). Never realy got too far with it
<dingenskirchen> The fact that the compiler syntax-errors when you use tabs kinda threw me off
<absolutejam> Better than people trying to add the pipe operator to languages that have no need for it
<absolutejam> that's because tabs are wrong
<absolutejam> and you are wrong
<dingenskirchen> like "if the guy who wrote this is this ridiculous about *indentation* what is he doing in actually important parts of the language?"
<jokke> absolutejam: destructuring is awesome, that's true
<absolutejam> and the fact, in Nim, that some_func is the same as someFunc
<absolutejam> only the first character's capitalization matters. And underscores are 'ignored'
<absolutejam> sOMEfu_nC
<absolutejam> Also, method overloading in Crystal <3
<absolutejam> Jesus christ I never knew about that until I wrote some elixir (coming from Python)
<absolutejam> and I don't know how I survived
<jokke> matter of preference i guess
<jokke> absolutejam: yeah same here for ruby (about not having method overloading)
<jokke> for me it was a no-brainer to switch to crystal from ruby
<jokke> telnet mapscii.me
<jokke> :)
absolutejam has quit [Ping timeout: 258 seconds]