<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
<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
<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>
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)