ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
ur5us_ has joined #crystal-lang
ur5us_ has quit [Ping timeout: 260 seconds]
pusewic|away has quit [*.net *.split]
pusewic|away has joined #crystal-lang
dostoyevsky2 has quit [*.net *.split]
ulyssa has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
dom96 has quit [*.net *.split]
maxpowa has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
dostoyevsky2 has joined #crystal-lang
jrayhawk has joined #crystal-lang
dostoyevsky2 has quit [Changing host]
dostoyevsky2 has joined #crystal-lang
maxpowa has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
ulyssa has joined #crystal-lang
dom96 has joined #crystal-lang
avane has quit [Ping timeout: 252 seconds]
avane has joined #crystal-lang
ur5us_ has joined #crystal-lang
ur5us_ has quit [Read error: Connection reset by peer]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]
frojnd has quit [Quit: WeeChat 2.3]
Guest28 has joined #crystal-lang
Guest28 has quit [Client Quit]
SamantazFox has quit [Ping timeout: 252 seconds]
SamantazFox has joined #crystal-lang
dostoyevsky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
<FromGitter> <Dan-Do> What is the equavilent type of uintptr_t in crystal? Is it UInt32?
<FromGitter> <Dan-Do> Found it, `LibC::ULong`
repo has joined #crystal-lang
<repo> hey!
<riza> hey repo
<repo> i wanted to set up crystal with coc.nvim and thought i'd ask around if someone has a setup that works well
<xyhuvud> dan-do: I'd look into Pointer.
<riza> repo: I don't use coc, but the vim crystal plugin works well enough. I don't think the crystal binary quite has the full LSP pattern sorted out yet
<repo> yeah, ok
<FromGitter> <Dan-Do> @xyhuvud I used crystal_lib to generate the binding, it says `alias UintptrT = LibC::ULong`
<xyhuvud> weird. I'd have expected any pointers to be of Pointer type.
<FromGitter> <Dan-Do> The C fuction is `uintptr_t reindexer_init();`
<FromGitter> <Dan-Do> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6151f5a68065e87a8e077d1d]
<xyhuvud> I'm fairly confident that should return a Pointer to db.
<FromGitter> <Dan-Do> I used this shard `https://github.com/crystal-lang/crystal_lib`
<FromGitter> <Dan-Do> It generated ⏎ ⏎ ```alias UintptrT = LibC::ULong ⏎ fun init = reindexer_init : UintptrT``` [https://gitter.im/crystal-lang/crystal?at=6151f71b7cd57813a8ea8e92]
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> dumb question, how do i get the native endian-ness?
<FromGitter> <Blacksmoke16> isnt that just an alias to little endian?
<FromGitter> <Blacksmoke16> i dont think theres a way to just be like "automatically figure out and use which one these bytes are using"
<postmodern> appears so
<FromGitter> <djberg96> In Ruby it's `[1].pack(“I”) == [1].pack(“N”)`
<postmodern> guess I could use IO::ByteFormat to do the same trick
<repo> Blacksmoke16: isn't that technically platform dependent? i.e. if a system came along that crystal can compile to, where the endianness isn't little endian, that would be set at compile time (of crystal)
<FromGitter> <Blacksmoke16> my understanding is that it's not a system specific thing, but whomever's bytes you're consuming
<FromGitter> <Blacksmoke16> e.g. some image formats use little and other use big
<repo> afair there are some niche systems that use big endian
<riza> is there an equivalent of Ruby's Enumerable#inject? `[1,2,3].inject(&:+) #=> 6`
<FromGitter> <Blacksmoke16> `.sum`
<riza> sure. the sum operation here is an example
<FromGitter> <Blacksmoke16> in Crystal you'd want `#reduce`
<FromGitter> <Blacksmoke16> `#inject` is a Ruby alias to it
<riza> perfect, thank you
<riza> hm, the semantics are a little different it seems like, https://carc.in/#/r/byrs
<riza> oh weird
<riza> I wonder whats the use of a unary identity operator ... I have to assume it's for some sort of recursive expression
postmodern has quit [Read error: Connection reset by peer]
<FromGitter> <jwaldrip:matrix.org> well the gitter app doesnt work anymore :-)
<FromGitter> <jwaldrip:matrix.org> Question: seeing a weird behavior. When I start a process inside a thread and then subsequently try to wait on that process from other threads, it hangs... any idea on why that would be the case
<riza> gitter has existed in a state somewhere between working and non-working for years now
ur5us has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> jwaldrip (https://matrix.to/#/@jwaldrip:matrix.org): you say *thread*, not fiber? could easily be that it's not thread-safe
<FromGitter> <jwaldrip:matrix.org> sorry fiber
postmodern has joined #crystal-lang
<postmodern> lazy macro question, how do I enumerate all constants defined in a module?
<FromGitter> <Blacksmoke16> `MyModule.constants`
<FromGitter> <jwaldrip:matrix.org> or `@type.constants` within the module
<FromGitter> <jwaldrip:matrix.org> ```for c in @type.constants do```
ur5us has quit [Ping timeout: 245 seconds]
<postmodern> and how do i determine the type of the IO::Error? I'm guessing #os_error ? Need to detect Errno EPIPE
hightower2 has joined #crystal-lang
<riza> yeah, compare it against: https://crystal-lang.org/api/1.1.1/Errno.html
<FromGitter> <jwaldrip:matrix.org> What are you building over there postmodern?
<FromGitter> <jwaldrip:matrix.org> Love all your ruby related work :-)
<postmodern> jwaldrip, tryng to port some of my ruby code. it's proving to be a bit tricky. https://github.com/postmodern/hexdump.rb and https://github.com/postmodern/command_kit.rb
<FromGitter> <jwaldrip:matrix.org> Second one looks a little like one of mine: https://github.com/jwaldrip/admiral.cr
ur5us has joined #crystal-lang
<postmodern> yep, i recommended admiral while i was building command_kit. command_kit is implemented entirely as modules, so you can strip it down to bare basics if need be. and plus i implemented all of the bells and whistles you'd want for CLI apps (well still haven't rolled my own simple progress bar yet...)
hightower2 has quit [Ping timeout: 245 seconds]
<riza> i loved working on this: https://github.com/robacarp/keimeno
<postmodern> bummer, you still can't convert NumberLiteral's to ASCII chars?
<riza> what do you mean
Volk has quit [Quit: See you next time!]
<FromGitter> <Blacksmoke16> there's also Athena Console :) Just not technically released yet...
<postmodern> riza, {% for char in (0..255).map(&:chr) %}
<postmodern> just curious why crystal doesn't have a #system method for running commands?
<FromGitter> <Blacksmoke16> it has like 3
<postmodern> oh derp .system, not #system
<FromGitter> <Blacksmoke16> it's a top level method so `system`
<postmodern> is flag?() still the best way to detect build platform?
<FromGitter> <Blacksmoke16> there's also backticks and ofc `Process.run`/`Process.wait`
<postmodern> i also take it Process.quote is similar to ruby's `Shellwords.shellescape`?
hightower2 has joined #crystal-lang
<riza> postmodern: it's not elegant at all but I think you can do something like this: for char in (0..255).map(&.to_number).map(&.chars).map(&.first)
<riza> well, that ... isn't what you wanted
<riza> nevermind
<postmodern> yeah need the ascii Char for each byte
wmoxam has quit [Ping timeout: 250 seconds]
wmoxam has joined #crystal-lang
<postmodern> does crystal stdlib have something that will return the winsize of the terminal via termios? I see a termios module.
<FromGitter> <Blacksmoke16> Not that I'm aware
<riza> sending the raw escape codes
<postmodern> i'll probably write some C bindings to termios. might be useful to others.
<riza> it's a mess
<postmodern> er wait, i already wrote that code in ioctl.cr
<riza> I'm not saying that it's the most straightforward way to do it but this is what I ended up for requesting the cursor position: https://github.com/robacarp/keimeno/blob/master/src/keimeno/base.cr#L260-L278
<postmodern> `{% if !@type.superclass.nil? && @type.superclass < ClassMethods %}` am i doing this correctly? that should check if the superclass also extends Class
<postmodern> *ClassMethods
<FromGitter> <Blacksmoke16> what are you wanting to do?
<postmodern> have a class method that will check a class-variable, but if it's nil, try calling the superclass's class-method and repeat the process down the ancestors list until we hit a superclass which does not extend ClassMethods
deavmi_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> you cant access class vars in a macro
<FromGitter> <Blacksmoke16> so not sure how you're planning to do that
deavmi has joined #crystal-lang
<FromGitter> <Blacksmoke16> wouldnt that just be like `self.method_name || super`
<FromGitter> <Blacksmoke16> or something like that
<postmodern> i was thinking something like this, but i'm probably not doing it correctly: https://carc.in/#/r/byt9
Starfoxxes has quit [Ping timeout: 264 seconds]
Starfoxxes has joined #crystal-lang
oprypin has quit [Remote host closed the connection]
oprypin has joined #crystal-lang
jhass[m] has quit [Ping timeout: 246 seconds]
jhass[m] has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]