willl has quit [Quit: Connection closed for inactivity]
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Philpax has joined #crystal-lang
Ven has quit [Ping timeout: 248 seconds]
bjz has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 252 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
bjz has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Client Quit]
bjz has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
Ven has joined #crystal-lang
soveran has quit [Ping timeout: 246 seconds]
Ven has quit [Ping timeout: 248 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
pawnbox has joined #crystal-lang
Kug3lis has joined #crystal-lang
Kug3lis is now known as Kug3lis_off
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
Ven has quit [Ping timeout: 264 seconds]
vivus-ignis 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: 248 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
DTZUZU2 has quit [Read error: Connection reset by peer]
Kug3lis_off is now known as Kug3lis
Kug3lis is now known as Kug3lis_off
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
triangles2 has quit [Quit: Leaving]
Ven has joined #crystal-lang
mahlgrimm has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Ven has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
Raimondii has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Ven has joined #crystal-lang
pawnbox has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
pawnbox has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
Ven has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 256 seconds]
Ven has quit [Ping timeout: 264 seconds]
Ven has joined #crystal-lang
DTZUZU2 has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
bjz_ has quit [Ping timeout: 256 seconds]
bjz has joined #crystal-lang
vivus-ignis has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
Ven has quit [Ping timeout: 259 seconds]
soveran has quit [Remote host closed the connection]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
soveran has quit [Remote host closed the connection]
mahlgrimm has quit [Quit: mahlgrimm]
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
DTZUZU2 has quit [Ping timeout: 260 seconds]
<crystal-gh>
[crystal] ysbaddaden opened pull request #3818: Fix: SO_REUSEPORT may not be supported by the OS (master...fix/sockets-so-reuseport-may-not-be-supported) https://git.io/vMtxL
<crystal-gh>
[crystal] ysbaddaden closed pull request #3818: Fix: SO_REUSEPORT may not be supported by the OS (master...fix/sockets-so-reuseport-may-not-be-supported) https://git.io/vMtxL
soveran has quit [Remote host closed the connection]
DTZUZU2 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<FromGitter>
<hdogan> hello, new to crystal here. i'd like to know how to limit and determine timeouts for `Process.run`.
<RX14>
i don't think there is a timeout option for process.run
<RX14>
you would have to do Process.new and manually wait for completion
<splitty_>
hdogan, you could probably spawn the process, then wait for the specified timeout while querying .terminated, and then killing the process if it's still alive
<RX14>
yup
<RX14>
there's an internal Channel used for waiting... Eventually we can implement select_action for that
<RX14>
and do select; when process.wait; when timeout.seconds; process.kill; end;
<RX14>
but not yet
<FromGitter>
<hdogan> i've tried STDOUT.write_timeout and put STDOUT as an output option but it does not work :/
<RX14>
as I said you'll have to use Process.new and use a sleep loop
<dbohdan>
Papierkorb: Are there any major corner cases at this point?
mahlgrimm has quit [Quit: mahlgrimm]
<RX14>
i can't think of any off the top of my head
<Papierkorb>
dbohdan: TL;DR: 1) No real (usable) threading 2) Effective max count of concurrent fibers is 32k 3) You can't `select` on an IO yet (RX14 was working on this though) 4) Same pros and cons as Go-langs "threading" model afaik 5) Of course, APIs may not be stable yet 6) stdlib docs is sometimes lacking, forcing you to read (Crystal) code 7) There's not yet a shard for everything (like there is a gem for almost everything in ruby)
<Papierkorb>
dbohdan: Nothing that should prevent you from having a look, and nothing that should be a surprise given Crystal is a Alpha/Beta state language
Ven has joined #crystal-lang
<RX14>
well the only "concurreny corner case" out of that is the effective concurrent fibers count imho
<RX14>
but yes those are pretty much the cons of crystal with a focus on cuncurrency and IO
<Papierkorb>
dbohdan: However, some of the pros of Crystal imho are: 1) It's somewhat near Ruby, if you like Ruby, you'll like Crystal 2) Type system 3) it's surprisingly fast tbh
<dbohdan>
Papierkorb: Thanks! That's a really helpful answer.
<Papierkorb>
dbohdan: For example, I've written a BitTorrent shard, which if you only compare CPU load, easily outperforms KTorrent (Using a third of the CPU load in fact). Take it with a grain of salt, my code is not as mature as KTorrents, neither do I draw a GUI. Still, I would lie if I'd say I wasn't somewhat impressed
<dbohdan>
The funny thing is, I've never been much of a Ruby user outside Vagrantfiles and the occasional shell script but now two of the languages I'm most interested in are influenced by Ruby. :-)
<Papierkorb>
dbohdan: Also please note that you can use Crystal perfectly fine for non-web-development things. In fact, I didn't write a single web service in it yet.
Ven has quit [Ping timeout: 258 seconds]
<BlaXpirit>
neither did i :)
<RX14>
dbohdan, whgich is the other lang influenced by ruby?
<dbohdan>
RX14: Elixir.
<RX14>
oh yes
<RX14>
elixir feels a lot less ruby to me
<Papierkorb>
Just wanted to point that out, as many think that Ruby and Crystal are "web dev only" languages. (I never got what that's supposed to mean either)
<RX14>
yeah if anything crystal is most optimized for writing compilers
<RX14>
:)
<Papierkorb>
haha
<Papierkorb>
Yeah and it's LLVM bindings are really good too :P
<Papierkorb>
*its
<Papierkorb>
Oh and I forgot to mention that interfacing with C libraries is pretty good in general dbohdan. Writing wrappers is really easy IMO, and there's more to come for this too
<dbohdan>
I'm very biased here, but if you're looking for a simple C API to add a GUI to your BitTorrent client, try Tcl/Tk's.
<RX14>
well libui has cryatal bindings
<RX14>
i'm not sure how they compare
<RX14>
but thats another option
<dbohdan>
Modern Tk will look pretty good on Windows/macOS and not entirely horrific on Linux.
<Papierkorb>
it's a library and not meant to be used on its own (Oh right, I have to ask the awesome-crystal maintainer to move it into the network section too), but having a solid UI shard would be much appreciated dbohdan
<dbohdan>
If I get deeper into Crystal, I might write the bindings. As I said, having a language that isn't C to interact with the Tcl interpreter is a major reason I'm looking at Crystal.
<RX14>
the libui shard even has a yaml format for describing interfaces aparrently
<RX14>
so its had quite a bit of work
<Papierkorb>
dbohdan: Do you want to embed tcl or embed crystal into tcl?
<dbohdan>
Both, but embedding non-C in Tcl is more interesting to me.
<dbohdan>
If I have the time, I'll see if I can do it in a reasonable manner with a C shim.
<Papierkorb>
Well, Crystal requires libgc (boehm gc) and libevent2 (most likely) among other libs. The first one requires set up by you (at least, calling crystals setup functionality for it), the second may or may not play ball with tcl
<Papierkorb>
The other libs, like libpcre, shouldn't make much trouble though
<Papierkorb>
Also I don't know if boehmgc likes being used in a library only, not that it starts running around breaking the host process :)
<dbohdan>
I think I've actually tried replacing malloc/free with libgc in a Tcl extension once and it seemed to work. I wonder about how libevent2 will interact with Tcl's own event system.
vivus-ignis has joined #crystal-lang
<RX14>
if it doesn't workm you can avoid the scheduler pretty easilly
<Papierkorb>
Also, the compiler will not let you build shared libs by itself. Instead, pass `--cross-compile` to the `crystal build` command, and link the resulting .o yourself. The compiler will tell you the `gcc` link invocation it would've used, so you can adapt it easily
<Papierkorb>
dbohdan: Oh, and fibers may or may not work. In the end, they're stack pointer magic, so it could, but may conflict with the tcl interpret
<dbohdan>
I'll remember to pass '--cross-compile'.
<dbohdan>
As for the stack magic, what would be a good way to debug it if it doesn't work out of the box?
<RX14>
well, if it segfaults when you use IO, set blocking = true on the IO is pretty much the best bet
<dbohdan>
Noted, but I mean more if there is a build option to make the code run in some sort of a scheduler debug mode or something like that.
<RX14>
no
dhk has quit [Quit: Leaving]
<dbohdan>
Got it.
<dbohdan>
As for web dev, that's what I'm primarily learning Elixir and the OTP for.
<RX14>
yeah crystal needs more work in web dev
<RX14>
i wouldn't say it's a particularly good web dev lang even
<Papierkorb>
FTFY „yeah crystal needs more work“
<RX14>
i'd much rather be pushing something machine-readable out of crystal than HTML
<dbohdan>
It's something of a truism that the Erlang VM, BEAM, is too slow for computation-heavy code. (About as slow as Ruby, Python, Tcl, Perl and the rest. Sometimes better and sometimes worse than each of them.)
<Papierkorb>
RX14: Same
<dbohdan>
Crystal could once again be useful a non-C language in which to talk to BEAM.
<RX14>
ECR is sort of a pain
<RX14>
slang sort of works
<RX14>
but it's buggy and not really cared about
<RX14>
neither does it seem to learn any lessons from jade
<Papierkorb>
I need a HAML dialect and basically Roda to even consider using Crystal
<dbohdan>
*useful as a
<RX14>
which i consider to be far superior to slim
<Papierkorb>
But as I don't want to build neither, ... ;)
<Papierkorb>
*either
<RX14>
jade is like slim but with templates and partials built in
<RX14>
so you don't haver any of the yield hacks
<RX14>
which become much more of a problem when you're codegenning at compile time
<RX14>
i have so many crystal projects I want to do
<RX14>
but no time
<RX14>
too busy procrastinating
<Papierkorb>
RX14: well you can cache the generated ruby code
<Papierkorb>
Which I was amazed to find out that it was not done from the start
<RX14>
??
<Papierkorb>
From haml, etc. Then it still does yield of course, but it's less expensive
<RX14>
yes but the problem is not the speed
<RX14>
it's the ugliness
<RX14>
jade just seems to be a cleaned up slim
<RX14>
and i love it
<dbohdan>
Could you embed a Ruby interpreter in your Crystal application for the HTML templating?
<Papierkorb>
Technically, yes
<RX14>
probably but I don't think I would
<Papierkorb>
Though mruby would be better, MRI uses globals etc.
<RX14>
yeha it would be mruby
<Papierkorb>
In practice, I would neither
<dbohdan>
Is mruby thread safe? I recall reading it wasn't.
<RX14>
just careate one per thread then
<RX14>
or something
<Papierkorb>
If templating is the only use-case, maybe Lua or so
<RX14>
thread-local vars exist in crystal
<RX14>
i would just make my own interpreter
<RX14>
have stuff be passed to the template as a hash or named tuple or sth
<dbohdan>
"One thing I care about is thread safety. I need to run multiple mruby instances, each in a thread, and there will be no interaction across threads. If mruby cannot support this use case then I’ll have to use other solutions. Luckily, the code base of mruby is not big, so I checked all of its source code. There is only a few static non-const variables, which is only used for GC statistics. So I can
<RX14>
and then make the template be able to access that
<dbohdan>
I guess it can be done with mruby.
<RX14>
i'd still make my own minimal expression language
<RX14>
wouldn't even really be turing complete probably
<RX14>
well not for a single expression
<RX14>
the template itself would be
bjz has quit [Ping timeout: 245 seconds]
<dbohdan>
I'll try using Crystal with Elixir first because the standard practice in Erlang-land is to start an external process and talk to it over its stdin/stdout rather than load a shared library.