<FromGitter>
<tenebrousedge> or better yet, set a default block on `errors`
<FromGitter>
<Blacksmoke16> oo yea good call
<FromGitter>
<Nicolab> @Blacksmoke16 It's good for `name.id`. Probably a remnant of my attempt to make the call dynamic.
<FromGitter>
<kinxer> @elorest Sorry I wasn't any help, though... I'm suprised, though, 'cause on a normal file, it doesn't make much sense to block on read, but it clearly does make sense for a file descriptor, and I can't see anywhere that `File` overwrites a crucial method.
<FromGitter>
<Nicolab> @Blacksmoke16 @tenebrousedge Sound good also
<FromGitter>
<Nicolab> @tenebrousedge nice
<FromGitter>
<elorest> @kinxer still for the sake of something like Tail it does or monitoring a log it would make sense to be able wait until data is available like normal, `gets`
<FromGitter>
<Nicolab> Hmm the repository name must have the same name that the shard name. I update it
<FromGitter>
<Nicolab> It must be the name of the version or something else because the shards don't necessarily have the same name as the repo.
alex`` has joined #crystal-lang
alex`` has quit [Ping timeout: 272 seconds]
<FromGitter>
<DanielCoulbourne> Howdy everyone. Crystal noob here, but my podcast cohost and I talked each other and our whole audience into working together on a Crystal app, so now I have to learn it 😂
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<tenebrousedge> @DanielCoulbourne are you familiar with Ruby?
<FromGitter>
<DanielCoulbourne> I've written a little ruby. I mostly write Javascript and PHP these days. So far the syntax hasn't been too difficult. Just the transition to writing desktop software coming from web-dev.
<FromGitter>
<DanielCoulbourne> Well, for now it's a command line app. We're punting on a gui
<FromGitter>
<DanielCoulbourne> basically just a wrapper around ffmpeg
<FromGitter>
<DanielCoulbourne> so a lot of Process
<FromGitter>
<Blacksmoke16> Gotcha
<FromGitter>
<DanielCoulbourne> I'm struggling a bit with understanding how to work with output from `Process` using backtick syntax is really simple, but the warnings about passing in user input totally apply here, so I need to use Process.new
<FromGitter>
<Blacksmoke16> Process.run might also be helpful
<FromGitter>
<DanielCoulbourne> not totally clear on the difference yet. is `run` synchronous and `new` just gives me a process and it's up to me to keep track of when it finishes asynchronously?
<FromGitter>
<Blacksmoke16> Run news up a process and waits for it to complete
<FromGitter>
<Blacksmoke16> Otherwise it happens in another fiber and you would have to call wait on it
<FromGitter>
<Blacksmoke16> Process docs deff could use some improvements 😬
<FromGitter>
<DanielCoulbourne> for sure. Doing a lot of trial and error there
<FromGitter>
<tenebrousedge> @Blacksmoke16 knows everything so definitely ask them all the questions
<FromGitter>
<Blacksmoke16> Ha, not entirely true but I try 😉
<FromGitter>
<Daniel-Worrall> like I put `Time.now`
<FromGitter>
<Blacksmoke16> What happens if you manually pass the flag
sagax has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
duane has quit [Ping timeout: 272 seconds]
_whitelogger has joined #crystal-lang
fifr has quit [Ping timeout: 265 seconds]
fifr has joined #crystal-lang
fifr has quit [Ping timeout: 272 seconds]
fifr has joined #crystal-lang
flaviodesousa has joined #crystal-lang
_ht has joined #crystal-lang
yukai has quit [Ping timeout: 260 seconds]
<FromGitter>
<bew> Hello! Anyone going to FOSDEM this weekend in Bruxelles? I'll be there with a friend
<repo>
goooood morning!
<FromGitter>
<bew> o/
_ht has quit [Remote host closed the connection]
<FromGitter>
<confact> Is it possible to do something like IO.popen in Ruby in Crystal? I want to do a RPC server for git (like grack in ruby)
<FromGitter>
<confact> Found `Process`. Which is the one i was looking for. Was just called differently in Crystal :)
<repo>
chachasmooth: sure :)
ua_ has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
<FromGitter>
<straight-shoota> @bew RX14 is going to be there
ua has joined #crystal-lang
ua has quit [Excess Flood]
ternarysolo has quit [Quit: User has been idle for 30+ days.]
ua has joined #crystal-lang
ua has quit [Excess Flood]
ua has joined #crystal-lang
<FromGitter>
<jgillich> In a macro, how do you cast a `ASTNode | Nop` to `ASTNode`, similar to `not_nil!`?
<FromGitter>
<rurounijones_gitlab> So how to I split a string such as "keya=valuea,keyb=valueb" up and assign it to a hash with symbol keys? Since there is no s.to_sym in crystal
duane has joined #crystal-lang
<FromGitter>
<tenebrousedge> @rurounijones_gitlab you can't do that at runtime. But you can do: ⏎ ⏎ ```"keya=vala,keyb=valb".scan(/(\w+)=(\w+)/).to_h ⏎ #=> {"keya" => "vala", "keyb" => "valb"}``` [https://gitter.im/crystal-lang/crystal?at=5e32de6458f02e349749c713]
<FromGitter>
<Nicolab> One line :D
<FromGitter>
<tenebrousedge> you can interpolate in the regex to use `END_OF_FIELD` and `FIELD_SEPARATOR` if you want.
<FromGitter>
<rurounijones_gitlab> This is part of a larger StringScanner, I need the keys in Symbols, not Strings
<FromGitter>
<tenebrousedge> you can't do that at runtime
<FromGitter>
<rurounijones_gitlab> Is there a way to do equality on :string and "string" to see if they match?
<FromGitter>
<Blacksmoke16> they wont since they're diff types
<FromGitter>
<digitalextremist> Seem to be having a hell of a time trying to convert between `MessagePack` strings and `BSON` ... anyone know a smooth conversion approach for this?
<FromGitter>
<tenebrousedge> @digitalextremist what are you doing now?
<FromGitter>
<digitalextremist> @tenebrousedge making a gist:
<FromGitter>
<digitalextremist> Even when I throw in injections to supply `#bytesize` for various object types, it still behaves differently than a `Hash` which was never touched by `MessagePack`
<FromGitter>
<Nicolab> but 1.0.0-rc1 seems ok, right?
<FromGitter>
<tenebrousedge> @digitalextremist so converting to a string works, but converting to a hash doesn't work? is there a reason you need the hash?
<FromGitter>
<digitalextremist> @tenebrousedge trying to convert `MessagePack` strings into `BSON` to use with the `mongo.cr` shard. Converting to a `Hash` works fine, it's the final conversion to a `BSON` object ⏎ ⏎ I seem to run into this type of issue a lot, with unions of various possible types
<FromGitter>
<tenebrousedge> unions can usually be constrained with `as`
<FromGitter>
<tenebrousedge> can you use a record instead of a hash?
<FromGitter>
<digitalextremist> @tenebrousedge what shard provides that object?
<FromGitter>
<tenebrousedge> crystal stdlib
<FromGitter>
<tenebrousedge> `record` is a macro to create structs
<FromGitter>
<tenebrousedge> if you need to convert arbitrary messages it's not as useful, but if you know what messages you're dealing with it could maybe help with type issues
<repo>
is it possible to make a string literal in crystal that doesn't care about backslashes? preferably with heredoc
<FromGitter>
<tenebrousedge> isn't there a heredoc that doesn't do interpolation?
<repo>
i dunno
<FromGitter>
<tenebrousedge> To denote a heredoc without interpolation or escapes, the opening heredoc identifier is enclosed in single quotes: ⏎ ⏎ <<-'HERE' # => "hello \\n \#{world}" ⏎ hello \n #{world} ⏎ HERE [https://gitter.im/crystal-lang/crystal?at=5e32ecd1594a0517c25032e0]
<repo>
also not sure if \ counts as interpolation
<repo>
ah
<repo>
nice
<FromGitter>
<tenebrousedge> :plus1:
<repo>
thanks!
<FromGitter>
<digitalextremist> @tenebrousedge `record` looks useful for other things, but for this I am mostly trying to remove any unions I guess; wonder if there's a way to essentially process out unions and resolve a value to its actual type
<FromGitter>
<tenebrousedge> @digitalextremist you can cast with `as`
<FromGitter>
<tenebrousedge> repo, I'm in awe. Truly stunning. It's about tea-time, innit?
<repo>
:)
<FromGitter>
<grkek> How can I define macro names with symbols as well ?
<repo>
whenever you want it to be thanks to this ground breaking service
<FromGitter>
<grkek> non-alphanumeric characters
<FromGitter>
<grkek> like <>
<FromGitter>
<grkek> etc.
<FromGitter>
<tenebrousedge> @grkek why?
<repo>
tenebrousedge: i hope you paid attention to the details and looked at the status code
<FromGitter>
<grkek> I want to know if you can do that, just for experiments nothing else :)
<FromGitter>
<grkek> @tenebrousedge
<FromGitter>
<tenebrousedge> repo, of course 😄 seems like a proper implementation of RFC 2324 to me
<FromGitter>
<grkek> Why is that even a thing
<FromGitter>
<digitalextremist> @tenebrousedge in this case, I can't see how explicitly casting with `as` would work though, unless you mean rebuilding the object with `as`?
<FromGitter>
<tenebrousedge> @digitalextremist that's kinda your option for narrowing types. There may be some macro magic that you could do as well, but that sounds like a bear
<FromGitter>
<digitalextremist> 😦 seems so. Was looking for a way to use `popcorn` some how, but more wondering if there is a shard out there to just strip and rebuild objects without unions... for `MessagePack::Type` or `BSON::Field`, etc
<FromGitter>
<tenebrousedge> I mean, how is the hash conversion written?
<FromGitter>
<tenebrousedge> it seems like it's creating keys that have the union type
<FromGitter>
<tenebrousedge> you should be able to write a quick recursive function that would only ever use string keys
<FromGitter>
<Blacksmoke16> but with your static array of method names
<FromGitter>
<Blacksmoke16> got an example? might be a better approach tho
<FromGitter>
<confact> I am trying to port grack in ruby to an HTTP handler :) I will probably rewrite the whole thing from scratch as i need to rethink the whole thing as most of the stuff it use to work won't work in crystal.
<FromGitter>
<Blacksmoke16> sounds like a plan
<FromGitter>
<tenebrousedge> Ruby's metaprogramming is so nice :(
<FromGitter>
<tenebrousedge> it's also why Ruby is 300 times slower
<Stephie>
you can write that in crystal, it'd just be {"POST", ->service_rpc, "...", "..."}
<Stephie>
i.e. Tuple(String, Proc(_), String, String)
<FromGitter>
<tenebrousedge> or `Tuple(Http::Request::Type, Proc(_), Regex)`
<FromGitter>
<confact> Yea, you understood the second one is the method I want to call? :) I am new to the Tuple and such, Do you have any example code that is used and being called and such I can use as a reference?
<FromGitter>
<tenebrousedge> or some other representation of the request type other than a string
<FromGitter>
<confact> Thanks, really appreciate it. Don't know what i would do without your thoughts and feedback :)
<FromGitter>
<tenebrousedge> so there's a `HTTP::Request#method`, but it returns a string <____<
<FromGitter>
<grkek> @confact you use regex for your routes ?
<FromGitter>
<confact> Yea, at least right now. It is coming from the grack repo. I think it is because of the path can be different based on repo name, branch name and such. But I haven't look into deep hole of git RPC yet.
<FromGitter>
<grkek> That looks tasty af
<FromGitter>
<confact> I am sure people will think it will be tasty when I make it work. My plan is to maybe make a github/gitlab in crystal.
<FromGitter>
<confact> but the regex is sure tasty already now.
<FromGitter>
<grkek> Oh my that sounds nice
<FromGitter>
<grkek> is it opensource ?
<FromGitter>
<Blacksmoke16> as a fun pet project?
<FromGitter>
<confact> a fun project that might be an opensource with a paid hosted version. Will see. I am pretty sure I will make it opensource when I got it working. I will for sure release my grack port when I get it working. Next is to find a libgit shard or make my own.
<FromGitter>
<confact> grack port as opensource that is.
<FromGitter>
<grkek> Can I define a macro with a macro?
return0__ has quit [Ping timeout: 265 seconds]
<f1refly>
When I create a set as `Set(A).new` und have a class `B < A`, I cant objects of type `B` to that set. Is this supposed to be working or am I doing something wrong?
<f1refly>
Is there a way to check an xml node against a schema or do I have to fall back to regular expressions and external tools for more sophisticated documents?
<FromGitter>
<tenebrousedge> @Daniel-Worrall it's about the same, performance-wise
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
<FromGitter>
<tenebrousedge> there's a DTDVALID flag
<FromGitter>
<Blacksmoke16> prob could just use `xmllint`
<FromGitter>
<Blacksmoke16> and pass it the schema
<FromGitter>
<Blacksmoke16> xml module links to `libxml2` so might be a way to expose those functions if they arent already