RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.1 | 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
return0e has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> If I run `crystal tool expand` on this (https://github.com/dscottboggs/flix.cr/blob/f728a9f93ae3f5ddb349b918b99400172f2d66ab/src/scanner/subtitles/languages.cr) file, with `-cfilename:4:3` I get `no expansion found` ⏎ ⏎ am I doing something wrong or does `expand` just not work sometimes
<FromGitter> <Blacksmoke16> stdlib doesnt include the 418 HTTP code, :sadpanda:
<FromGitter> <arnavb> Quick question: Does Crystal's built in HTTP response support the parsing of link headers?
<FromGitter> <arnavb> I really don't want to do it by hand...
<FromGitter> <Blacksmoke16> https://dev.to/blacksmoke16/creating-a-json-api-with-athena--granite-510i @mps @girng Blog post/tutorial is finally done :)
f1refly has quit [Ping timeout: 268 seconds]
sagax has joined #crystal-lang
f1refly has joined #crystal-lang
bmcginty has joined #crystal-lang
jemc has quit [Ping timeout: 250 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <kingsleyh> Morning :g
<FromGitter> <kingsleyh> πŸ˜„
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
laaron- has quit [Client Quit]
<FromGitter> <bararchy> Morning :)
<FromGitter> <drum445> Hello there
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <girng> Hi!
<FromGitter> <suzaku> Hi!
<FromGitter> <j8r> There aren't user defined primitives?
<FromGitter> <suzaku> What are user defined primitives?
<FromGitter> <j8r> I see it in https://c7.se/from-go-to-pony/
<FromGitter> <j8r> > User defined primitive types (like a class, but has no fields and there is only one instance)
ashirase_ has quit [Ping timeout: 272 seconds]
ashirase has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <straight-shoota> What's the difference to a singleton sruct with no ivars?
lucasb has joined #crystal-lang
<FromGitter> <straight-shoota> mps, tcp server spec has been fixed in master: https://github.com/crystal-lang/crystal/pull/7484 Thanks for reporting!
<FromGitter> <arnavb> Can't find anything about link header parsing in the standard library. Looks like I'll have to do it by myself.
<FromGitter> <kingsleyh> Thanks for all the hellos :) really cheered me up - not having a great day today
<mps> straight-shoota: ok, thanks for info, will note this for next release, to remove patch from apk
sagax has quit [Quit: Konversation terminated!]
sagax has joined #crystal-lang
ternarysolo has joined #crystal-lang
ua has quit [Ping timeout: 255 seconds]
ua has joined #crystal-lang
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
<FromGitter> <bew> @arnavb what do you mean by "link header parsing" ?
<jokke> nice
<FromGitter> <j8r> yes jokke! It was initiated by guys from Sandstorm
<jokke> i have no idea what sandstorm ist
<jokke> *is
<jokke> i'll try implementing a serializer when i get time
<FromGitter> <j8r> a self-hosted solution for applications
<jokke> oh
<jokke> that's super nice
<jokke> never saw this
<jokke> it has all the stuff!
<FromGitter> <j8r> IMO it's over complicated, still cool
<FromGitter> <j8r> (Sandstorm)
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
clickbai1 has joined #crystal-lang
clickbai1 has quit [Client Quit]
clickbai1 has joined #crystal-lang
clickbai1 is now known as snapcase
jemc has joined #crystal-lang
<jokke> mmh
<jokke> i wish there was something similar but using docker instead of vagrant
<oz> jokke: like lxc ?
<jokke> !g lxc
<jokke> ups
<DeBot> [lxc]: No results found.
<jokke> oh!
<jokke> nice
<jokke> it worked (kinda)
<jokke> oh
<jokke> wat?
<jokke> how is that similar to sandstorm?
<oz> jokke: Sorry, I misunderstood. I thought you were talking about virtualization, and alternatives to things like docker.
<jokke> ah
<jokke> yeah no
<oz> (docker is not virtualization, I know... lalala)
<jokke> :)
<jokke> i mean there is dokku
<jokke> but something with a web interface and a package repo would be nice
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://dev.to/blacksmoke16/creating-a-json-api-with-athena--granite-510i for the europeans who didnt see it last night πŸ’―
<FromGitter> <bew> jokke capnproto looks pretty cool
<FromGitter> <j8r> jokke I'm building https://github.com/DFabric/dppm
<FromGitter> <j8r> I uses no LXC, Docker, jails or VMs
<FromGitter> <j8r> in fact all of this aren't necessary if we think more about this
<FromGitter> <j8r> we can secure with a dedicated user and group, file permissions, cgroups
<FromGitter> <j8r> But I need help for the Web side :(
<rkeene> jokke, http://rkeene.org:8080/
<rkeene> j8r, I just exposed mine via Gotty :-D
<FromGitter> <j8r> rkeene, alias "tcl guy"
<rkeene> I started the server side in Crystal, to be fair
ternarysolo has quit [Quit: The Lounge - https://thelounge.chat]
<rkeene> But GoTTY ended up being a better interface for demo-ing it
<FromGitter> <jwoertink> Anyone have a good blog post / tutorial on when to choose a struct vs class? I always feel like it's a crap shoot for me and never have a clear idea of when to use one over the other
<rkeene> Traditionally structs only have data fields, and classes have methods
<FromGitter> <dscottboggs_gitlab> that's not really so in crystal
<FromGitter> <malkomalko> Pass by Value vs Pass by Reference is an important thing to understand. Structs are a Value type, so you can think of them as Immutable
<FromGitter> <dscottboggs_gitlab> yes that
<mps> rkeene: you take my words :) you were faster. that is clear and concise explanation
<FromGitter> <malkomalko> I ruined your ☝️ sorry :)
<rkeene> But apparently not Crystalized :-D
<FromGitter> <dscottboggs_gitlab> haha no it's fine
<FromGitter> <jwoertink> Ok, I guess that makes sense
<mps> structures are data and classes are behavior
<FromGitter> <dscottboggs_gitlab> Yeah, structs in crystal can have methods and are mutable so neither of those really make sense here. But you do need to take care of how you handle changes made to a struct. Classes are pointers, Structs are not
<FromGitter> <jwoertink> So if I have an object where I need to do `thing.x = 123` at some point, then class is better since it's mutable. But if I only ever do `thing.x` then struct is better?
<FromGitter> <dscottboggs_gitlab> also, you can define methods on structs in lots of other languages
<FromGitter> <malkomalko> Yah, or if you have some data you don't want mutated when you are passing it in to some function.
<FromGitter> <jwoertink> cool. Thanks all
<FromGitter> <dscottboggs_gitlab> no, saying `thing.x = 123` is okay, it's when you do `thing.method_that_mutates` where internally `method_that_mutates` calls `@x = 123`. If that was the case you would need to call `thing = thing.method_that_mutates`
<FromGitter> <dscottboggs_gitlab> actually, is `thing.x = 123` ok?
<FromGitter> <jwoertink> πŸ‘
<FromGitter> <j8r> On my side i mostly use structs, for perf reasons. Unless it has to be a recursive type (`T#var : T`), or passing by reference.
<FromGitter> <dscottboggs_gitlab> oh, I appear to be incorrect https://play.crystal-lang.org/#/r/6dnr
<FromGitter> <dscottboggs_gitlab> you can mutate a struct from a method? weird...
<FromGitter> <j8r> Yes of course
<FromGitter> <dscottboggs_gitlab> No I remember its when you pass the struct to something else
<FromGitter> <j8r> But don't expect to mutate a struct inside a struct inside a struct
<FromGitter> <dscottboggs_gitlab> there we go https://play.crystal-lang.org/#/r/6dnu
<FromGitter> <j8r> I prefer passing by value generally, this avoids side effects
<jokke> it's not possible to explicitly document protected methods right?
<jokke> (so that they show up in crystal docs generated output)
<FromGitter> <arnavb> By link header parsing, I mean what the Github API uses for pagination.
<jokke> i'm asking because i have a module defining an abstract protected method which has to be implemented by the including structs/classes
<jokke> i wanted to document what that method should do
<FromGitter> <arnavb> This explains it in more detail: https://developer.github.com/v3/guides/traversing-with-pagination/#navigating-through-the-pages ⏎ ⏎ The format of link headers isn't very nice to parse, though, which is why I'm looking for a parser that already exists.
<robacarp> jokke doesn't a protected method defeat the purpose of an abstract method?
<jokke> no, why would it?
<robacarp> an abstract method delares a signature so that other implementors can use it external to the class. protected methods can't be used outside the class.
moei has joined #crystal-lang
<jokke> protected methods can be used in inheriting classes
<jokke> private methods can't
<jokke> also this wouldn't necessarily be a problem even if this was the case, if the super class is the one calling the method
Simerax has joined #crystal-lang
Simerax has quit [Quit: https://quassel-irc.org - Komfortabler Chat. Überall.]
return0e_ has joined #crystal-lang
return0__ has joined #crystal-lang
return0e has quit [Ping timeout: 250 seconds]
return0e_ has quit [Ping timeout: 250 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
rohitpaulk has joined #crystal-lang
DTZUZO has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <jwoertink> @vladfaust in that example, you have `ENV["POST"]` where I'm sure you meant `ENV["PORT"]`
<FromGitter> <jwoertink> but great post!
<FromGitter> <vladfaust> Thank you, @jwoertink!
<FromGitter> <vladfaust> I've fixed it, gracias
<FromGitter> <jwoertink> de nada
<FromGitter> <jwoertink> hmm... @vladfaust when I try to boot your example, I get `Unhandled exception: ERR Syntax error, try CLIENT (LIST | KILL | GETNAME | SETNAME | PAUSE | REPLY) (MiniRedis::Error)`
<FromGitter> <vladfaust> You should have Redis version >= 5
<FromGitter> <vladfaust> It require CLIENT ID command
<FromGitter> <vladfaust> https://redis.io/commands/client-id
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> thanks. I'll upgrade. I'm running 3 apparently lol
<FromGitter> <jwoertink> haha, and now I just read your post where you mention that :p Guess I should have kept reading
<FromGitter> <vladfaust> No problem, will put it higher
<FromGitter> <jwoertink> hmm... actually... Just upgraded to 5.0.3 and it's still doing it
<FromGitter> <vladfaust> Make sure your REDIS_URL is pointing to the updated instance
<FromGitter> <vladfaust> It can be clearly seen from the error that your redis instance is missing `ID` command
<FromGitter> <jwoertink> yeah, something else must be up. I went in to the redis-cli and it fails there too every though it returns version 5
<FromGitter> <vladfaust> Maybe you need to restart it?
<FromGitter> <vladfaust> Also join gitter.im/onyxframework to not disturb other habitats here
<z64> in C bindings, what is the difference between a struct with members written like `member : T` vs. `member: T`? if any?
<FromGitter> <dscottboggs_gitlab> `member: T` is invalid syntax
<FromGitter> <dscottboggs_gitlab> To specify type annotations, you have to put a space both before and after the colon, to differentiate it from a named argument and from a method call with a symbol as a parameter
<z64> no, it is apparently valid for C bound structs
<FromGitter> <dscottboggs_gitlab> well I'll be damned (https://play.crystal-lang.org/#/r/6dpr) it works for classes too
<FromGitter> <dscottboggs_gitlab> The rule I mentioned above apparently only applies to type restrictions inside of method definitions
<z64> yes im familiar with how type restrictions normally look; ive been using crystal for about 2 years :) however, my question is specifically about C structs in `lib` definitions. there are special ways some things translate to C when writing bindings and i wanted to check i wasnt missing something
<z64> maybe it is the same and it doesnt matter.
hightower3 has joined #crystal-lang
<hightower3> Hey, didn't check in a while, how's things on the threads support front?
return0e has joined #crystal-lang
return0__ has quit [Ping timeout: 255 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <botanicus> Hey guys. I'm having some issues with the `inherited` macro. Does anyone know what's going on in here: https://gist.github.com/botanicus/278b0741948238c2b10bee2248145abb ? Thanks!
<FromGitter> <Blacksmoke16> let me take a look
ua has quit [Ping timeout: 244 seconds]