Kug3lis has joined #crystal-lang
onionhammer has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
DTZUZU has joined #crystal-lang
soveran has joined #crystal-lang
<
FromGitter>
<firejox> though they are in different design
soveran has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
matp has quit [Quit: Bye!]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
matp has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 256 seconds]
<
FromGitter>
<maiha_twitter> Happy new year! (JST)
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 246 seconds]
matp_ is now known as matp
<
Papierkorb>
literal: Hash(String, Int32 | String).new == {} of String => Int32|String
<
RX14>
as you can see it's a gigantic pain in the ass, so don't do it
<
RX14>
well i mean for recusrive types
<
Papierkorb>
Ah you wanted a recursive hash, sorry
<
RX14>
in crystal we tend to use a class/struct instead of using hashes as generic data bags
<
literal>
yeah, I only have a fixed amount of 3 keys in the top level hash, so I just made them 3 separate variables
<
literal>
makes sense
<
RX14>
hashes are used mainly for key -> value mappings only where the values are a known type
<
RX14>
which can of course be a union
<
RX14>
you could change the default hash value to be 0
<
RX14>
or you could do hash[key] = (hash[key]? || 0) + 1
<
RX14>
hash.fetch(key, 0) works too i think
<
RX14>
for key or 0
<
RX14>
Hash#fetch(key, default)
<
literal>
that'll work
chamar has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 258 seconds]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
vivus-ignis has joined #crystal-lang
Philpax_ has quit [Ping timeout: 258 seconds]
Kug3lis has joined #crystal-lang
soveran has quit [Remote host closed the connection]
martinium has joined #crystal-lang
soveran has joined #crystal-lang
bjz has joined #crystal-lang
<
Kug3lis>
where I can find old ruby based compiler source code? :D
<
RX14>
there's a branch
<
RX14>
but it's really old
<
RX14>
i lied, it's a tag
<
Kug3lis>
yeah I know, I am just curious how it looks
<
Kug3lis>
thanks :)
<
Kug3lis>
new year in front of pc? D:
<
RX14>
practicing for an exam even
Ven has quit [Ping timeout: 264 seconds]
<
Kug3lis>
those jan 2 exams are crazy :D
Ven has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<
Kug3lis>
Could someone explain me why sometimes there are in class def self.new() and def initialize() ?
<
Kug3lis>
isnt it the same?
<
RX14>
initialize runs in the new class instance
<
RX14>
self.new runs at the class level
<
RX14>
self.new is mostly used for passing to another definition of `new`
<
BlaXpirit>
Kug3lis, they both serve a very similar purpose but have different advantages
<
BlaXpirit>
you can initialize fields only in "initialize"
<
BlaXpirit>
you can pass through to a different constructor only in "new"
<
Kug3lis>
and new basically overloads different arguments for initialize?
<
BlaXpirit>
something like that. but technically that sounds wrong
<
BlaXpirit>
it's the other way around maybe
<
Kug3lis>
because I was looking at Http::Server and did not much understand thats difference
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Remote host closed the connection]
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
DTZUZU has quit [Ping timeout: 268 seconds]
Ven has quit [Ping timeout: 256 seconds]
soveran has joined #crystal-lang
Ven has joined #crystal-lang
martinium has quit [Quit: WeeChat 1.5]
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
soveran has quit [Remote host closed the connection]
Ven has joined #crystal-lang
DTZUZU has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Ven has quit [Ping timeout: 268 seconds]
Ven has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
Ven has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Ven has joined #crystal-lang
bjz has joined #crystal-lang
Ven has quit [Ping timeout: 265 seconds]
vivus-ignis has quit [Ping timeout: 268 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 245 seconds]
matp_ has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
matp has joined #crystal-lang
Ven has quit [Ping timeout: 246 seconds]
_whitelogger has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
chino has joined #crystal-lang
bjz has quit [Ping timeout: 248 seconds]
bjz has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 265 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
bjz has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
ragmaanir has quit [Quit: Leaving]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang