ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.34.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
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter> <stellarpower> Good thing my cat's not around
duane has joined #crystal-lang
duane has quit [Ping timeout: 256 seconds]
rocx has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> ☝️ https://gitter.im/crystal-lang/crystal?at=5ec70908ff7a920a72039826 i reverted this feature, at least for the `overload` use case. As i realized that it already works that way so this would just be redundant
renich has joined #crystal-lang
_whitelogger has joined #crystal-lang
renich has quit [Quit: renich]
DTZUZO has joined #crystal-lang
zorp_ has quit [Ping timeout: 240 seconds]
DTZUZO_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
DTZUZO_ has quit [Ping timeout: 260 seconds]
DTZUZO_ has joined #crystal-lang
sz0 has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 272 seconds]
narayana has joined #crystal-lang
<narayana> Anyone using crystal for scripting ?
_ht has joined #crystal-lang
<jhass> why would I if I have ruby?
<jhass> but maybe our definitions of scripting differ
<narayana> For like general linux admin stuff.
<narayana> Is it a good or bad idea to use `crystal run` over ruby ?
<jhass> well, most of these tasks are IO bound rather than CPU bound
<jhass> and don't require low level programming either
<jhass> so it's a question of whether crystal can compile faster than ruby can boot up
<jhass> and to be honest that's not the case
<narayana> Ahhh ok
<jhass> now if you'd have something that you execute very regularly, the same command, maybe with a couple of command line options, then you can precompile and optimize the crystal thingy and the resulting binary will indeed do bootup much faster than ruby
<jhass> to me "scripting" is not a very well defined task, I pick the language on the actual task at hand
<jhass> if all I do is spawn a bunch of other commands, rename a file, invoke something on it, pass its output to something else, I still write shell scripts because that's what shells are built for
<jhass> I basically always have a pry session open for little one of thingies and as a calculator
<jhass> for something IO bound I still pick ruby, also because it's more available
<narayana> Very insightnful thanks
<jhass> and turns out I don't write reusable CLI utilities much, so I rarely pick Crystal in that domain, but might be a possibility
<narayana> Just did a quick test yea ruby is much faster and more light weight to run a hello world script
<jhass> yeah and now compare to crystal build --release hello_world.cr; time ./hello_world
<jhass> so if you invoke hello_world a thousand times in a loop...
<narayana> ❯ time ./hello_world
<narayana> Hare Krsna World!
<narayana> './hello_world' time: 0.002s, cpu: 180%
DTZUZO has quit [Ping timeout: 265 seconds]
<narayana> './100xHello-cr.sh' time: 1:08.45s, cpu: 140%
<narayana> './100xHello-ruby.sh' time: 3.362s, cpu: 99%
<narayana> './100xHello-cr-build.sh' time: 0.139s, cpu: 136%
<jhass> nothing too surprising
<jhass> I guess our cache works better than I would've thought
<jhass> oh wait, that's over a minute, haha
<FromGitter> <stellarpower> I was actually wanting to use crystal for scripting. I'm bothered about development speed, not runtime speed. I start projects as shell scripts because that's what I wanna write but it quickly becomes a real pain not having access to features of a real language
<jhass> yeah, if I can forsee it becoming more complex than like five ifs I tend to just start in ruby
<livcd> I dont use sh for anything. It's an abomination that needs to die.
alexherbo2 has joined #crystal-lang
<raz> pro-tip just write your scripts in the subset of crystal that also runs as ruby. :p
<raz> you can even put #!/usr/bin/env ruby at the top, as crystal will ignore that as a comment
<FromGitter> <stellarpower> Thank you!! I think some of these concepts have been around for so long and it's just people don't question to change things because they're well-used
<FromGitter> <stellarpower> Like I am on a chat server at my university and saying I don't like python at all is controversial.
<FromGitter> <stellarpower> Yes bash is a useful skill because it is everywhere if you're doing sysadmin stuff but if I said like you I'd rather get rid of it people would get antsy
<FromGitter> <stellarpower> I was hoping to knock together a little shard to make running shell-type stuff a bit easier
<FromGitter> <stellarpower> Ruby is what I would use but it's a little clunky getting popen3 working fully
<FromGitter> <stellarpower> I was hoping I could do something in crystal that would nicely wrap system commands and overload the or operator to pipe automatically
<FromGitter> <stellarpower> @raz is that if you explicitly call crystal on the file with the shebang?
DTZUZO has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
DTZUZO_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 256 seconds]
<kevinsjoberg> Have anyone read the "Programming Crystal" book? If so, I have a question; The book states Crystal does not have global variables but doing a regex match allow you to use $1, $2 and so on to reference matches. Aren't they global variables?
<kevinsjoberg> Oh, doing some investigation on my own it looks like the regex variables aren't really "global" but method local.
_whitelogger has joined #crystal-lang
rocx has joined #crystal-lang
<oprypin> kevinsjoberg, see "The roundup of $" from https://github.com/crystal-lang/crystal/issues/4715
<oprypin> (with the `$0` entry being outdated, of course, as per the issue)
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Client Quit]
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
<raz> i love how every little thing gets such an elaborate explanation/discussion in crystal
<raz> not all languages have that culture, it's a great asset
duane has joined #crystal-lang
<raz> stellarpower: sorry, i was only tongue in cheek there. ;) while hybrid ruby/crystal scripts are possible, i don't think that's a maintainable idea :D
<FromGitter> <stellarpower> Oh yes, was just curious, I remember reading that the shebang is done by the kernel somewhere and not the running shell
<FromGitter> <stellarpower> Some langs explicitly handle a shebang line and others need a bit of help, I saw a video about go w.r.t that
<FromGitter> <stellarpower> I like it too
<FromGitter> <stellarpower> I am keen on C++, it seems fewer and fewer reasons to use it but it make me think more than I type
<FromGitter> <stellarpower> I helped debug someone's code the other day without a compiler and I got to the root of the problem just from reading.
<FromGitter> <stellarpower> I can't do that nearly as easily with Python.
<FromGitter> <stellarpower> It makes one a better programmer I think to understand the theory and why things are that way. Conversely it's good for people in a domain to be able to have that abstracted
<FromGitter> <stellarpower> I was actually porting something I wrote form python and the quickest thing was to use an automated Py->Rb script, make a few edits until it parsed okay, then point Crystal at it and start tidiyng up and then will go into the runtime issues and putting back in shards or standard library classes that do the equivalent
renich has joined #crystal-lang
raz has quit [Ping timeout: 260 seconds]
raz has joined #crystal-lang
raz has quit [Ping timeout: 264 seconds]
raz has joined #crystal-lang
<kevinsjoberg> oprypin: Thanks for that. :)
raz has quit [Ping timeout: 260 seconds]
raz has joined #crystal-lang
raz has quit [Ping timeout: 260 seconds]
raz has joined #crystal-lang
raz has quit [Ping timeout: 256 seconds]
raz has joined #crystal-lang
raz has quit [Ping timeout: 272 seconds]
raz has joined #crystal-lang
raz has quit [Ping timeout: 256 seconds]
<FromGitter> <confact> Does it exist some way to have a timer with a "hook" or call a method when that timer is reached?
raz has joined #crystal-lang
<FromGitter> <Blacksmoke16> like js timeout?
<FromGitter> <Blacksmoke16> setTimeout
<FromGitter> <Blacksmoke16> prob could do something with a proc/fiber
<FromGitter> <Blacksmoke16> but :shrug:
raz has quit [Ping timeout: 256 seconds]
raz has joined #crystal-lang
<FromGitter> <naqvis> 😺
zorp_ has joined #crystal-lang
<yxhuvud> stellarpower: I find the `Process.spawn` to be the best way of doing processes in Ruby, especially when you need some extra bling for doing redirections.
duane has left #crystal-lang [#crystal-lang]
raz has quit [Ping timeout: 246 seconds]
raz has joined #crystal-lang
<ryanprior> I'm interested in creating some desktop environment oriented flows in my app- for example, opening a link in the default browser, getting the name of the current browser, copying text to the clipboard, etc.
<ryanprior> I can do that by shelling out to utils like `xdg-open`, `xdg-mime`, `xsel`- that's what they're for after all. But do you know if anybody's written Crystal wrappers for those things, or a library that handles those kinds of interactions?
raz has quit [Ping timeout: 256 seconds]
<jhass> @confact: spawn { sleep X; hook; }
raz has joined #crystal-lang
<FromGitter> <stellarpower> @yxhuvud cheers!
<FromGitter> <stellarpower> Looks somewhat like Process in crystal
renich has quit [Ping timeout: 265 seconds]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
_ht has quit [Quit: _ht]
renich has joined #crystal-lang
hightower2 has joined #crystal-lang