ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Philpax has joined #crystal-lang
hako_ has joined #crystal-lang
hako has quit [Ping timeout: 260 seconds]
Philpax has quit [Ping timeout: 244 seconds]
<crystal-gh> [crystal] bmulvihill opened pull request #3511: Update from_value when Flags (master...enum-from-value) https://git.io/vXBYn
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
shawn42 has joined #crystal-lang
_whitelogger has joined #crystal-lang
<crystal-gh> [crystal] bmulvihill closed pull request #3511: Update from_value when Flags (master...enum-from-value) https://git.io/vXBYn
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
ome has joined #crystal-lang
matp_ has quit [Read error: Connection reset by peer]
matp has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
ome has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Remote host closed the connection]
bjz has quit [Ping timeout: 265 seconds]
bjz_ has joined #crystal-lang
bjz_ has quit [Client Quit]
pawnbox has joined #crystal-lang
metacollin has joined #crystal-lang
metacollin has quit [Client Quit]
gloscombe has joined #crystal-lang
bjz has joined #crystal-lang
mark_66 has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
bjz_ has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vXBKq
<crystal-gh> crystal/master b8a18c1 Ary Borenszweig: String: fixed index and rindex for ascii chars (optimization only applies when string is ascii only). Fixes #3513
<travis-ci> crystal-lang/crystal#b8a18c1 (master - String: fixed index and rindex for ascii chars (optimization only applies when string is ascii only). Fixes #3513): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/173841987
<DeBot> https://github.com/crystal-lang/crystal/issues/3513 (Incorrect results of `Sting#index` and `String#rindex`.)
<crystal-gh> [crystal] c910335 opened pull request #3514: Add intro sort to Array (master...master) https://git.io/vXBDe
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
gloscombe has quit [Ping timeout: 250 seconds]
gloscombe has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
bjz has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
soveran has joined #crystal-lang
poikon has quit [Ping timeout: 260 seconds]
poikon has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] ysbaddaden closed pull request #3170: [WIP] Add file:line information to backtraces (master...core-callstack-refactor) https://git.io/v6oca
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
shawn42 has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Philpax has quit [Ping timeout: 250 seconds]
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
shawn42 has joined #crystal-lang
mark_66 has joined #crystal-lang
<crystal-gh> [crystal] tbrand opened pull request #3515: A method to escape a string into uri safe structure (master...escape-a-string-in-uri-safe-way) https://git.io/vXRYk
pduncan has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
kulelu88 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 260 seconds]
Renich has joined #crystal-lang
Renich has quit [Client Quit]
<FromGitter> <paulcsmith> Maybe this is not possible, but I'm trying to reopen a module inside of a macro so that I can generate route helpers. Something like this: https://gist.github.com/paulcsmith/32e48cc6eb0a99cadc69dd09d8e5cb95
<FromGitter> <paulcsmith> Right now that throws an error because it's trying to make a new module (probably trying to make a module at `Router::RouteHelpers`. Is there a way to make it try to use the existing module? Or maybe some other way to do this that doesn't involve reopening modules?
pawnbox has joined #crystal-lang
<FromGitter> <paulcsmith> The exact error is : `can't declare module dynamically`
poikon has quit [Ping timeout: 250 seconds]
jwaldrip has quit [Ping timeout: 250 seconds]
emmanueloga has quit [Ping timeout: 250 seconds]
mroth has quit [Ping timeout: 250 seconds]
kiliankoe has quit [Ping timeout: 250 seconds]
aemadrid has quit [Ping timeout: 250 seconds]
jeromegn__ has joined #crystal-lang
[spoiler] has quit [Ping timeout: 260 seconds]
jeromegn_ has quit [Ping timeout: 250 seconds]
jeromegn__ is now known as jeromegn_
greenbigfrog has quit [Ping timeout: 250 seconds]
<BlaXpirit> paulcsmith, https://carc.in/#/r/1dg2
greenbigfrog has joined #crystal-lang
jwaldrip has joined #crystal-lang
mroth has joined #crystal-lang
poikon has joined #crystal-lang
emmanueloga has joined #crystal-lang
kiliankoe has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
aemadrid has joined #crystal-lang
<FromGitter> <paulcsmith> @BlaXpirit Thank you! I *think* that will work with the rest of my router code. I'll give that a try
<BlaXpirit> paulcsmith, i'm not sure what's going on here but i think the problem is that macros which are inside a class are not just namespaced macros, they're meant to be called in the code of the class itself (and subclasses)
<FromGitter> <paulcsmith> Yeah that sounds about right. I might have to change the router to make it work. Hopefully I can get it! Compile time checks to make sure paths exist wold be awesome!
[spoiler] has joined #crystal-lang
Renich has joined #crystal-lang
jeromegn_ has quit [Ping timeout: 260 seconds]
shawn42 has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
jeromegn_ has joined #crystal-lang
shawn42 has joined #crystal-lang
lacour has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
shawn42 has quit [Ping timeout: 260 seconds]
soveran has joined #crystal-lang
shawn42 has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
<FromGitter> <zatherz> Papierkorb: is it an alias?
<FromGitter> <zatherz> Is there any way to use JSON.mapping but at the same time have extra fields not covered by it and not nilable? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ now, what if I want to add a class variable of type Bool there and have it work properly? something like additional arguments to `from_json` would be great [https://gitter.im/crystal-lang/crystal?at=5820ac13e462097a301c940b]
<FromGitter> <zatherz> I know that I can do ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5820ac1745c9e3eb430b6d4d]
<FromGitter> <zatherz> I know that I can do ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5820ac30df5ae96645280c47]
<FromGitter> <zatherz> but I'd love to not have a default and instead require an argument in `from_json`
<FromGitter> <zatherz> I know that you can do this with the pull parser, but I want to ask if there's any simpler way first
kulelu88 has quit [Quit: Leaving]
<Papierkorb> zatherz, ?
Renich has quit [Remote host closed the connection]
<FromGitter> <zatherz> Papierkorb: sorry, didn't notice I don't have chat scrolled all they way down
<Yxhuvud> asterite: did you see http://www.cl.cam.ac.uk/~sd601/papers/mlsub-preprint.pdf ? It seems somewhat relevant for crystal
soveran has joined #crystal-lang
mroth has quit [Ping timeout: 260 seconds]
mroth has joined #crystal-lang
<Papierkorb> And the next compiler crash, this time only when building with --debug - Can someone reproduce? 1) Build crystal from master 2) clone https://github.com/Papierkorb/torrent 3) crystal deps 4) crystal build --debug bin/download.cr
<Papierkorb> Should produce something like this https://gist.github.com/Papierkorb/270209b0a0e21a526ce182aa67b37659
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
gloscombe has quit [Remote host closed the connection]
<FromGitter> <jwoertink> What type would I use if I want a method that takes an argument of any object that `to_json` can be called on? For example: https://play.crystal-lang.org/#/r/1dgl
<FromGitter> <zatherz> @jwoertink this works https://play.crystal-lang.org/#/r/1dgn
<FromGitter> <jwoertink> I get ```
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5820d8abe097df757581124e]
<FromGitter> <zatherz> run `crystal -v`
<FromGitter> <zatherz> and paste the output
<FromGitter> <zatherz> wait
<FromGitter> <zatherz> you didn't remove the `: JSON::Type`
<FromGitter> <zatherz> if you remove it the type will be inferred, not sure if there's a better way
<FromGitter> <jwoertink> oh
<FromGitter> <zatherz> @jwoertink note that even though the type is inferred, it is still type safe
<FromGitter> <zatherz> if something doesn't have `to_json`, it's gonna error
<FromGitter> <zatherz> at compiletime
<FromGitter> <jwoertink> interesting
<FromGitter> <jwoertink> Ok, so I originally had a different example which I simplified for asking this question
<FromGitter> <jwoertink> but let me change it back and see if it's doing the same thing
<FromGitter> <zatherz> @jwoertink what purpose is the Format class supposed to fullfil?
<FromGitter> <jwoertink> just an example.
<FromGitter> <zatherz> if it doesn't work, make a less reduced paste
<FromGitter> <jwoertink> Ok, so in this one I need to specify the type
<FromGitter> <zatherz> oh, that's a proc
<FromGitter> <zatherz> procs need a type
<FromGitter> <jwoertink> So adding this type doesn't work.
<FromGitter> <jwoertink> This is where my original question comes back in to play. How would I specify a type for this?
<FromGitter> <jwoertink> That's good to know that I can do it as a method and it would work though!
<FromGitter> <zatherz> this seems like a bug to me
<FromGitter> <zatherz> JSON::Type is `alias Type = Nil | Bool | Int64 | Float64 | String | Array(Type) | Hash(String, Type)`
<FromGitter> <zatherz> wait
<FromGitter> <zatherz> yeah, you're calling it with `Array(Hash(String, Int32 | String))`
<FromGitter> <zatherz> but even `Array(Hash(String, Int64 | String))` doesn't work
<FromGitter> <zatherz> not even a `Array(Hash(String, Int64))` works
Renich has joined #crystal-lang
<FromGitter> <jwoertink> That's weird though, right?
<FromGitter> <jwoertink> or do you think it should be like that?
<FromGitter> <zatherz> nah it's definitely weird, you should be able to `.as(JSON::Type)`
<FromGitter> <zatherz> I've experienced weirdness with recursive aliases myself in the past, too
<FromGitter> <jwoertink> Where would I do that casting? https://play.crystal-lang.org/#/r/1dhh
<FromGitter> <zatherz> I'm saying that you should be able to
<FromGitter> <zatherz> but you can't
<FromGitter> <zatherz> @jwoertink okay so
<FromGitter> <zatherz> I talked to one of the contributors
<FromGitter> <zatherz> this is a limitation of Crystal
<FromGitter> <zatherz> I'll copy some of his words
<FromGitter> <jwoertink> oh?
<FromGitter> <zatherz> "the binary representation of a tuple and a class is not the same ⏎ so to cast from one to the other you need to change binary representations ⏎ which is doable when it's a local var ⏎ when it's a generic argument? ⏎ good luck fam" [https://gitter.im/crystal-lang/crystal?at=5820e243df5ae96645296346]
<FromGitter> <zatherz> Array(T) and Hash(K, V) are generic classes
<FromGitter> <jwoertink> lol
<FromGitter> <zatherz> basically
<FromGitter> <zatherz> you can cast something like `1_i64` to JSON::Type
<FromGitter> <zatherz> you can cast something like `[1_i64.as(JSON::Type)]` to a JSON::Type
<FromGitter> <zatherz> but you can't cast something like `[1_i64].as(JSON::Type)`
<FromGitter> <zatherz> what you need to do is first convert every single value in every single array (including nested arrays) and every single value in every single hash (including nested hashes)
<FromGitter> <zatherz> to a JSON::Type
<FromGitter> <zatherz> only then you can cast the whole array or hash to JSON::Type
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> wow
<FromGitter> <jwoertink> that's pretty wild
<FromGitter> <zatherz> @jwoertink thankfully for you, I wrote a method that does exactly that
<FromGitter> <zatherz> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5820e2dbe462097a301debe4]
<FromGitter> <jwoertink> haha sweet!
Raimondi has quit [Write error: Broken pipe]
<FromGitter> <jwoertink> Thanks! That helps a ton
<FromGitter> <sdogruyol> @zatherz you rock!
<FromGitter> <jwoertink> :thumbsup:
Raimondi has joined #crystal-lang
<FromGitter> <jwoertink> @zatherz so in this https://play.crystal-lang.org/#/r/1dhr I would just need to find the Int32 and turn them in to Int64?
<FromGitter> <zatherz> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5820e4b5df5ae966452971bb]
<FromGitter> <jwoertink> ok cool. That's what I added and it looks like it's working
<FromGitter> <jwoertink> thanks dude!
<FromGitter> <zatherz> yeah https://play.crystal-lang.org/#/r/1dht
<FromGitter> <zatherz> @jwoertink I may later report this as an issue to at least spark a discussion around it
<FromGitter> <zatherz> a `.to_json_type` would be great
<FromGitter> <zatherz> if the limitation can't be worked around
<FromGitter> <jwoertink> Yeah, that would be nice
<FromGitter> <jwoertink> I would assume that this will be a common issue with people
<FromGitter> <zatherz> @jwoertink yeah, like I mentioned earlier, I also experienced this limitation some time ago
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
sardaukar has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
<crystal-gh> [crystal] bmulvihill opened pull request #3518: Enum from_value when Flags (master...enum-from-value) https://git.io/vX0n7
<FromGitter> <askn> hey how can i solve this problem https://carc.in/#/r/1dim
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
<FromGitter> <askn> hmm sorry i solved
soveran has quit [Remote host closed the connection]
sardaukar has quit [Quit: Leaving]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
<crystal-gh> [crystal] samueleaton opened pull request #3519: Adds TODO statement parsing for docs (master...doc-todo) https://git.io/vX0ux
ssvb has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
A124 has quit [Ping timeout: 252 seconds]
A124 has joined #crystal-lang
soveran has joined #crystal-lang
Renich_ has joined #crystal-lang
Renich has quit [Ping timeout: 246 seconds]
Renich_ has quit [Quit: leaving]