<FromGitter>
<Blacksmoke16> idt theres a way to do that in the stdlib
<FromGitter>
<Blacksmoke16> so would have to either like make some sys calls, bind to some c lib, or user a shard that provides it
<irc_user>
Ah okay, thank you!
ur5us has quit [Ping timeout: 258 seconds]
typeof[panda] has joined #crystal-lang
typeof[panda] has quit [Quit: Client closed]
notzmv has quit [Ping timeout: 260 seconds]
<irc_user>
Sorry but I just can't figure out how to run a process and get stdout. Is it not `output = Process.run(command = "tput", args = ["lines"], output = Process::Redirect::Pipe)`?
<FromGitter>
<remiliascarlet:nanako.mooo.com> I think the most simple way to do that is to just use backticks, like "output = `ls -l /`", like in Ruby. The $? variable can also be used to check that the process worked.
<FromGitter>
<Blacksmoke16> there's also a block overload of `run` that exposes the output as it happens versus all at once
<irc_user>
The backticks thing is pretty awesome. Crystal seems like it might even beat Python in some scripting use cases.
<FromGitter>
<remiliascarlet:nanako.mooo.com> The ioctl thing probably won't work outside of linux
<irc_user>
I was trying to make a syscall to ioctl earlier but gave up because the docs said it would only work on Linux, but I'll save that snippet anyways as I'm sure it'll come in handy
<FromGitter>
<Blacksmoke16> if you just want to print it to the output of the parent process you can set `output: :inherit`
<irc_user>
I'm coding game of life to try crystal out so I ended up doing: rows = `tput lines`.to_i; cols = `tput cols`.to_i; game = Game.new rows - 2, cols - 2
<FromGitter>
<Blacksmoke16> are some CLI shards out there if that would help
<irc_user>
Well I've got it up and running now so I'll probably look into those for the next project. This lang is awesome, I almost can't believe it's typed.
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> it works out well, but ofc not without its cons
<irc_user>
What would you say the main cons are, if you don't mind me asking?
<FromGitter>
<Blacksmoke16> compile times, smaller ecosystem, and still maturing language features/platform support
<FromGitter>
<Blacksmoke16> nothing really blocking, at least for majority of use cases
<irc_user>
Ah, I see. Well the docs have had pretty much everything I've needed, apart from the terminal size thing which is probably a pretty niche use case. I did notice that the compile times are high, even for just a simple puts "hello world". But I mean, considering how much faster it is to write (so far), I'd say it seems to be a worthwhile tradeoff.
<irc_user>
I wanted to give lisp/scheme a serious shot, and I think I still will, but this seems like it might be a better candidate to chase the snappy TUI text editior pipedream XD
<FromGitter>
<Blacksmoke16> yea, just takes a bit of a diff workflow. write a bunch more before testing
<FromGitter>
<Blacksmoke16> larger apps it can be dozen(s) seconds, in non-release mode too
<FromGitter>
<Blacksmoke16> is some experimental interpreter support too, but still quite a bit of work to do on that
<irc_user>
I'll keep that in mind, thanks. I'd like to think I'm good enough at coding now to do it in bigger chunks but my appending the same row to a matrix 10 times and wondering why all the columns kept coming out as identical for an hour makes me think otherwise haha.
<FromGitter>
<remiliascarlet:nanako.mooo.com> Yeeaahhhh... a release build of my unfinished port of Doom takes 21 minutes on my i9 ^_^; A debug build is only 5-6 seconds, though.
notzmv has joined #crystal-lang
<irc_user>
That sounds like an awesome project
<irc_user>
21 minutes is quite steep too
ur5us has joined #crystal-lang
_ht has joined #crystal-lang
ur5us has quit [Ping timeout: 244 seconds]
pusewic|away__ has quit [Read error: Connection reset by peer]
pusewic|away__ has joined #crystal-lang
jmdaemon has quit [Ping timeout: 272 seconds]
<FromGitter>
<grkek> Hi there
<FromGitter>
<grkek> Haven't been here for a while
<FromGitter>
<grkek> @jrei:matrix.org How are you?
wwalker has quit [Remote host closed the connection]
<SamantazFox_>
<Blacksmoke16> larger apps it can be dozen(s) seconds, in non-release mode too <- Minutes, even!
<FromGitter>
<Blacksmoke16> indeed
<irc_user>
Building strings with `+=` surprisingly appears to be really slow compared to node, is there a faster way to do it? Can provide example if that helps.
<FromGitter>
<Blacksmoke16> via like `yield definition` or `yield language`
<FromGitter>
<dorianmariefr> yeah I saw a PEG library did that, not a big fan, my rules are already hard to read :D
<FromGitter>
<Blacksmoke16> another option is to take a step back and consider alternative options versus porting things 1:1
<FromGitter>
<dorianmariefr> I was thinking I could also write with macros
<FromGitter>
<dorianmariefr> It's the base of multiple languages I'm thinking of writing, so I want the DSL to be nice, very inspired by parslet in ruby I admit
<FromGitter>
<dorianmariefr> It's the first PEG I'm writing and the hard part is more into the parser itself, like building atoms, still unsure how to do that
<FromGitter>
<Blacksmoke16> like does `Definition` actually have a `#any` method?
<FromGitter>
<remiliascarlet:nanako.mooo.com> Line 21
<FromGitter>
<Blacksmoke16> there's no captured blocks in that example tho, so works just as good without it
<FromGitter>
<remiliascarlet:nanako.mooo.com> Oh whoops I copied the wrong code
<FromGitter>
<dorianmariefr> but yeah @Blacksmoke16 I thought I add an "Original Idea™️" but actually it becomes clearer and clearer I'm just porting parslet to crystal :D