RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <noahlh> quick newb question on `IO`...
<FromGitter> <noahlh> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c1c313cb6f00a27101db9bd]
<FromGitter> <noahlh> can someone explain why the first has output and the second does not?
<FromGitter> <straight-shoota> @noahlh `#to_s` returns the internal buffer as string
<FromGitter> <straight-shoota> `#gets` reads a line. But since the stream pointer is at the end of the buffer, there is nothing to read (hence returns `nil`)
<FromGitter> <straight-shoota> If you want to read the previously printed string, you need to `#rewind` the io
<FromGitter> <anamba> indeed https://play.crystal-lang.org/#/r/5u1p
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
Raimondi has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <girng> hello
Raimondi has quit [Ping timeout: 240 seconds]
non-aristotelian has quit [Quit: non-aristotelian]
<FromGitter> <proyb6> Hello
DTZUZO has quit [Ping timeout: 244 seconds]
<FromGitter> <dscottboggs_gitlab> o/ hi guys!
<FromGitter> <noahlh> @straight-shoota @anamba -- perfect - thank you both for the info! that's exactly what i was looking for.
<FromGitter> <proyb6> I'm curious if 2-5x funding is enough to get Crystal team moving to fill most out the features in 2019?
<FromGitter> <girng> i applied at a local job near my city, so when i get some income in i will happily donate
<FromGitter> <codenoid> thank you @girng
<FromGitter> <kevinelliott> I donated today
<FromGitter> <girng> @kevinelliott <3
Raimondi has joined #crystal-lang
Dreamer3 has quit [Quit: Leaving...]
Raimondi has quit [Ping timeout: 240 seconds]
Renich has joined #crystal-lang
Renich has quit [Quit: Renich]
Renich has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
Dreamer3_ has joined #crystal-lang
<FromGitter> <drum445> Java is horrendous
<FromGitter> <drum445> Just in case people wanted my opinion on it ;)
<FromGitter> <proyb6> Java isn't horrendous for Java programmers if the companies are hiring them for the job and being certified has a benefit
DTZUZO has quit [Ping timeout: 245 seconds]
<FromGitter> <drum445> It's great for careers, doesn't make the language any nicer
<FromGitter> <j8r> protected doesn't seems to work as I expect https://carc.in/#/r/5u2r
<FromGitter> <j8r> I believed it was only callable inside the namespace, not outside?
<jokke> is crake still the go-to library for something like rake in crystal?
<jokke> hm i think i'll try out lucky_cli since i don't really need dependencies
ashirase has quit [Ping timeout: 272 seconds]
ashirase has joined #crystal-lang
<FromGitter> <proyb6> @drum445 Agreed, so they can leverage with Kotlin or Scala along with Java, lucky Ruby could leverage with Crystal too
Linuxer4Fun has joined #crystal-lang
<Linuxer4Fun> Hello!
<FromGitter> <greenbigfrog> hi
DTZUZO has joined #crystal-lang
ua has quit [Read error: Connection reset by peer]
ua has joined #crystal-lang
<FromGitter> <kinxer> @j8r It's probably something special with `.new`: https://carc.in/#/r/5u3a
<FromGitter> <kinxer> Interesting: https://carc.in/#/r/5u3d vs https://carc.in/#/r/5u3e
<z64> the default `new` is a public class method that calls `initialize` after allocating memory, so it has protected access to `initialize`
DTZUZO has quit [Ping timeout: 250 seconds]
Raimondi has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <proyb6> Improve this benchmark code if not AOC challenge? ⏎ https://github.com/kostya/crystal-benchmarks-game/blob/master/knucleotide/knucleotide.cr ⏎ Knucleatide is still slower than Go where 12s to complete and Crystal 0.27 release optimized took 21+s
<FromGitter> <j8r> @z64 @kinxer I've no choice to have a protected `self.new` calling a private `initialize`?
<FromGitter> <j8r> because private works as expected https://carc.in/#/r/5u3y
mjanssen has quit [Remote host closed the connection]
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
<yxhuvud> proyb: It depends on hashes, and hashes are kinda slow. You might gain a little by changing the initial size allocated to the hash, but I don't think that will make up for the difference.
<FromGitter> <proyb6> @yxhuvud I do see it use 400MB of memory which is too high on Crystal while Go allocates 160MB
<FromGitter> <j8r> A Set is indexed? You could use it
<FromGitter> <j8r> (I don't know the problem)
<FromGitter> <asterite> hashes could be more efficient in crystal but by the default they preserve insertion order and they use the old algorithm Ruby used... also maybe it would be nice to have a faster hash that doesn't care about insertion order
<jokke> def
<FromGitter> <proyb6> HashUnordered? :)
<jokke> relying on insertion order isn't a good idea imho
<FromGitter> <asterite> unless it's guaranteed
<jokke> yeah sure..
<jokke> but idk if it should be guaranteed
<FromGitter> <mpcjanssen> python switched to making it guaranteed because so many were depending on it
<FromGitter> <asterite> Right, in Ruby it's guaranteed too. In Crystal too. I found it to be sometimes useful (and it's intuitive)
<FromGitter> <j8r> Having both sound like a good option
<FromGitter> <j8r> Hash, and HashOrdered something like that
DTZUZO has quit [Ping timeout: 246 seconds]
<FromGitter> <asterite> In that case it would be UnorderedHash :-)
Linuxer4Fun1 has joined #crystal-lang
Linuxer4Fun has quit [Read error: Connection reset by peer]
Linuxer4Fun1 is now known as Linuxer4Fun
<FromGitter> <j8r> or there are plenty of names: Dict, HashMap, Map, KeyedList, AssociativeArray
Raimondi has quit [Ping timeout: 240 seconds]
<z64> @j8r consider this: https://carc.in/#/r/5u4b ; instances can be the receiver of `protected` methods as long as the callsite is within `T` (or a subtype i imagine too). `private` methods can only be called within the instance itself, without a receiver. this is detailed in https://crystal-lang.org/docs/syntax_and_semantics/visibility.html#protected-methods, etc
<FromGitter> <j8r> z64 I would like the opposite
<FromGitter> <j8r> instantiate only in the same namespace, but be able to call getters externally
<z64> i think private types would be the only solution
<z64> but may not play well with other things
akaiiro has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
<yxhuvud> asterite: one question though is how much of the overhead is due to the orderedness, rather than just the overhead of all pointer chasing in the current implemenation.
<yxhuvud> jokke: it must be either guaranteed to be ordered or guaranteed not to be (like in go).
<yxhuvud> otherwise people will depend on de facto behaviour and force orderedness.
<oprypin> > [15:47:27] <f44336@mpcjanssen> python switched to making it guaranteed because so many were depending on it
<oprypin> that is incorrect
<oprypin> Python has the fastest, most compact AND ordered implementation
<oprypin> so if that one is copied directly, there will be no downsides
<oprypin> that is the only reason why the ordered implementation was able to replace the unordered one in Python - because it has no downsides
<yxhuvud> oprypin: I can beleive that the new python implementation was faster than the older impl, but when it comes to performance vs other hash or dict implementations, [citation needed].
akaiiro has joined #crystal-lang
Renich has quit [Ping timeout: 250 seconds]
DTZUZO has quit [Ping timeout: 244 seconds]
Renich has joined #crystal-lang
<FromGitter> <j8r> The Python stdlib has rough edges
<FromGitter> <girng> i love `Hash(Type, Type).new`, that's all i need in life
<FromGitter> <j8r> Whats `_w`, `s` vars?!
<FromGitter> <alehander42> oprypin: thanks for https://www.youtube.com/watch?v=npw4s1QTmPg&feature=youtu.be, very nice style of presenting
<FromGitter> <j8r> @girng don't forget to use structs whenever possible 😏
<oprypin> j8r, i don't think that this is good advice to give so generally
<FromGitter> <girng> @j8r yeah i do need to use structs more.. i was just kinda saying i really like how easy the hash is setup in crystal. i mean `hash.delete key` and BOOM it's gone. and `clear`, `each`, etc make it so easy to work with
<FromGitter> <j8r> Struct are for known mapping, when keys are know in advance
<FromGitter> <j8r> This avoids runtime errors
<FromGitter> <j8r> Yeah Hash is very practical
<FromGitter> <j8r> Nearly every language have associative arrays (sparse or not)
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
non-aristotelian has joined #crystal-lang
Raimondi has joined #crystal-lang
DTZUZO has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 250 seconds]
<FromGitter> <asterite> Yxhuvud: good question. I don't know. I think changing Hash to use an open-addressing algorithm would improve performance, and I think one of the tentative PRs also kept the order, so yeah, maybe the ordering doesn't matter much
druonysus has quit [Ping timeout: 244 seconds]
<yxhuvud> Yeah. my impression of reading that pr is that he ran into GC issues. boehm doesn't like big allocations, and also mistook some stored hashes as pointers.
<FromGitter> <asterite> Yxhuvud: wow, you finally solved AoC 20 part 2. I spent hours trying to implement it, I think I have an idea but probably have bugs in it... I'm still not sure of a good algorithm for it, but these days I won't have time for AoC :-(
virkony has quit [Remote host closed the connection]
<yxhuvud> part2 was easy. I tried to be too general on part1 which was a big problem as it didn't terminate
<FromGitter> <asterite> right, the same thing happened to me
<FromGitter> <asterite> I might eventually spoil myself and look at your solution :-P
Raimondi has joined #crystal-lang
druonysus has joined #crystal-lang
<oprypin> asterite, Yxhuvud, why are you talking as if there isn't already a widely used open-addressing hashtable implementation that keeps ordering?
<oprypin> there's some citation as well
ua has quit [Ping timeout: 250 seconds]
Linuxer4Fun has quit [Quit: Linuxer4Fun]
ua has joined #crystal-lang