RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.1 | Fund Crystal's 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 quit [Ping timeout: 248 seconds]
soveran has quit [Remote host closed the connection]
mgarciaisaia has quit [Quit: Leaving.]
<bmcginty> Exilor: There's ticks, tenths of a ms, but I don't think that's what you're looking for?
mgarciaisaia has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] kostya opened pull request #3731: split spec files, for custom usage (master...spec_split) https://git.io/v1dOV
mgarciaisaia has quit [Quit: Leaving.]
mgarciaisaia has joined #crystal-lang
jsaak has quit [Ping timeout: 240 seconds]
jsaak has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 246 seconds]
mgarciaisaia has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
mgarciaisaia has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
kellabyte has joined #crystal-lang
<kellabyte> does crystal use a GC and if so can you opt out of it and do manual memory management like in C?
pawnbox has quit [Remote host closed the connection]
<FromGitter> <jots_twitter> crystal on the tippy top of hackernews right now: https://news.ycombinator.com/item?id=13209575
<FromGitter> <samueleaton> Thats awesome!
pawnbox has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
crystal-lang856 has joined #crystal-lang
<FromGitter> <sdogruyol> wow
<FromGitter> <sdogruyol> i'm curious why it's on top now
bjz has joined #crystal-lang
<FromGitter> <samueleaton> Yes crystal has a garbage collector. https://crystal-lang.org/2013/12/05/garbage-collector.html
pawnbox_ has quit [Read error: Connection reset by peer]
<crystal-gh> [crystal] firejox closed pull request #3723: fix unexpected behavior in Slice(T)[] with T is numeric type (master...fix-unexpected-slice) https://github.com/crystal-lang/crystal/pull/3723
pawnbox has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox_ has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
crystal-lang856 has quit [Ping timeout: 260 seconds]
pawnbox has quit [Read error: Connection reset by peer]
<FromGitter> <Exilor> bmcginty: nope :worried:
pawnbox has joined #crystal-lang
vivus-ignis has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter> <yxhuvud> You should be able to get that from libc though, so while it may not be nice to work with, it may be good enough for now until someone implement it in the language
<FromGitter> <Exilor> I've tried to mess around with LobC.clock_gettime but i'm not getting the results i get with java
<FromGitter> <Exilor> i'd think it'd be something like (timespec.tv_nsec.to_i64 + (timespec.tv_sec.to_i64 * 1e+9).to_i64), but nope
ponga has quit []
mooe has joined #crystal-lang
<FromGitter> <jots_twitter> is this not right? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ prints about a billion. [https://gitter.im/crystal-lang/crystal?at=585794bfe7bdfe4e29707353]
<FromGitter> <Exilor> not like java, no
<FromGitter> <Exilor> https://repl.it/EtIw
<FromGitter> <Exilor> i went looking for how java implements it and it appears to be the same way
<mooe> is it possible to get the remote ip with http server/kemal?
<FromGitter> <Exilor> mooe: if you have access to the socket shouldn't you be able to call .remote_address.address on it?
<FromGitter> <sdogruyol> @mooe it's still not yet merged into Crystal
<FromGitter> <sdogruyol> however you can get Host from HTTP headers (hopefully)
<mooe> alright cool, I tried x-real-ip, didn't know about host, thanks!
<FromGitter> <jots_twitter> @Exilor : I see. Yeah not sure what that java nanotime is. if I divide crystal's nanotime by 1_000_000_000 I get correct unix epoch time.
<pleiosaur> what types in crystal, if any, are implicitly nullable? are types only nullable if I explicitly make a union with nil?
<FromGitter> <Exilor> no type is implicitly nullable AFAIK
<FromGitter> <sdogruyol> @pleiosaur the compiler will yell at you
vivus-ignis has quit [Quit: vivus-ignis]
<pleiosaur> cool
mark_66 has joined #crystal-lang
akwiatkowski has joined #crystal-lang
Philpax has joined #crystal-lang
<Yxhuvud> or well, it will yell at you if you try to call a method not present on nil.
soveran has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
mooe has quit [Quit: Connection closed for inactivity]
bjz_ has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<Yxhuvud> Bleh. It is irritating that I cannot set instance variables to self in the constructor as it will be nilable then :/
fedruantine has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
pawnbox has joined #crystal-lang
matp has quit [Read error: Connection reset by peer]
matp has joined #crystal-lang
<FromGitter> <bcardiff> You should be able. As long as it is the last assignment i think. If you make a call with self in the initialize all not assigned ivar upto that call will necessarily be nilable.
<Yxhuvud> well it was more than one variable.
<Yxhuvud> And there was no calls at all inside initialize.
<Yxhuvud> But I'll happily take suggestions for how to implement doubly linked circular lists without placeholder classes (or putting not_nil! absolutely everywhere)
elroncio has joined #crystal-lang
elroncio has left #crystal-lang ["Bye"]
<Yxhuvud> basically I want to set @nxt and @prev to self.
<Yxhuvud> which I am not allowed to.
<Yxhuvud> (and yeah, I realize this is abusing the hell out of the type system)
<crystal-gh> [crystal] MakeNowJust opened pull request #3732: Add "expand" command to Crystal tools (master...feature/crystal-tool/expand) https://git.io/v1dpm
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
pawnbox_ has quit [Ping timeout: 248 seconds]
<FromGitter> <bcardiff> @Yxhuvud, you can use `uninitialized` in this scenario to avoid some compiler checks and have self referencing instances. Like "trust me, I will assign it and nothing will go wrong", but if you screw up is your fault not the compiler's. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5857e450058ca96737668785]
<crystal-gh> [crystal] MakeNowJust opened pull request #3733: Fix crystal-type-id :nodoc: (master...fix/primitives/doc-crystal-type-id) https://git.io/v1djW
<Yxhuvud> It doesn't seem to work with two such variables.
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
bjz has quit [Max SendQ exceeded]
minus has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
bjz has joined #crystal-lang
Philpax has quit [Ping timeout: 248 seconds]
jee12 has joined #crystal-lang
<FromGitter> <bcardiff> You are right, my bad. There might be a limitation with self. To avoid polluting the code you can try something like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ which wont polute only in the apareance, since `property!` expands with `#not_nil!`. [https://gitter.im/crystal-lang/crystal?at=5857e9ba0730ce6937e3f3ef]
boo has joined #crystal-lang
boo is now known as Guest56274
<Guest56274> hi
Guest56274 has quit [Client Quit]
jee12 has quit [Ping timeout: 260 seconds]
<FromGitter> <yxhuvud> Eh, but then I don't get setters. Lets leave it at that it isn't as simple as one could wish it to be.
<FromGitter> <bcardiff> @yxhuvud granted, but `property!` expands to getter and setter. I don't follow you.
pawnbox has joined #crystal-lang
ponga has joined #crystal-lang
ponga has quit [Client Quit]
ponga has joined #crystal-lang
<Yxhuvud> never mind, I misread the compilation error I got.
<crystal-gh> [crystal] asterite opened pull request #3734: Array/Enumerable/Iterator reuse flag (master...feature/reuse) https://github.com/crystal-lang/crystal/pull/3734
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
grindhold has quit [Ping timeout: 248 seconds]
grindhold has joined #crystal-lang
trajing has quit [Ping timeout: 248 seconds]
trajing has joined #crystal-lang
greengriminal has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite closed pull request #3733: Fix crystal-type-id :nodoc: (master...fix/primitives/doc-crystal-type-id) https://git.io/v1djW
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://github.com/crystal-lang/crystal/commit/1274a19716b05194983dcb6f2efc0b39761a35ed
<crystal-gh> crystal/master 1274a19 TSUYUSATO Kitsune: Fix crystal-type-id :nodoc:
mgarciaisaia has joined #crystal-lang
soveran has joined #crystal-lang
<travis-ci> crystal-lang/crystal#1274a19 (master - Fix crystal-type-id :nodoc:): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/185203847
<crystal-gh> [crystal] Sija opened pull request #3736: PR #3681 followup (master...pr-3681-followup) https://github.com/crystal-lang/crystal/pull/3736
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <crisward> Looks like github is going to hit 7k* today. Must be the hacker news effect.
greengriminal has joined #crystal-lang
<FromGitter> <petehuang> @crisward not just *s but new people in the gitter, like me!
<FromGitter> <crisward> @petehuang Welcome to crystal land :smile:
<FromGitter> <petehuang> @crisward thanks, exciting to be here! i'm CS educated but not a dev, so will be looking to help the community through non-technical stuff. ideas appreciated!
<minus> are stars even an indicator of anything
<minus> +useful?
<FromGitter> <crisward> I personally only star stuff I'm using in someway... more users is a good thing if that's what it means
<minus> i star stuff i think is cool but i don't necessarily use. though it's likely proportional to real users anyway
<minus> is there a good example that shows off crystal features? the Hellow World and HTTP Server examples in the docs are not exactly representative
<dom96> crisward: that's a cool link
<dom96> Would be interesting to compare git clone numbers between Nim and Crystal
soveran has quit [Remote host closed the connection]
<minus> you don't need to clone the repo to try/use crystal though, so not sure how representative that is either
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<FromGitter> <crisward> <minus> That depends on the audience... I mainly do web dev so links to kemal would be cool. Though I suppose awesome crystal (https://github.com/veelenga/awesome-crystal) provides that kind of thing.
<dom96> minus: then perhaps a combination of website download numbers and git clones.
<minus> if it's not in distro repos, yes
soveran has quit [Remote host closed the connection]
<FromGitter> <bcardiff> having stars helps in discoverability. One might choose to list languages in an article based on github stars in the absence of a better criteria. I think is useful but not in a formal way.
<minus> it's a popularity indicator, yes, but not a (direct) usage indicator
<FromGitter> <bcardiff> The only way to have proper stats would be to add google analytics or similar in the compiler, as brew is doing nowadays. But I woudn't say it's a way to go right now.
mgarciaisaia1 has joined #crystal-lang
<RX14> I've been in the HN thread all day answering questions. There's a lot of support which is nice.
<minus> i was thinking about suggesting that earlier, as a joke. if you ever do that i'll hate you
soveran has joined #crystal-lang
<FromGitter> <bcardiff> I hope you don't mean it personally. :-). I am not against analytics in general. It gives you a way of making better decisions based on actual data/usage. brew is able to prioritize things better based on most used formulas for example. It is controversial for sure, but I get the other side of the story of collection anonymous usage data.
mgarciaisaia has quit [Ping timeout: 258 seconds]
soveran has quit [Remote host closed the connection]
<FromGitter> <bcardiff> it was discussed at https://changelog.com/podcast/223 if you are interested. ⏎ Yet, I don't need you need to worry about it.
<minus> it's fine if a) it's not using google analytics but something self-hosted and b) asks you for permission on first run
<minus> undefined local variable or method 'type_restrictions_generic' ← well, that doesn't look like it's supposed to happen (running the first snippet under 'free variables' https://crystal-lang.org/docs/syntax_and_semantics/type_restrictions.html)
<minus> (with crystal eval)
<RX14> minus, works for me https://carc.in/#/r/1h9v
<RX14> minus, try using `crystal play` instead of crystal eval, it's a much nicer tool
<minus> works with crystal run, but not crystal eval
<minus> REPL?
<RX14> not quite a repl but similar in utility
<minus> oh, not bad
<RX14> it's as close as you can get in crystal
<minus> pretty nice even, though i really prefer not working in a browser
<RX14> minus, there's this if you want an awful hack https://github.com/greyblake/crystal-icr
<RX14> but make sure to read the readme on how it works
<minus> nah, vim & crystal run works fine. slap it into a loop with inotifywait and i'm golden
<RX14> sounds good
<minus> nice type pattern matching there with "free variables" already, but i want more
go|dfish has quit [Ping timeout: 248 seconds]
<RX14> any examples? I find the current behaviour quite nice
<minus> i didn't mean from that feature, i'm just looking for more compile time features
<minus> like emitting new code
<minus> concepts also
go|dfish has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<RX14> you can use macros to emit new code at compile time
<RX14> its really quite powerfull
<minus> aw, you can't associate data with enum constants (like Java)
<Papierkorb> minus: This is actually one of the few features I like from Java, and I'd love to see it. However, you can add methods to enums and then do a case on `self` as "mapping"
<minus> Papierkorb: yeah, it's the feature i miss most in other langs (read: C++). you can emulate it like that but it's dangerous (if you forget a constant)
<Papierkorb> Yep that's why I meant it as work-around. Currently I'm too tired, but feel free to open a GH issue suggesting this. I've not asked other ppl yet about this so I don't know if people will like or dislike it :)
<RX14> ^
<RX14> i would support it if implemented well
<BlaXpirit> i dont understand what feature was just discussed
<RX14> BlaXpirit, google java enums to get an idea
<RX14> basically each enum value gets it's own signleton instance
<RX14> with it's own methods and the like
<Papierkorb> Also fits great into the "everything is an object" idea
<BlaXpirit> i dont see a good use for that
<BlaXpirit> maybe something that looks cool but nothing that can be easily done through other means
<BlaXpirit> can't be
<minus> i've used it before to map strings to factories. create an object of different subtype depending on a string. instaciating objects from json
<minus> those blocks seem really great, but the 'discard superfluous args to yield' and 'block can control the control flow of the executing function' bug me
<Papierkorb> That's copied from ruby, and those are great and really powerful features
<minus> is the 'it's an extra arg and there can only be one of it and it's magically called when putting a yield statement' part also from ruby?
<Papierkorb> "it's"?
<BlaXpirit> wait what
<minus> s/it's/the block is/
<RX14> minus, blocks are inlined
<RX14> so the whole block function is copied to the call site
<minus> yeah, i figured, RX14. the idea of messing with the control flow still seems odd to me
<minus> i'm sure it has its uses
<RX14> it really does
<Papierkorb> Enumerable#each
<Papierkorb> As in, for practically everything in collections
<RX14> it's the difference between contrinue; and break; in C
<RX14> when the yield is in a loop
<RX14> you can use `finally` to execute cleanup when yield uses break too
<minus> mhm
<RX14> which you should do anyway
<RX14> because otherwise exceptions would break your cleanup code too
<minus> can blocks capture variables? or just procs
<Papierkorb> sure they can
<minus> can procs be generic?
<Papierkorb> Currently not, no. You can compare Crystal Procs to C++ lambdas iirc
<minus> C++14 lambdas can be generic
<Papierkorb> C++11 was the 'last' standard I used
<minus> (not template<...> but auto)
<RX14> crystal docs are broken for me (see left https://aww.moe/3iss0n.png), anyone got the same?
<Papierkorb> Looks fine here in Firefox
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<minus> looks the same as in the screenshot to me
<minus> (Firefox, uBlock and all the things)
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
<RX14> if i empty cache and hard reload it fixes it
<minus> that macro syntax is meh, too much text templating, though i don't really have a better suggestion
<RX14> don't want to encourage macros too much#
<minus> is there still a chance to replace them by something else?
<RX14> ehh
<RX14> i think current macros are pretty nice
<RX14> macros should be optimized for small things, not massive invasive changes to code
<RX14> it's meant to be a DRY-helper not a "let me rewrite your code for you"
<Papierkorb> really whats wrong with the current macro syntax
<minus> it's better than C++ metaprogramming at least
<minus> but you can't alter the AST, can you?
<minus> i saw that used in an opengl lib in nim, it wrapped all api calls with error checks + throw, that was quite nice
<FromGitter> <bcardiff> Crystal docs was recently updated to last gitbook version. Definitely a cache issue.
<Papierkorb> minus: The `method_missing` hook can do t hat
<BlaXpirit> minus, well wrapping something into other code is exactly the type of things that the current macros excel at
<RX14> minus, you can walk the AST and emit stuff even inside call chains using recursive macros
<RX14> unfortunately thats pretty slow
<minus> RX14: know of an example of that i can look at?
soveran has quit [Remote host closed the connection]
Hates_ has joined #crystal-lang
<FromGitter> <petehuang> @bcardiff i'll be putting in some time on the docs...but wanted to get your perspective first: any high priority / obvious areas of improvement you would like to see?
soveran has joined #crystal-lang
dhk has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<FromGitter> <crisward> Is there a simple way to parse a json file with deeply nested objects , update a value, and save it back as json?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<tilpner> JSON.parse, update, then .to_json?
<FromGitter> <crisward> JSON.parse returns JSON Any - if you try to set a value on json any, you get no = method
<FromGitter> <crisward> though I may be doing something wrong
<RX14> oh thats a solid point
<RX14> you'll need to use parse_raw then maybe?
<RX14> hmm
<RX14> thats a pain
<RX14> I would have to say just create mapping objects would eb the easiest
<maxpowa> deeply nested mappings get really ugly tho
<RX14> not really
<RX14> they don't deeply nest
<RX14> you just get loads of objects
<FromGitter> <crisward> The json file is a bit unknown before I parse it, so mapping isn't that easy. I was looking to use a pull parser and recursively parse an object but it looked like something I'd expect to be in the standard library somewhere. Just checking it didn't exist.
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Remote host closed the connection]
trajing has quit [Ping timeout: 250 seconds]
dhk has quit [Quit: Leaving]
RX14 has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
trajing has joined #crystal-lang
RX14 has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
mgarciaisaia1 has quit [Quit: Leaving.]
trajing has quit [Read error: Connection reset by peer]
RX14 has quit [Read error: Connection reset by peer]
RX14 has joined #crystal-lang
trajing has joined #crystal-lang