RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
jokke has quit [Quit: WeeChat 2.3]
jokke has joined #crystal-lang
Kixune has joined #crystal-lang
Kixune has quit [Quit: Kixune]
early` has quit [Quit: Leaving]
early has joined #crystal-lang
laaron- has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 246 seconds]
DmitryBochkarev has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <Zenohate> Hello here
<FromGitter> <Zenohate> I wanted to know what would be thought of changing the way UDP sockets are implemented in Crystal because for now the implementation is extremely slow and low throughput
<FromGitter> <Zenohate> I was thinking of proposing a variant of receive that may fetch multiple messages, using rcvmmsg on Linux and rcvmsg elsewhere
<FromGitter> <vladfaust> @Zenohate https://github.com/crystal-lang/crystal/pull/7423
<FromGitter> <Zenohate> It has nothing to do with multicasting, it is about minimizing the number of system calls
<FromGitter> <vladfaust> Ah, sorry, I don't know much about UDP 😅
<FromGitter> <Zenohate> Basically, for now, with all the tests I did, because Crystal does a system call for every call to receive, and receives packets individually, you are pretty much bottlenecked at around 30k UDP packet received, which is not a lot
<FromGitter> <Zenohate> The measured latency between receiving and sending back was low enough that we should expect more than thrice that amount
<FromGitter> <Zenohate> Namely, the time between sending the request and receiving the response was about 3 microseconds
<FromGitter> <Zenohate> It means the server wastes lots of time between requests
<FromGitter> <Zenohate> And the place where it happens may only be in system calls that wait to receive new packets
<Yxhuvud> zenohate: I'd open an issue. Likely, not many people have actually done a lot with UDP so people would likely be open to improvements.
<hoffentlichja> I was just asking myself the last few days if Crystal already has everything necessary net stack wise, to implement something like a game server in it
_whitelogger has joined #crystal-lang
<FromGitter> <Zenohate> hoffentlichja: it technically does if your game server doesn't require to handle too much clients
early has quit [Quit: Leaving]
early has joined #crystal-lang
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
<FromGitter> <codenoid> hi please help our friend with your *star* ⏎ ⏎ https://github.com/996icu/996.ICUhttps://996.icu/#/en_US ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5c9de47d0b3b8749f4e03345]
Flipez has quit [Quit: The Lounge - https://thelounge.github.io]
Flipez has joined #crystal-lang
Flipez has quit [Quit: The Lounge - https://thelounge.github.io]
Flipez has joined #crystal-lang
<FromGitter> <j8r> wow there are like 1 new star per second :o
mps has joined #crystal-lang
blassin has quit [Quit: The Lounge - https://thelounge.chat]
blassin has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 272 seconds]
DmitryBochkarev has joined #crystal-lang
lucasb has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Kixune has joined #crystal-lang
<hoffentlichja> is there any module in Crystal's std to get access to different info about a *nix system? node, cpu, mem etc
<FromGitter> <bew> not in std, there is at least one or more shards that does that though!
<hoffentlichja> thanks I'll check
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 245 seconds]
DmitryBochkarev has joined #crystal-lang
Kixune has quit [Quit: Kixune]
<FromGitter> <TheOnlyArtz> `private` methods to classes in Crystal?
<FromGitter> <Blacksmoke16> what about them?
<FromGitter> <TheOnlyArtz> What's the syntax?
<FromGitter> <Blacksmoke16> `private def xx`
<FromGitter> <TheOnlyArtz> Thank you very much ❤️
<FromGitter> <Blacksmoke16> np
<FromGitter> <TheOnlyArtz> Hm.. I don't get it.
<FromGitter> <TheOnlyArtz> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9e4a0f5349305a4c8d78b8]
<FromGitter> <Blacksmoke16> whats the full code? looks like you're using `backend_helper` before its initialized
<FromGitter> <TheOnlyArtz> I'm using it in the code below that
<FromGitter> <TheOnlyArtz> https://ghostbin.com/paste/atxbf
<FromGitter> <Blacksmoke16> oh i think i see whats going on
<FromGitter> <TheOnlyArtz> hm ?
<FromGitter> <Blacksmoke16> ` @backend_helper = Backend::Helper.new(self)` how you pass `self to it
<FromGitter> <Blacksmoke16> my theory is that at the time `self` is passed to `new` `@beckend_helper` isnt initialized yet
<FromGitter> <Blacksmoke16> which seems to follow what the error message is
<FromGitter> <TheOnlyArtz> How would I fix that?
<FromGitter> <Blacksmoke16> whats the `Backend::Helper` look like?
<FromGitter> <TheOnlyArtz> https://ghostbin.com/paste/atxbf
<FromGitter> <Blacksmoke16> hmm
<z64> easy way out: `getter!` https://carc.in/#/r/6lzi
<z64> or similar `not_nil!` assertion
<FromGitter> <TheOnlyArtz> Isn't it bad to use not_nil?
<z64> your backend helper as written doesn't quite make sense because you're using instance variables in class methods, so i dont know what the intention is there. refactoring backend helper is also possible
<z64> maybe you didn't mean to write `def self.foo`, but you could keep that, and simply accept `server` as an argument
<FromGitter> <TheOnlyArtz> So those `self.` are ruining them?
<FromGitter> <TheOnlyArtz> makes sense
<z64> `def self.handle_handshake_client_type(server, message, client)`, and just call `Backend::Helper.handle_handshake_client_type(@server, msg, client)`
<z64> *`Backend::Helper.handle_handshake_client_type(self, msg, client)`
<FromGitter> <TheOnlyArtz> I rather not pass the server each time
<FromGitter> <TheOnlyArtz> I just won't use class variables
<z64> you're already not using them :P
<FromGitter> <TheOnlyArtz> I do?
<FromGitter> <TheOnlyArtz> I'm not using *instance* methods
<FromGitter> <Blacksmoke16> you're using *only* instance methods :P
<FromGitter> <TheOnlyArtz> uh damn
<z64> no, `@var` is an *instance* variable. `@@var` is a class variable
<FromGitter> <Blacksmoke16> er nvm
<FromGitter> <Blacksmoke16> backend helper methods are class vars
<FromGitter> <TheOnlyArtz> ^
<FromGitter> <Blacksmoke16> could prob do like
<FromGitter> <j8r> better to use `as()` than `not_nil!`. Or the best, discriminate the types and raise a proper exception
<z64> in general, yes. it won't ever be nil though in this case
<FromGitter> <TheOnlyArtz> So I can't do what I want to?
<FromGitter> <TheOnlyArtz> I want to pass the server to the `Backend::Helper`
<z64> you can do that. but that isn't what you've written.
<z64> you're confusing class methods and instance variables
<z64> just remove `self.` and it would work fine
<FromGitter> <TheOnlyArtz> That's what I've done
<FromGitter> <TheOnlyArtz> https://hastebin.com/befurujagi.rb
<FromGitter> <TheOnlyArtz> https://hastebin.com/ihinazulez.rb
<FromGitter> <TheOnlyArtz> Guys?
<z64> ?
<FromGitter> <TheOnlyArtz> What can I do?
<FromGitter> <TheOnlyArtz> It doesn't work
<FromGitter> <TheOnlyArtz> Still getting that same error
<z64> did you ever add the nil assertion, `getter!`, or similar?
<FromGitter> <TheOnlyArtz> Where?
<FromGitter> <TheOnlyArtz> No
<z64> to the ivar you were having issues with
<FromGitter> <TheOnlyArtz> What's ivar?
<z64> instance variable
<FromGitter> <TheOnlyArtz> Can I get an example please?
<z64> i posted one before: https://carc.in/#/r/6lzi
<FromGitter> <TheOnlyArtz> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9e542c5349305a4c8dcbe1]
<FromGitter> <TheOnlyArtz> Like that right?
<z64> try it
<FromGitter> <TheOnlyArtz> I'm getting the same error.
<z64> are you using the getter you just made?
<FromGitter> <TheOnlyArtz> Same error
<FromGitter> <TheOnlyArtz> Same error.
<FromGitter> <TheOnlyArtz> https://hastebin.com/zokubidode.rb
<FromGitter> <TheOnlyArtz> https://hastebin.com/zokubidode.rb
<z64> you're not using the getter
<FromGitter> <TheOnlyArtz> What do you mean not using the getter? I'm literally doing what you've done in your example
<z64> when you use `getter`, `getter!`, etc, it wraps your access to the ivar in a method that basically does `@foo.not_nil!`, removing `Nil` from the type union. you need to call this method; this doesn't change how using the ivar directly works
<z64> you need to change `@backend_helper.foo` to `backend_helper.foo`
<FromGitter> <TheOnlyArtz> Oh yea
<FromGitter> <TheOnlyArtz> Thank you!
<z64> yw
<FromGitter> <TheOnlyArtz> Can I compile crystal to run on Windows?
<z64> you could. but there is only a very limited set of capabilities; so its probably not useful to you unless you are interested in helping to port the compiler/stdlib
<z64> more details on windows progress @ https://github.com/crystal-lang/crystal/issues/5430
<FromGitter> <TheOnlyArtz> 👌
<FromGitter> <TheOnlyArtz> Looks like the most recent update on that thread was 4 months ago
<FromGitter> <Maroo-b> Hey, ⏎ I'm getting this error when I try to build Crystal on Ubuntu 18.04 ⏎ `undefined reference to `LLVMInitializeInstCombine'`Any ideas?
<FromGitter> <Maroo-b> I'm using llvm version 6 for reference
<FromGitter> <r00ster91> @Maroo-b ah I had that too once. The solution is to use LLVM 6.0.1
<FromGitter> <r00ster91> there was a regression in 6.0.0
<FromGitter> <r00ster91> or you simply use an older llvm version
<FromGitter> <Maroo-b> @r00ster91 thanks! I'll update then to 6.0.1.
<FromGitter> <Maroo-b> it seems there in no 6.0.1 release for Ubuntu oO
<FromGitter> <tenebrousedge> @Maroo-b what does crystal --version say about LLVM?
<FromGitter> <Maroo-b> do you mean this line: ⏎ ⏎ ```Using /usr/bin/llvm-config-6.0 [version=6.0.0]``` ⏎ ⏎ ? [https://gitter.im/crystal-lang/crystal?at=5c9e5e11b7e27d2f05a447cc]
<FromGitter> <Blacksmoke16> he means like type `crystal --version`
<FromGitter> <Blacksmoke16> ```Crystal 0.27.2 (2019-02-05) ⏎ ⏎ LLVM: 6.0.1 ⏎ Default target: x86_64-apple-macosx``` [https://gitter.im/crystal-lang/crystal?at=5c9e5e375349305a4c8e16ca]
<FromGitter> <Maroo-b> my bad , it's 4.0.0
<FromGitter> <tenebrousedge> install llvm-4.0 and llvm-4.0-dev (not entirely sure if the latter is necessary) and compile with: ⏎ ⏎ ```make clean crystal LLVM_CONFIG=/usr/bin/llvm-config-4.0``` [https://gitter.im/crystal-lang/crystal?at=5c9e5e60b6711251984c0af9]
<FromGitter> <Maroo-b> thank you, I'll try it.
<FromGitter> <Maroo-b> thank you very much @tenebrousedge it worked :)
<FromGitter> <tenebrousedge> you're very welcome :)
RX14 has quit [Quit: Fuck this shit, I'm out!]
RX14 has joined #crystal-lang
<FromGitter> <HCLarsen> Hey folks. Does anyone know how to run command line commands in Crystal? Seems to be a lack of documentation around this, but I'm sure it's been done.
<FromGitter> <tenebrousedge> backticks or `system`, I gather https://github.com/crystal-lang/crystal/issues/586
<FromGitter> <r00ster91> It's documented in the API docs: https://crystal-lang.org/api/0.27.2/toplevel.html#system%28command%3AString%2Cargs%3Dnil%29%3ABool-class-method
<FromGitter> <HCLarsen> Thanks Rooster. I didn't think to look in the top level namespace.
rohitpaulk has joined #crystal-lang
<FromGitter> <HCLarsen> That only returns a bool though. What if I want to get the output back as a string?
<FromGitter> <HCLarsen> Nevermind, found it
RX14 has quit [Quit: Fuck this shit, I'm out!]
RX14 has joined #crystal-lang
_whitelogger has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 250 seconds]
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <drum445> What templating engine is most recommended, Jinja is excellent in Python, but that kind of engine doesn't work well in a strongly typed language
<FromGitter> <Blacksmoke16> take your pick :P
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <Blacksmoke16> is there a way to check for a constant on top level namespace from within a class/
<FromGitter> <Blacksmoke16> nvm
mps has quit [Quit: leaving]