laaron has quit [Remote host closed the connection]
<FromGitter>
<tenebrousedge> wordruffw, how are you handling euid vs uid ?
rohitpaulk has quit [Ping timeout: 245 seconds]
<woodruffw>
@tenebrousedge: `euid` vs `uid` are filesystem/`setuid` constructs, `System::User` and `System::Group` are just mapping the `passwd` and `group` structures returned by POSIX calls like `getgrnam_r` and `getpwnam_r`
<woodruffw>
sorry, not filesystem, process (was thinking of `fsuid`)
<FromGitter>
<tenebrousedge> so do you provide a mechanism for changing those? can I drop permissions on a process? can I execute a block with a different uid?
<woodruffw>
not at the moment, no. previous attempts to add these to crystal (#5627 and #5615) stalled because they added too much API surface at once, my thought here was to start with the basics and then add process/filesystem interaction later
<woodruffw>
IIRC, one of those previous PRs added `Process#owner=` and `Process#group=`, which is probably the kind of interface that'll be added in a future PR
<FromGitter>
<tenebrousedge> but, this was arguably doing something inherently stupid, and I'm not necessarily the most informed person about these matters, so don't take me too seriously
<woodruffw>
switching the `uid` and `euid` is a bit unorthodox, but something like `Process.as_user(uid) { ... }` would be nice (and is a generalization of the above)
laaron has joined #crystal-lang
<FromGitter>
<tenebrousedge> yeah, I was creating files under a user account while the overall process ran as root. I'm not sure how much of that code was eventually discarded. It would be nice to be able to do something similar in Crystal though
rohitpaulk has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
f1refly has quit [Ping timeout: 250 seconds]
laaron has joined #crystal-lang
f1refly has joined #crystal-lang
<FromGitter>
<jaydorsey> @woodruffw thanks that would be a great feature
rohitpaulk has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> because your restirction is for an instance of bar and you're passing the type Bar
<FromGitter>
<Blacksmoke16> would have to set the restriction to `Bar.class` which would allow you to pass `Bar`
<z64>
that's probably helpful; i don't see why not. it shouldn't default to BigEndian though; the rest of IO defaults to System and it should probably be consistent
<RX14>
Since JSON::Serializable is a bit of a mess right now I've been thinking of perhaps tying automatic JSON deserialization to constructor named arguments instead of instance variables
<RX14>
then probably introduce an auto_constructor macro to automatically create constructors for all ivars
<RX14>
actually thinking about it some more that creates problems for metadata like converters :(
<RX14>
so perhaps nevermind, although I think it would be neater if it could be made to work
<RX14>
isn't that just what we have now with different method names?
<FromGitter>
<forkev_twitter> New to Crystal Syntax, and obviously missing something with XOR. I'm looking to zipper two byte arrays or strings together with xor. Any suggestions? https://play.crystal-lang.org/#/r/6t1h
<FromGitter>
<tenebrousedge> `Enumerable#zip` is probably going to be useful
<FromGitter>
<tenebrousedge> So you could do e.g. `string.each_byte.map {|b| [b, b ^ 3] }`
<FromGitter>
<j8r> not really RX14, this is a standard API which is format agnostic
<FromGitter>
<j8r> and you can serialize any object out of the box
<FromGitter>
<j8r> what problem do we want to solve? I thought it was avoiding to have to include modules for each format, that have their own annotations `JSON::Field`, `YAML::Field`, `Whatever::Field`
<FromGitter>
<straight-shoota> RX14, I think we should look at Rust's serde for ideas
<RX14>
meh, the rust people tend to overcomplicate
<FromGitter>
<schoening> Does anyone know the name for the "import style" crystal is using? I mean where u just require and it gets the entire namespace, in opposition to something like for example TypeScript where you import alias from "location"
ua_ has quit [Ping timeout: 255 seconds]
<FromGitter>
<r00ster91> @forkev_twitter I'm not sure you need `Atomic` for that. Can't you use the bitwise xor operator `^` for that?
ua_ has joined #crystal-lang
<FromGitter>
<j8r> Whatever the technical solution, we should be able to serialize/deserialize any object out of the box
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter>
<forkev_twitter> Very cool, thank you @tenebrousedge
<FromGitter>
<forkev_twitter> @r00ster91 , i think so. i'm just not sure of the syntax, and what that would look like.
<FromGitter>
<Blacksmoke16> im lost of what is going on
<FromGitter>
<Blacksmoke16> *that* playground link fails, but if you copy paste it into a new one it doesnt?
<FromGitter>
<straight-shoota> might be one of these weird non-deterministic errors
teardown has quit [Ping timeout: 255 seconds]
<FromGitter>
<Blacksmoke16> adding `.inspect` to end of both seems to cause the error reliably
<FromGitter>
<Blacksmoke16> defining an initializer in the parent struct seems to be a workaround as well. Will have to try when i get home and see if it fixes it in the real code
<FromGitter>
<jwoertink> oh that's interesting. My app gets that Invalid memory error all the time, but since the app doesn't ever seem to be down, I've just always ignored it