RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
jnyw has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] ysbaddaden opened pull request #5730: Refactor signal handlers (master...core-refactor-signal-handlers) https://git.io/vA8M5
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
faustinoaq_ has joined #crystal-lang
<faustinoaq_> OMG @sdogruyol !!!
<faustinoaq_> Look very nice, can't wait to read it
faustinoaq_ has quit [Client Quit]
<FromGitter> <bew> Coool indeed!
codenoid has joined #crystal-lang
<codenoid> hi
<codenoid> is crystal doesn't have TCP Client
<codenoid> built-in
<FromGitter> <bew> It does
<codenoid> ?
<codenoid> doesn't mention about TCP Client
<FromGitter> <yorci> hey, i have some problem about type restriction logic in my mind and also in practice, anybody be able to help me? 😟
<codenoid> right
<FromGitter> <bew> Right it's tcpsocket https://crystal-lang.org/api/0.24.1/TCPSocket.html
<codenoid> .open
<codenoid> i dunno, let's try em all
<FromGitter> <yorci> what if i have a big structured data like tree, lets say i have an namedtuple inside of array inside of namedtuple inside of array and namedtuples have three or more keys and i want that data to assign on a variable, i must specify the type of all of them?
<FromGitter> <aisrael> You should probably be using classes, or, type `alias`es at the very least?
<codenoid> "TCP Socket" is "TCP Client", beginner like me will be mixed up about this,
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> Well what do you mean by "tcp client" if it's not a tcp socket ?
<FromGitter> <yorci> @aisrael but how? i didnt really understand about it, im not type safe based language so its hard to understand for me
<FromGitter> <yorci> there is any documentation about it ? i mean structure data
<codenoid> "tcp socket" (which is mean tcp client) is not suitable for a layman like me
<FromGitter> <bew> Did you read the language documentation?
<codenoid> tcp client - tcp server, vs tcp socket vs tcp server, i'm very confused
<codenoid> ok then
<FromGitter> <bew> It basically explains how to create and use a class
<FromGitter> <aisrael> https://crystal-lang.org/docs/syntax_and_semantics/alias.html ⏎ @yorci For example, instead of `Tuple(String, String, Int)` maybe `alias Foo = Tuple(String, String, Int)`
<FromGitter> <bew> About your original question, you don't necessarily need to specify the types when accessing your data structure
<FromGitter> <bew> But you'll need to specify the types when creating such data structure
<FromGitter> <bew> @yorci ˆ
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <yorci> yea but i still have to define my structure all of tree, right?
<FromGitter> <yorci> Alias like you define one time and use more time without copy right?
codenoid has quit [Quit: i sleep in my keyboard]
<FromGitter> <bew> Look at the link above from @aisrael to the documentation about what an `alias` is
<FromGitter> <yorci> thank you for helping @bew and @aisrael
<FromGitter> <x86128> @j8r @aisrael Thanks for reply. I've also looked at SPEC tests for YAML and JSON and took off a lot of accomp. questions.
<FromGitter> <bew> s/of/or
<FromGitter> <bew> @yorci NamedTuple are not really meant to be used in complex data structures, you should use structs or classes instead
<FromGitter> <yorci> im looking for it on documentation, actullay if there is any example about it, it might be more helpfull 😄
<FromGitter> <yorci> yes
<FromGitter> <yorci> if im right, its like seperate big data into small parts with struct or class right? and use parts when it necessary
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <bew> yep
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
ome has quit [Quit: Connection closed for inactivity]
faustinoaq has joined #crystal-lang
rohitpaulk has joined #crystal-lang
ephemera__ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
ephemera_ has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
pabs has quit [Ping timeout: 264 seconds]
pabs has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
flaviodesousa has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
hightower2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
jnyw has quit [Quit: WeeChat 2.0.1]
<FromGitter> <sdogruyol> @faustinoaq thanks :) It's still in the making
<FromGitter> <bararchy> @sdogruyol looks amaizing
<FromGitter> <aisrael> Is there a way for a generic type/method to accept subclasses of the original type parameter? E.g. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a8aa89ca2194eb80d8325b4]
rohitpaulk has joined #crystal-lang
<FromGitter> <aisrael> Like maybe a `forall U extends T`?
<jokke> are there any good static site generators in crystal?
<jokke> (cuz every language needs static site generators) :P
pabs has quit [Ping timeout: 260 seconds]
pabs has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower has quit [Ping timeout: 256 seconds]
<FromGitter> <straight-shoota> jokke: not really
<FromGitter> <straight-shoota> https://github.com/straight-shoota/criss is more like prototype/work in progress
<FromGitter> <straight-shoota> I have been working on a major refactoring recently, but it's not on github yet
<jokke> oh nice
maattdd_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <j8r> there is also https://github.com/f/kamber
duane has quit [Ping timeout: 240 seconds]
faustinoaq has joined #crystal-lang
duane has joined #crystal-lang
faustinoaq has quit [Ping timeout: 256 seconds]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
duane has quit [Ping timeout: 264 seconds]
duane has joined #crystal-lang
codenoid has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<codenoid> hi, i have int with value 100, i want do something like `a = 0; 100.times.each { |i| # a => 99 * 98 * 97 ... 2 * 1 } ` but seems a variable doesn't change the value (still 0)
<hightower2> codenoid 100.times { ... } without each
<hightower2> (that's at least the first change you could make)
alex`` has joined #crystal-lang
<hightower2> second is, the i is going to go from 0 to 99, so you'll keep multiplying a (zero) with something, which will be zero
<codenoid> no, actually, `a = 0; (1...101).each {|i| a = i if i == 1; a = i * a if i > 1; }; puts a # => 0
<FromGitter> <aisrael> what happens if you rename the `a = 0` to `b = 0`?
<FromGitter> <bew> Just search tcpclient in the api docs
<FromGitter> <bew> @yorci just ask your question(s) :)
<FromGitter> <bew> @yorci NamedTuple are not really meant to be used in complex data structures, you should use structs of classes instead
alex``` has joined #crystal-lang
<hightower2> codenoid you don't need a check if i is equal to 1 or greater, and especially not in two different ifs
<FromGitter> <aisrael> Nah ok I get it. At first I thought it was a scope thing
codenoid has quit [Ping timeout: 240 seconds]
<FromGitter> <aisrael> @codenoid What happens if you put a `puts a` before the closing curly brace?
<FromGitter> <aisrael> Or, rather ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a8ae5858f1c77ef3a294248]
hightower2 has quit [Read error: Connection reset by peer]
hightower2 has joined #crystal-lang
radagast_04 has joined #crystal-lang
radagast_04 has quit [Remote host closed the connection]
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
<FromGitter> <straight-shoota> @j8r I don't think kamber qualifies as a static site generator, it's rather a server for static site content. It needs to be running to serve a website and it needs to be recompiled to apply changes in the template
codenoid has joined #crystal-lang
<codenoid> hightower2, https://carc.in/#/r/3lvc
<hightower2> codenoid you seem to be generating too high integer value to fit into the variable. Reduce 1..100 to 1..10 and you'll see the values
<codenoid> wut, :/
<codenoid> hmmm
<hightower2> you seem to be insisting on 'if' for value of i... If you really want that then at least have one if, like buf = i == 1 ? i : buf * i
<codenoid> yeah, ternany much simple
<hightower2> in fact, if you use "next if" then you don't need the second if because it's guaranteed
<codenoid> yeah, `(1..10).each { |i| buf = i == 1 ? i : i * buf }`
<codenoid> but i need to change 10 to 100
maattdd_ has quit [Ping timeout: 256 seconds]
<FromGitter> <ezrast> @codenoid BTW, TCP socket vs client is a networking fundamentals thing. When a server accepts a connection, it spawns a new socket that is connected to the client's socket, and after that the client/server distinction is lost. Both sides now just have a socket as far as the TCP stack is concerned. There's no such thing as a client after the connection is established.
<FromGitter> <ezrast> In Crystal, that means that `TCPServer#accept` yields a `TCPSocket` object to the server-side code. Calling it `TCPClient` wouldn't make sense there.
codenoid_ has joined #crystal-lang
<codenoid_> ok, Socket,
codenoid has quit [Ping timeout: 268 seconds]
<FromGitter> <codenoid> so i can't just change Int32 to Int64 right ?
<FromGitter> <ezrast> It won't help because 100! is still much larger than `Int64::MAX`
<FromGitter> <codenoid> 😟
<codenoid_> lol, it's actually will be used as String
<codenoid_> nvm,
codenoid_ has quit [Quit: i sleep in my keyboard]
hightower2 has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <hfabre> Hi guys. Anyone could tell me where this error comes from ? ```Error in src/crplat-qt.cr:1: while requiring "prelude": can't find file 'prelude' relative to '/home/hfabre/local/projects/crplat-qt/src'```
<FromGitter> <hfabre> I got it in an almost empty project with crystal 0.24.1 qt5 shard
<FromGitter> <hfabre> (Here is the line in src/crplat-qt.cr:1 `require "./crplat-qt/*"`)
<FromGitter> <straight-shoota> @hfabre looks like your crystal path is messed up
<FromGitter> <straight-shoota> what does `crystal env` show?
<FromGitter> <straight-shoota> @barachy had a similar error a few days ago https://gitter.im/crystal-lang/crystal?at=5a8516aece68c3bc748af7cb
<FromGitter> <straight-shoota> are you on arch, too?
<FromGitter> <hfabre> @straight-shoota I'm on ubuntu 17, my crystal env looks good
qard has joined #crystal-lang
<FromGitter> <hfabre> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a8b2802888332ee3aa57f8f]
<FromGitter> <straight-shoota> so `/home/hfabre/.anyenv/envs/crenv/versions/0.24.1/src/prelude.cr` exists?
<FromGitter> <hfabre> ouch, looks like I got a problem with crenv haha
<FromGitter> <hfabre> I don't have any src folder
qard has quit [Client Quit]
qard has joined #crystal-lang
<FromGitter> <hfabre> ```$ ls /home/hfabre/.anyenv/envs/crenv/versions/0.24.1 ⏎ bin lib share``` [https://gitter.im/crystal-lang/crystal?at=5a8b2923888332ee3aa5867f]
<FromGitter> <hfabre> Hmm same after reinstalling, it looks like a crenv/crystal-build issue doesn't it ?
<FromGitter> <hfabre> anyway I'm going to see if I can solve this, thanks for pointing me in the right direction !
<FromGitter> <straight-shoota> good look
<FromGitter> <straight-shoota> I've never used crenv and I don't know why I would need it
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
sz0 has joined #crystal-lang
Papierkorb has left #crystal-lang ["Konversation terminated!"]
bijan_ has joined #crystal-lang
duane has quit [Ping timeout: 256 seconds]
alex`` has quit [Quit: WeeChat 2.0.1]
alex`` has joined #crystal-lang
<FromGitter> <hfabre> Ruby habits but it may not be that important to be able to manage multiple crystal version on the same machine. Thanks @straight-shoota :)
<FromGitter> <straight-shoota> at least not currently. should always use the latest one.
hightower2 has joined #crystal-lang
bijan_ has quit [Quit: System has gone to sleep. ZZZzzz…]
<FromGitter> <hfabre> 👍
alex`` has quit [Ping timeout: 256 seconds]
alex``` has quit [Ping timeout: 260 seconds]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
bijan_ has joined #crystal-lang
moei has quit [Quit: Leaving...]