RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <drujensen> @Blacksmoke16 nice!
<FromGitter> <drujensen> might want to consider using `constraints` instead of `requirements` https://guides.rubyonrails.org/routing.html#segment-constraints
<FromGitter> <drujensen> curious, how would you would handle precedence when defined this way? which route has priority?
<rocx> okay maybe one other question: in the error message "@instance_vars are not yet allowed in metaclasses"... presumably this is a planned feature?
rocx has quit [Quit: ERC (IRC client for Emacs 26.1)]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
Raimondi has quit [Ping timeout: 240 seconds]
Renich has quit [Ping timeout: 246 seconds]
Dreamer3 has quit [Quit: Leaving...]
spacemanspam has joined #crystal-lang
<FromGitter> <galvertez> so it looks like `macro inherited` always runs at the beginning of a class definition when inheriting, i.e. before any defs are added etc., but is there anything i can do that will run at the *end* of class definition when inheriting?
<FromGitter> <galvertez> that was kind of surprising to me because in ruby `self.inherited(r)` always runs at the end, and there's nothing you can do that runs at the beginning... that was always annoying
<FromGitter> <galvertez> but now in crystal i have the opposite problem lol
_whitelogger has joined #crystal-lang
<FromGitter> <girng> @talbergs weird how you don't know the types in mysql. i always thought the columns had to have a type set. unfortunately that's all i can help with. can try posting on SO (i'll upvote), or on the forum, etc
_whitelogger has joined #crystal-lang
<FromGitter> <bew> @rocx i assume you want
<FromGitter> <bew> `@@class_variable`?
<FromGitter> <vladfaust> @Blacksmoke16 https://www.youtube.com/watch?v=bHfvnaVlbxw
<FromGitter> <vladfaust> How about declaring paths as regexps? Like `path: /users\/(?<id>\d+)/`
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <girng> damn, now that's a lot of miles (https://i.gyazo.com/a03c3fb251cfa5aebaf6839b8170b5fc.png)
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
<mps> is there gettext shard for crystal or something which could help me to port one my service
_whitelogger has joined #crystal-lang
<FromGitter> <vifreefly> Hello everyone! ⏎ ⏎ Is there something like Fiber-local variables i Crystal, like Ruby's Thread-local variables ( https://ruby-doc.org/core-2.6/Thread.html#class-Thread-label-Thread+variables+and+scope ) ? ⏎ ⏎ I use in Rails CurrentAttributes (https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html) (and found it very convenient), which provided global class where class variables
<FromGitter> ... are thread safe and individual per thread. [https://gitter.im/crystal-lang/crystal?at=5c2ca5886649aa1f820aa740]
<FromGitter> <vifreefly> There is `Fiber.current` but it looks like there is no API to set and get fiber-local variables
<FromGitter> <straight-shoota> @vifreefly No, there aren't any fiber-local variables. Depending on the use case, it's recommended to either use a `Hash(Fiber, T)` or reopen `Fiber` class or add an instance variable. The latter is especially useful if most fibers nee to have that variable.
<FromGitter> <straight-shoota> You could probably also subclass `Fiber` with necessary instance variables.
<FromGitter> <vifreefly> This is awesome! So it looks like to implement this feature will be easy as you described, thanks
<FromGitter> <valenciaj> Hi there! There are a shard to make PDF's but not WkHtmlToPdf? Thanks!
<mps> valenciaj: could you post url of the PDF shard, please
<FromGitter> <valenciaj> @FromIRC I'm asking for a shard
<mps> valenciaj: ok, understand
gangstacat has quit [Quit: Ĝis!]
<FromGitter> <bararchy> @vladfaust we got two developers from Belarus, so if you get the meetup going I'll let them know
<FromGitter> <vladfaust> Thank you, Bar
<FromGitter> <bararchy> NP, thanks for arranging this event
laaron has joined #crystal-lang
gangstacat has joined #crystal-lang
_whitelogger has joined #crystal-lang
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
cyberarm has quit [Ping timeout: 246 seconds]
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
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
spacemanspam has quit [Read error: Connection reset by peer]
laaron has joined #crystal-lang
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
<FromGitter> <straight-shoota> @valenciaj No, I don't think there is anything in that direction. PDF creating is a pretty complex topic
<FromGitter> <bararchy> yeha, but btw ruby has a great one
<FromGitter> <bararchy> it could be a good start for anyone wanting to `port`
<FromGitter> <bararchy> also http://prawnpdf.org/api-docs/2.0/
Raimondi has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <j8r> async/await is a pain is Python :(
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <asterite> @galvertez you can probably put a `macro inherited` inside a `macro finished`
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
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
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
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
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Renich has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter> <straight-shoota> Somebody interested in background job queues in Crystal? There are a number of different shards available. I've put together a proposal for a standardized API like Active Job: https://github.com/straight-shoota/taskmaster Any feedback is welcome.
<robacarp> interesting
<FromGitter> <j8r> Hum there is no `File#read` :|
laaron has quit [Remote host closed the connection]
<robacarp> https://crystal-lang.org/api/0.27.0/File.html#read%28filename%2Cencoding%3Dnil%2Cinvalid%3Dnil%29%3AString-class-method
laaron has joined #crystal-lang
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> yes, `File.read` class method
<FromGitter> <j8r> not `File.new("myfile").read` ;)
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> there is already `File#delete`, for now I use `File.read(File#path)` robacarp
laaron has joined #crystal-lang
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron- has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
<robacarp> Ah, sorry, I misunderstood.
<FromGitter> <straight-shoota> `#gets_to_end` ??
akaiiro has quit [Ping timeout: 240 seconds]
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
spacemanspam has joined #crystal-lang
spacemanspam has quit [Client Quit]
akaiiro has joined #crystal-lang
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
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
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
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
akaiiro has quit [Remote host closed the connection]
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
akaiiro has joined #crystal-lang
Vexatos has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
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
Vexatos has quit [Quit: ZNC Quit]
RX14 has quit [Quit: Fuck this shit, I'm out!]
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
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
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
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
RX14 has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Vexatos has joined #crystal-lang
non-aristotelian has joined #crystal-lang
<FromGitter> <Blacksmoke16> are there known issues with tls on mac?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2d15b2ab910e7d3a10bcd4]
<FromGitter> <Blacksmoke16> ``````
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c2d15c16649aa1f820dd573]
ua has quit [Ping timeout: 246 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <asterite> It might be an issue with the openssl version (I think). It works for me (I'm on a mac)
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ua has joined #crystal-lang
spacemanspam has joined #crystal-lang
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> prob, see if i can update it
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
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <j8r> @straight-shoota oh yes, good catch! One point though: it works only once
<FromGitter> <straight-shoota> you can `#rewind`
<FromGitter> <j8r> 👍 it works
<FromGitter> <j8r> why we wont have read to? It look logical API-wise
<FromGitter> <straight-shoota> There is. It's just called `#gets_to_end` because `File` is an IO
<FromGitter> <j8r> It's a bit strange, there are IO method, but there is delete - IO#delete
<FromGitter> <j8r> that didn't exist indeed
<FromGitter> <straight-shoota> delete is entirely different operation, not IO related
<FromGitter> <rishavs> quick question. I keep getting confused where I should use `{} of String => Int32` and where to use `Hash(String , Int32)`
<FromGitter> <j8r> of course @straight-shoota , why?
<FromGitter> <straight-shoota> having it on `File` is nothing more than a shortcut
<FromGitter> <j8r> On my mind File.new is an IO
<FromGitter> <j8r> sort of
<FromGitter> <straight-shoota> @rishavs `Hash(String, Int32)` is a type and `{} of String => Int32` initializes a new instance of that type. That's equivalent to `Hash(String, Int32).new`
<FromGitter> <j8r> I still think having File#read as a shortcut like #delete would make sense...
<FromGitter> <straight-shoota> but what's wrong with #gets_to_end ?
<FromGitter> <j8r> we need to know how IO works, with gets_to_end, rewind and close
<FromGitter> <j8r> the user only want to read a file, like with File.read
<FromGitter> <rishavs> thanks @straight-shoota
<FromGitter> <j8r> why we have File.read, not use File.open? That's the same topic
<FromGitter> <j8r> off topic, you're quite active @straight-shoota - wow :o
<FromGitter> <j8r> my GH notifications are full 💀
<FromGitter> <straight-shoota> I've got a cold. Need distraction =)
<FromGitter> <asterite> `File.read` existed before we introduced `gets_to_end`. It should probably be `File.gets_to_end` or something like that, or we should just have `read()` that reads the whole thing to a String, I don't know. The names are a bit confusing. `print` and `puts` are also confusing too for newcomers... but it might be late to change all of that
<FromGitter> <straight-shoota> It's not just me, though. Today many people were very busy.
<FromGitter> <straight-shoota> I think `File.read` is fine. It opens the file, reads its contents into memory and and closes it. I think this is pretty accurately described as `.read`
<FromGitter> <rishavs> Just hit a compiler error. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ will file a bug on this later [https://gitter.im/crystal-lang/crystal?at=5c2d1fe837975e7ca9638b58]
Jenz has joined #crystal-lang
<FromGitter> <bew> I like reading pr & issues from @straight-shoota between 2 commit at work :p it clears my mind
ua_ has joined #crystal-lang
<FromGitter> <straight-shoota> 😆
<Jenz> haha
ua has quit [Ping timeout: 250 seconds]
<RX14> @straight-shoota arrgh my github inbox! :P
<FromGitter> <straight-shoota> You're welcome ^^
<FromGitter> <straight-shoota> It's not just me though, a lot of guys have been very active. My inbox was also pretty big multiple times today.
<Jenz> What is it that attracts all the attention?
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
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
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
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
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Jenz has quit [Quit: leaving]
<FromGitter> <straight-shoota> RX14 don't bother with #7247
<DeBot> https://github.com/crystal-lang/crystal/pull/7247 (Replace #status_code with #status)
<FromGitter> <straight-shoota> there's already a new one
<RX14> oh
<RX14> that is the new one you linked to
<RX14> but yeah
<RX14> thanks
<RX14> it's a PR with a lot of review + comment work for, honestly, marginal benefit
sagax has joined #crystal-lang
<FromGitter> <Blacksmoke16> @asterite What openssl version are you on?
<z64> an update on https://github.com/crystal-lang/crystal/pull/6901 would be great; i know the parent issue is at least blocking crystal-db from getting logging support, which all drivers would then benefit from
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <straight-shoota> RX14 agreed. It's still a nice change. And seems like the author is pretty enthusiastic about contributing. That's definitely a good thing.
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <dwightwatson> hi all - silly question... how might i get the length of an integer?
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
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <dwightwatson> i've come up with `status_code.to_s.size == 3` but it feels *wrong*
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
<oprypin> dwightwatson, there's no such thing as length of an integer
laaron has quit [Remote host closed the connection]
<oprypin> there is length of the decimal representation, and `to_s` returns the decimal representation
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<oprypin> that said, https://www.google.com/search?q=log+ceil+length+integer -> `⌊log10n⌋+1` -> `Math.log10(n).to_i + 1`
laaron has joined #crystal-lang
<FromGitter> <dwightwatson> haha not the answer i was hoping for, but i suppose that's technically correct
laaron has quit [Remote host closed the connection]
<FromGitter> <dwightwatson> would using `to_s` be frowned upon then in this context?
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<oprypin> no
laaron has joined #crystal-lang
<oprypin> it's the clearest method by far
<oprypin> solely for performance you'd use the math trick https://carc.in/#/r/5wom
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <dwightwatson> ok, that's really good to know
<FromGitter> <dwightwatson> appreciate the explanation, that's really helpful
<FromGitter> <straight-shoota> What's wrong with `100 <= code <= 999`? ;)
<FromGitter> <dwightwatson> i was reading from your comment here...
<FromGitter> <dwightwatson> ```code paste, see link```
<FromGitter> <dwightwatson> whoops didn't mean to make it a single line
<FromGitter> <straight-shoota> This only makes sense when the status code is provided as text. In the Crystal implementation that would be in `Response.from_io`
<FromGitter> <straight-shoota> When it is already passed as a number, it doesn't make sense to count digits in the string representation
<oprypin> yeah
<FromGitter> <straight-shoota> `status_code.to_s.size == 3 && 0 <= status_code <= 999` is equivalent to `100 <= status_code <= 999`
<FromGitter> <dwightwatson> ah... yeah good point
<FromGitter> <dwightwatson> clearly haven't had my morning coffee yet
<FromGitter> <dwightwatson> alright i'll pop it back to `100 <= status_code <= 999`
<FromGitter> <straight-shoota> Yeah, just revert the last commit
<FromGitter> <straight-shoota> And I wouldn't bother about `000..999`, I don't think it's worth it.
<oprypin> it's not worth anything, it's probably done to avoid a dynamic string allocation or something silly
<FromGitter> <straight-shoota> what are you refering to?
<FromGitter> <theretromaniac> hello folks! Happy to join
<FromGitter> <dwightwatson> had a massive battle trying to revert that commit so will just squash it later if you like
<FromGitter> <dwightwatson> were there any other changes you'd like to that PR?
Raimondi has joined #crystal-lang
<FromGitter> <straight-shoota> No, I think it looks fine
<FromGitter> <straight-shoota> Will review tomorrow :D
<FromGitter> <dwightwatson> awesome, thanks for all your help