<FromGitter>
<Blacksmoke16> for one slice is a struct while array is a class so how they get passed around is diff
<FromGitter>
<dscottboggs_gitlab> ok fair
<FromGitter>
<dscottboggs_gitlab> but they're both `Pointer`s to a buffer with bounds checking...
<FromGitter>
<Blacksmoke16> afaik a slice is just a safe way to use pointers
<FromGitter>
<Blacksmoke16> while an array is ofc more generic
<FromGitter>
<Blacksmoke16> i dont really know much more than whats on the api docs tho :p
<FromGitter>
<dscottboggs_gitlab> I was reading through the source and don't see a ton of difference besides that they're just different implementations and like you said that a Slice is a struct
<FromGitter>
<Blacksmoke16> is prob more methods related to dealing with pointers as well?
<FromGitter>
<dscottboggs_gitlab> yes, there is some of that
<woodruffw>
@dscottboggs_gitlab: just a guess, but maybe because the semantics of `hexdump`ing something really only apply to things that are already bags of bytes? but even still i could imagine it being useful to dump arbitrary slices
<woodruffw>
you could probably hack something together with `pointerof` and `sizeof`...
<FromGitter>
<jaydorsey> Good evening. Does anyone know if there’s a built-in library or shard to get the owner/group name back from a file? The File library only does ID’s and I’d like to get the name values
<woodruffw>
@jaydorsey does `File#info` have the detail you're looking for?
<woodruffw>
oh, you actually want the group *name*, not just the ID
<FromGitter>
<jaydorsey> yes, `File#info` is working, but I was looking to present the name without having to try and shell out
<FromGitter>
<jaydorsey> which is actually probably fine at the end of the day
<woodruffw>
hmm. i don't know if there's anything that calls `getgrid` in the standard library...you could probably write a little C wrapper to do that (it's pretty easy), or parse `/etc/group` yourself
<FromGitter>
<Blacksmoke16> i remember seeing something for this maybe but i cant remember the name
<FromGitter>
<jaydorsey> interestingly, /etc/group and /etc/passwd don’t actually have the data i’m looking for (macOS). i’m not sure why my local user isn’t listed there
<woodruffw>
interesting, i wonder if that's a recent change. in any case this is the kind if thing i'd expect `File::Info` to contain, so perhaps it's time for a PR ;)
alex```1 has joined #crystal-lang
alex``` has quit [Ping timeout: 255 seconds]
<FromGitter>
<jaydorsey> `id -nu <number>` actually works (macOS). i think it would be a useful method to have. i haven’t dug far enough into this but if it’s something I can do I’d be ahppy to
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<jaydorsey> In ruby, methods in Etc can get group & user id names
<FromGitter>
<solaspace> @dscottboggs_gitlab Thanks for the tip. Though being a beginner at Crystral(never programmed in Ruby) haven't been able to make it happen. Always get wrong number of arguments for 'a_def' (given 1, expected 0) error.
<FromGitter>
<solaspace> @dscottboggs_gitlab Convert a block to a Proc, that is.
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
hightower3 has joined #crystal-lang
Liothen has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
waheedi has joined #crystal-lang
<FromGitter>
<vladfaust> How does one sums two slices, so the resulting slice has all the bytes from two of them? I.e. `Bytes[1, 2, 3] + Bytes[4, 5] == Bytes[1, 2, 3, 4, 5]`
<FromGitter>
<bajro17> hahah thank you its so easy fix :)
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Jenz has joined #crystal-lang
<FromGitter>
<r00ster91> when writing to `STDOUT`, is there any way to later receive all the stuff that has been written to it?
<FromGitter>
<tenebrousedge> can you tee it to a tempfile?
<FromGitter>
<r00ster91> with `File.tempfile` you mean? Not sure how that would work
Jenz has quit [Ping timeout: 250 seconds]
<FromGitter>
<tenebrousedge> it's probably possible to get the system to log shell commands for you, but otherwise the only way I think would be to write the same thing to disk that you output to the console
<FromGitter>
<r00ster91> `STDOUT` is an `IO::FileDescriptor` and that file descriptor includes `IO::Buffered`. So isn't the data still stored somewhere?
<FromGitter>
<tenebrousedge> buffered in the sense of a certain number of bytes at a time
<FromGitter>
<r00ster91> I think I understand it now. Instead of making multiple printing syscalls each time, it does only one for all the stuff
<FromGitter>
<r00ster91> I was trying to work around something from a lib but I will solve that differently now
<FromGitter>
<j8r> @dscottboggs_gitlab `Slice(UInt8)` is `Bytes`
<FromGitter>
<dscottboggs_gitlab> yes...?
<FromGitter>
<j8r> the main point of Array is the size isn't fixed, Slice has a fixed size
<FromGitter>
<j8r> > what's this self.as(Slice(UInt8)) for? That's weird...
<FromGitter>
<j8r> It ensures this is bytes
<FromGitter>
<dscottboggs_gitlab> oh I see it raises an exception otherwise
<FromGitter>
<j8r> 👍
<FromGitter>
<dscottboggs_gitlab> That seems like it should be a macro to me. like wrap the whole method in `{% if @type.class.id == Bytes.id %}`
<FromGitter>
<dscottboggs_gitlab> > the main point of Array is the size isn't fixed, Slice has a fixed size ⏎ ⏎ I see so an Array is *kinda* like a slice that automatically grows its size
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<schoening> Can I run Kemal concurrently so it does not block other stuff? Right now when I do "Kemal.run" nothing after that statement executes.
<FromGitter>
<dscottboggs_gitlab> You have to be a little careful with making sure to handle errors when using fork. Alternatively, there are process managers like Foreman that have more advanced features.
<FromGitter>
<schoening> Thanks @dscottboggs_gitlab I'll give it a shot
blassin has quit [Ping timeout: 246 seconds]
blassin has joined #crystal-lang
<FromGitter>
<schoening> @dscottboggs_gitlab ⏎ ⏎ ```in src/test.cr:49: undefined constant Error ⏎ ⏎ errors = Channel(Error).new PROC_COUNT``` ⏎ ⏎ Hmm, what Error class do u want me to use in here? [https://gitter.im/crystal-lang/crystal?at=5cc5e3215b3f941aa5a91bd8]
<FromGitter>
<Blacksmoke16> im pretty sure that code is just pseudo code
<FromGitter>
<schoening> Aw okay
<FromGitter>
<schoening> Maybe someone could explain to me why something like this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Does not work. I mean, it runs. But I cannot access it. I mean, I guess because it is not on the main thread? But that does not really give me any "aha" moment [https://gitter.im/crystal-lang/crystal?at=5cc5e5404b4cb471d972345e]
<FromGitter>
<Blacksmoke16> if i had to guess its there is nothing blocking the program from exiting
<FromGitter>
<Blacksmoke16> idk the proper way to handle it, but can just add a like `sleep` at the very end and see it stays open, while if you replace that with a puts would see your value then exists
<FromGitter>
<dscottboggs_gitlab> this has crashed my local playground and doesn't seem to work in the playground... why?
<FromGitter>
<dscottboggs_gitlab> it's supposed to infinite loop but it's also supposed to output "hello from thread" 16 times
<FromGitter>
<dscottboggs_gitlab> oh no it worked using `crystal eval`
<FromGitter>
<Blacksmoke16> prob since its a playground doesnt have access to some things?
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<dscottboggs_gitlab> just weird playground stuff
<FromGitter>
<dscottboggs_gitlab> yeah whatever
<FromGitter>
<dscottboggs_gitlab> point is it wasn't pseudocode, I just wrote error instead of exception once
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<schoening> @dscottboggs_gitlab thanks for the clarification :)
<FromGitter>
<dscottboggs_gitlab> np
Jenz has joined #crystal-lang
hightower3 has quit [Ping timeout: 258 seconds]
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
f1refly has joined #crystal-lang
Jenz has quit [Ping timeout: 246 seconds]
alex```13 has joined #crystal-lang
alex```1 has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> so i just fixed a bug i found by changing the block arg from `c` to `col`???
<FromGitter>
<Blacksmoke16> have to see if i can reproduce it...
<woodruffw>
following up on a discussion last night about `File::Info` -- does it make sense for methods like `Info#owner` and `Info#group` to be defined on Win32 at all? right now they both return `0`, but it would make more sense (IMO) for them to either raise or to be feature gated if `flag?(:unix)`
<woodruffw>
preferably the latter, since it would lift a guaranteed exception at runtime into a compile-time error on Win32
<FromGitter>
<tenebrousedge> doesn't Win32 have a Linux subsystem these days?
<FromGitter>
<Blacksmoke16> yes
<woodruffw>
it does, but i don't believe crystal is currently aware of it
<FromGitter>
<Blacksmoke16> well if you're running crystal in WSL its not using the windows stuff anyway
<woodruffw>
yeah, i would expect a crystal build under WSL to have `flag?(:unix)`
<FromGitter>
<Blacksmoke16> had something to do with generics ofc
<FromGitter>
<Blacksmoke16> heh
waheedi has quit [Quit: waheedi]
<FromGitter>
<j8r> `File::Info#owner` and `File::Info#group` returns an `Int32` id, don't know why they aren't called `uid` and `gid`
<FromGitter>
<j8r> I would expect `owner` to return a string, like `"nobody"`
<woodruffw>
i agree, guessing that stems from the desire to move away from UNIX-y names for (ostensibly) cross-platform objects