ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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
<crystal-gh> [crystal] mverzilli pushed 1 new commit to master: https://git.io/v5sW3
<crystal-gh> crystal/master 98af739 Konovod: fixes initialization of ISAAC PRNG without explicit seed...
<FromGitter> <elorest> Any idea how to turn YAML into a hash or namedtuple? ⏎ it seems like it should be easy.
<travis-ci> crystal-lang/crystal#98af739 (master - fixes initialization of ISAAC PRNG without explicit seed): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269026813
<travis-ci> crystal-lang/crystal#98af739 (master - fixes initialization of ISAAC PRNG without explicit seed): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269026813
<travis-ci> crystal-lang/crystal#98af739 (master - fixes initialization of ISAAC PRNG without explicit seed): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269026813
<FromGitter> <wwselleck> Is there community want for a static site generator ala Hugo, Hexo, Jekyll, etc?
<FromGitter> <wwselleck> There doesn't seem to be anything similar for crystal yet.
maxpert has joined #crystal-lang
<FromGitter> <picatz> Speaking for myself: I've never used a static site generator.
maxpert has quit [Ping timeout: 240 seconds]
<FromGitter> <wwselleck> do you run a blog?
<FromGitter> <picatz> I host mine on medium: https://medium.com/@KentGruber πŸ˜…
<FromGitter> <picatz> I'd love something like https://github.com/dmendel/bindata for crystal I'd think.
<FromGitter> <picatz> I'd imagine if I wrote a lil blog thing in Crystal I'd just use Kemal.
<FromGitter> <picatz> Though something like Jekyll is obviously is trying to fit a different problem then I guess the ones I have.
<FromGitter> <picatz> I'd really love to continue to see Crystal be used for more than just web application stuff. I've toyed with some command line application stuff for example: https://github.com/picatz/argz
<FromGitter> <picatz> Though just using crystal's option parser https://crystal-lang.org/api/0.23.1/OptionParser.html is totally coo'
<FromGitter> <picatz> Weirdly, I actually took some of the design from Argz ( which I do plan on continue working on at some point ) and started working on a ruby version: https://github.com/picatz/command_lion
<FromGitter> <picatz> I'm not quite sure how I'll manage the projects yet. Maybe I'll make command lion both a ruby and crystal command line framework.
<FromGitter> <picatz> I've at least half certain I can copy the logic I developed in command lion back into crystal, especially since argz gave the starting grounds for command lion.
<FromGitter> <picatz> I'm still not entirely sure if I've finalize how I want command lion to work, which would probably make it a bit silly trying to translate that over to Crystal again and then have this weird back and forth.
<FromGitter> <picatz> Then it's like, why stop there and just implement it in a third language?
<FromGitter> <wwselleck> yeah i think itd be best to focus on one language for that
<FromGitter> <picatz> For now, I *guess* I'll just stick with Ruby.
<FromGitter> <picatz> I do like how easy it is to translate my ideas from one to the other though.
<FromGitter> <picatz> Like, I'm sure I could probably just do some back and forth during development and not be that bothered at all.
<FromGitter> <picatz> Assuming there was no one using it, basically.
<FromGitter> <wwselleck> i've never really considered not using a static site generator for my personal website
<FromGitter> <wwselleck> the big thing is the blog markdown stuff
<FromGitter> <wwselleck> the problem with using like kemal is that you have to run the server
<FromGitter> <wwselleck> with a compiled site, I can just put it on x.github.io and have it hosted for free by github
<FromGitter> <wwselleck> and not be in the business of managing a server
<FromGitter> <picatz> I guess it depends what you want to do, right?
<FromGitter> <picatz> And EC2 instance is easy to deploy. Tools like Vagrant and all the devops magic in the world can allow you deploy your kemal server ( or whatever ) without much hassel at all.
<FromGitter> <picatz> At least, I genuinely enjoy automating and deploying my own stuff. I think kemal makes it really easy, but I can see where you wouldn't want to mess with that stuff.
<FromGitter> <wwselleck> yeah it might be a good learning experince...
<FromGitter> <wwselleck> deploying is one thing i have little experience in
<FromGitter> <picatz> It's genuinely not hard to do, and in every aspect free.
<FromGitter> <picatz> You can start small and then roll out your deployments in more elaborate ways.
<FromGitter> <picatz> Like, start with shell scripts, mess around with tools like puppet or chef.
<FromGitter> <picatz> InSpec for making sure it is actually configured that way that it is.
<FromGitter> <picatz> Like, auditing, automating, orchestrating, all the fun words. It's super accessible in my experience.
<FromGitter> <picatz> And there's all these super helpful guides you can find by *just google'n*
<FromGitter> <picatz> Or youtube videos *for days*
<FromGitter> <wwselleck> i think im gonna give a go at a static site gen, if for nothing else to contribute something to the community while learning
<FromGitter> <wwselleck> is Argz in a usable state?
<FromGitter> <wwselleck> i might use it myself
<FromGitter> <picatz> I can run things
<FromGitter> <picatz> It probably needs some touch ups.
<FromGitter> <wwselleck> I'd be happy to contribute, I'm just trying to get into the crystal community in any way
<FromGitter> <wwselleck> ive been jumping arund between different new languages and have definitely settled here
<FromGitter> <picatz> Feel free to man!
<FromGitter> <picatz> Like, I'm sure it needs the help.
<FromGitter> <picatz> command_lion can give some clues as to what I'm going to end up going for with argz
<FromGitter> <picatz> for one thing, argz things of flags as strings that start with `-` or `--`
<FromGitter> <picatz> Which I don't enforce in command_lion
<FromGitter> <picatz> There's also some other cases in argz where I'm not being consistent with command lion and can't think of.
<FromGitter> <picatz> But, it has a wiki
<FromGitter> <wwselleck> you dont want to enforce flags starting with - or --?
<FromGitter> <picatz> Nah
<FromGitter> <picatz> I want the user to be able to do that.
<FromGitter> <wwselleck> you want that configurable or something?
<FromGitter> <picatz> Maybe that'd be cool
<FromGitter> <picatz> But, it can be just sort of naturally enfored in the app's style
<FromGitter> <picatz> like the person developing the app could choose to use - or -- style flags or not
<FromGitter> <picatz> The string really shouldn't matter, after I thought about it
<FromGitter> <wwselleck> whatr the other flag options?
<FromGitter> <picatz> Right now it's just a silly `short` and `long` thing going on
<FromGitter> <picatz> Command lion handles flags how I want argz to.
<FromGitter> <picatz> the `flags` keyword for a command block does some nice things :
<FromGitter> <wwselleck> ahh ok ill take a look at that
<FromGitter> <picatz> It will take the first argument as the the short argument if not used in a block
<FromGitter> <wwselleck> also, any particualr reason you're double dipping in ruby and crystal and not just full on crystal?
<FromGitter> <wwselleck> im no ruby dev, but to me it looks like there are only upsides to crystal
<FromGitter> <wwselleck> as opposed to ruby
<FromGitter> <picatz> I love ruby, a lot.
<FromGitter> <wwselleck> i want to love ruby, but have always been turned off by the speed
<FromGitter> <picatz> There's also some really nice debugging support that I miss when developing crystal.
<FromGitter> <picatz> Ruby's speed has come into play a handful of times in my life.
<FromGitter> <picatz> But, usually I just like the syntax compared to something like go
<FromGitter> <wwselleck> oh i use go at work and do not like it at all
<FromGitter> <picatz> I love the crystal takes the best of both worlds in a way
<FromGitter> <wwselleck> i tried making that "my" language, but just coudlnt
<FromGitter> <picatz> I've done some weird stuff like doing go bindings to ruby.
<FromGitter> <wwselleck> its just tooo bare bones. Just to make a data type sortable takes like 50 lines.
<FromGitter> <picatz> I think Crystal does everything go does better ( in my opinionated opinon )
<FromGitter> <picatz> Feel free to make issues or whatever as you find them and we can address them on github / put that shiz into version control
<FromGitter> <picatz> Even if you have questions for how something works.
<FromGitter> <picatz> That way, if someone else had a similar question, at least it'd be documented.
<FromGitter> <wwselleck> This would be triggered using ./myprogram --read
<FromGitter> <wwselleck> ?
<FromGitter> <picatz> it'd be used like: `$ ruby cat file.txt | ruby app.rb --read`
<FromGitter> <picatz> oh wait
<FromGitter> <picatz> no
<FromGitter> <picatz> my bad
<FromGitter> <picatz> wrong one I was thinking of in my head
<FromGitter> <picatz> it'd be `$ruby app.rb --read file.txt`
<FromGitter> <picatz> for that one
<FromGitter> <picatz> ( I'm dumb sometimes, sorry πŸ˜„ )
<FromGitter> <picatz> I'd like to add `:file` type I'd think
<FromGitter> <picatz> That way I can have a nice little wrapper for when users are working with files perhaps.
<FromGitter> <picatz> It'd be an opt-in thing, where they could just use `:string` and then open the file.
<FromGitter> <picatz> But, I'd like for a `:file` type to have some sort of builtin helper method to abort if the file doesn't exist or something maybe.
<FromGitter> <wwselleck> ```command hello do ⏎ flag "hello"``` [https://gitter.im/crystal-lang/crystal?at=59a37dca8f4427b462a6627c]
<FromGitter> <wwselleck> is the flag redudant there
<FromGitter> <picatz> The flag would probably be redundant there, yeah.
<FromGitter> <picatz> Don't forget the `end` of course ;)
<FromGitter> <picatz> The command `:index` is used to basically be able to reference the command object elsewhere in the app.
<FromGitter> <picatz> commands and options ( which are direct subclasses of commands ) are indexed in hashes basically.
<FromGitter> <picatz> the index ( key ) being the `:index` symbol you give it.
<FromGitter> <picatz> The index is also used as the default flag if not specified otherwise.
<FromGitter> <picatz> I've sort of recently adopted that.
<FromGitter> <picatz> But, I'm cool with it. I think it makes things simpler without adding too much complexity. I think.
<FromGitter> <picatz> In practice there wouldn't be a big problem being redundant if people didn't know and always set the flag
<FromGitter> <picatz> I almost never use the `flags` block in my examples
<FromGitter> <picatz> There you can explicitly set `short` and `long` flag types.
<FromGitter> <picatz> I gotta go do some stuff, but I'll be back later ✌️
<FromGitter> <wwselleck> l8r
<FromGitter> <wwselleck> oh boy this whole block/yield stuff is going to take some practice.
<FromGitter> <wwselleck> it seems similar to nodeish callbacks on the surface, but they're used very differently it seems
go|dfish has quit [Ping timeout: 246 seconds]
go|dfish has joined #crystal-lang
maxpowa has quit [Ping timeout: 252 seconds]
maxpowa has joined #crystal-lang
lost_in_synapses has joined #crystal-lang
lost_in_synapses has left #crystal-lang [#crystal-lang]
<FromGitter> <picatz> It's not too bad, but takes some getting used to: https://gist.github.com/picatz/7f280bea5b8cf05491df95fbb445d78c
<FromGitter> <picatz> You can do some nifty things with blocks.
<FromGitter> <picatz> Best thing to do is load up crystal play and play around with stuff.
<FromGitter> <picatz> For really small examples.
maxpert has joined #crystal-lang
maxpowa has quit [Ping timeout: 252 seconds]
maxpert has quit [Ping timeout: 240 seconds]
<FromGitter> <Fanna1119> whats the difference between block one and 2 ? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59a3a31d76a757f808ee0b74]
<FromGitter> <picatz> Basically a `do` can be a `{` and a `end` can be a `}`.
<FromGitter> <picatz> So, my understand is, basically nothing.
<FromGitter> <Fanna1119> @picatz ahh thank you :), coming from a non ruby background. i am still in the phase where i don't what works and what doesn't as well as not sure what is the "right" way of doing some things just yet haha
<FromGitter> <picatz> No worries πŸ‘
<FromGitter> <picatz> I don't mind helping out, at least as much as I can πŸ˜‚
maxpowa has joined #crystal-lang
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 240 seconds]
harisamin has joined #crystal-lang
harisamin has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <cevarief> Is it possible to call a class without instantiating but still keep overloading?
<FromGitter> <cevarief> yes possible
<FromGitter> <cevarief> But it should be all using self. Can self call non self method?
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 240 seconds]
<FromGitter> <codenoid> btw, how to activate this > https://github.com/rhysd/vim-crystal#completion
alex`` has joined #crystal-lang
<FromGitter> <codenoid> nice, i use super tab
flaviodesousa has joined #crystal-lang
Groogy_ is now known as Groogy
mark_66 has joined #crystal-lang
<Groogy> Morning!
<vegai> top of the mornin to you laddies
alex`` has quit [Read error: No route to host]
<FromGitter> <krypton97> morning fellows
<FromGitter> <sdogruyol> Morning and have a good week everyone
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
<FromGitter> <krypton97> and a productive one as well ;)
<FromGitter> <cevarief> 1) 25 pm here. Morning everyone πŸ‘
<FromGitter> <Fanna1119> when you use a c binding in crystal and compile your crystal file, is the c library included into the compilation ?
<FromGitter> <ShalokShalom> @picatz somebody here told and link me, that there is actually a difference between {} and do/end
<FromGitter> <ShalokShalom> Papierkorb: I just read your line "Though I'm currently most interested in Widgets, as they're the definitive source of correct native look n' feel" again and realised, that there is stuff like Kirigami, which provides a native look n`feel standard for QML: https://dot.kde.org/2017/08/02/plasma-rocks-akademy
<FromGitter> <ShalokShalom> Its a Tier1 as told, so works without any other KDE framework. :)
<Groogy> @Fanna1119 yes if it is a statically linked library I think it is?
<Groogy> but if it is a shared library it will onmly contain the code to dynamically link with it
<FromGitter> <Fanna1119> @FromIRC just to clarify, a shared a library is usually ".so", and statically linked is .o ?
<FromGitter> <Fanna1119> or do i have it backwards haha
<Groogy> statically linked is .a on Linux at least
<Groogy> it's an archive of object(.o) though
<Groogy> but I am not 100% sure because I haven't tried linking statically with Crystal yet
<FromGitter> <codenoid> agree
_whitelogger has joined #crystal-lang
<FromGitter> <schoening> should modules start with an uppercase?
<FromGitter> <bararchy> It seems that read_timeout and write_timeout does not work for pipes
<vegai> schoening: https://crystal-lang.org/docs/conventions/coding_style.html here's something to start with :)
<FromGitter> <schoening> ups
<FromGitter> <schoening> .. wrong chat sorry
<FromGitter> <schoening> @vegai thank you, crystal has it all specified nicely. I was actually trying to ask in the typescript room :p
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 264 seconds]
bmcginty has quit [Ping timeout: 255 seconds]
<vegai> :}
bmcginty has joined #crystal-lang
<FromGitter> <bararchy> Can I cast an Array(UInt8) to Slice(UInt8) ?
<FromGitter> <bew> You should be able to do #to_slice on it
<FromGitter> <bararchy> @bew ⏎ Error in line 3: undefined method 'to_slice' for Array(UInt8)
<Papierkorb> bew, that never went through lul
<FromGitter> <bararchy> So... no way I guess right ?
<FromGitter> <bew> Huh right not defined... Why? Idk
<FromGitter> <bew> Well, could do `Slice.new(arr.to_unsafe, arr.size)` but it's not pretty..
<FromGitter> <bararchy> Better then nothing
<FromGitter> <bararchy> :)
<FromGitter> <konovod> There was a discussion about it. @asterite said that Slice is supposed to be safe, but `Array.to_slice` isn't safe at all - array can be reallocated after this call, making slice bad. So creating slice should be ugly)
<Papierkorb> *cough* StaticArray
<FromGitter> <konovod> for StaticArray there is `to_slice` as it's safe. But their usage is of course limited. Size can't be too big etc
<Groogy> well Static array isn't safe?
<Papierkorb> It's .. the opposite of safe
<Groogy> It can't reallocate but it is way more prone to be destroyed in comparison
<FromGitter> <bew> @bararchy what did you tried that failed for #4891 ?
<FromGitter> <bararchy> Get a process output via a IO::Memory, as in ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This wont print anything from process to the output, I played with a different processes also, IO#pipe works [https://gitter.im/crystal-lang/crystal?at=59a3fbb0162adb6d2e40a9d8]
<FromGitter> <bararchy> I think It can't work because the Process needs an actual FD which IO::Memory is not
<FromGitter> <bararchy> @bew
<Papierkorb> Correct
<FromGitter> <bararchy> In that case, It should not compile and give an error that IO::Memory cannot be used with Process (no overload of...)
<FromGitter> <bew> right.. it's weird because there should be a copy from the process output, to the memory io..
<FromGitter> <bew> even looking at the code I can't understand why it's not working, can't fond what I'm missing here..
<Papierkorb> It has no file descriptor.
<FromGitter> <bararchy> @bew The process needs an actual FD to write output to, it can't write to the Crystal memory buffer as it's not aware of it's existese
<FromGitter> <bew> I know, but there should be a pipe created, at this point: https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L224
<FromGitter> <bararchy> You can create a dummy FD that is piped to the IO::Memory, but then it's no longer IO::Memory , it's IO#pipe
<vegai> there's no way to make operators take optional arguments, is there?
<Papierkorb> Thankfully not.
<vegai> :)
<FromGitter> <konovod> > It's .. the opposite of safe ⏎ ⏎ why? I thought local variables are GC'd anyway, so if there is a Slice pointing to it it won't be gone.
<vegai> I'm having this problem where I'm defining / for my type, and it might be benificial to have the max precision of the operation be an optional parameter
<Papierkorb> konovod, StaticArray lives on the stack. The GC never sees it.
<FromGitter> <bew> @bararchy following `need_pipe?` def, https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L349 an IO::Memory will return true
<vegai> but perhaps I'll just define "div" to do that
<FromGitter> <bew> and this line https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L228 should continuously copy the coming output to the memory io... no?
<FromGitter> <konovod> @Papierkorb, oh, i see now.
<FromGitter> <bew> Papierkorb, sorry for direct mention, but.. can you spot what I'm missing above?
<Papierkorb> bew, from just reading those few lines, yep that needs_pipe branch should be taken
<FromGitter> <bararchy> So a bug then ?
<FromGitter> <bew> @bararchy maybe your example fails because you're not waiting for the process to finish executing, so you don't have any output yet?
<FromGitter> <bararchy> well
<FromGitter> <bararchy> @bew Still nothing ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59a400d79acddb2407d88a69]
<FromGitter> <bew> well, what do you expect to have in output?
<FromGitter> <bew> can you try with `/bin/ls` ?
<FromGitter> <bararchy> Yeha, lol, I expected for the bash to print the prompt, but not sure why it didnt, ls works, I'll close the issue
<FromGitter> <bararchy> Thanks @bew
<FromGitter> <bew> the prompt is shown only when in interactive mode
<FromGitter> <bew> I think
<Papierkorb> Correct
tdc has joined #crystal-lang
marin has joined #crystal-lang
<marin> Hi, I have a question about my program. I have situation where I need to see class atributes in other class. Any ideas?
marin has quit [Client Quit]
marin has joined #crystal-lang
marin has quit [Client Quit]
marin has joined #crystal-lang
marin has quit [Client Quit]
<FromGitter> <sdogruyol> inheritance, properties?
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 240 seconds]
<FromGitter> <marin117> No inheritance, and not sending object reference to class
<Groogy> do you mean like seeing the methods an object will respond to?
<Groogy> you could get a list through macros I think?
<Groogy> {% Type.methods %} I think gives you a compile time list of methods
<FromGitter> <marin117> Well something like that
<FromGitter> <marin117> I have 2 classes, 1 is abstract and from that class I inherit other class
<FromGitter> <marin117> In those other classes I need to call 1 method from first class
<Groogy> yes and?
<Papierkorb> Just call it?
<crystal-gh> [crystal] akzhan opened pull request #4893: [WIP] Wrong overload called instead of BigFloat.initialize(BigRational). (master...wrong-overload-called-intead-of-initialize-bigrational) https://git.io/v5Gkh
<FromGitter> <marin117> undefined method or local variable
<Papierkorb> We should start something where we can accumulate standard example snippets
<Groogy> Heh to quickly paste things like this?
<Papierkorb> Yeah, it's a waste of the helpers time to write the same basic code over and over again
<FromGitter> <marin117> something like this
<FromGitter> <marin117> is there any better way than properties and referencing object
<FromGitter> <cevarief> > can you try with `/bin/ls` ? ⏎ when using parameter, the output does not show. "ls -alh"
<crystal-gh> [crystal] ysbaddaden opened pull request #4894: Merge SecureRandom into Random and Random::System (master...std-merge-secure-random-into-random) https://git.io/v5GtY
<crystal-gh> [crystal] ysbaddaden closed pull request #4847: Don't show compiler bug message on invalid target machine (master...feature/bugfix/unsupported-arch-error) https://git.io/v7hNF
<crystal-gh> [crystal] MakeNowJust opened pull request #4895: Correctly parse '->foo=' (ProcPointer with '=' suffixed method) (master...fix/crystal/parse-name-eq-proc-pointer) https://git.io/v5Gtd
<FromGitter> <sdogruyol> ugh
<FromGitter> <sdogruyol> doesnt shards init app something creates a folder named something with shard.yml inside?
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/v5Gmc
<crystal-gh> crystal/master fcce0c2 Luis Lavena: Normalize Flate's block interface to `.open`...
<FromGitter> <bew> @marin117 the class name must start with an uppercase lettre
<FromGitter> <sdogruyol> so shards init and crystal init is different :/
<FromGitter> <sdogruyol> that's confusing //cc @ysbaddaden
<Groogy> marin117 classes must be constants and as such you can't write it in smaller case
<Groogy> it would have to be named A
<Groogy> also you would get an error because you are defining it differently between first and second definition
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#e844983 (master - Don't show compiler bug message on invalid target machine): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269192601
<FromGitter> <rufusroflpunch> is there any actual reason to use the shards executable vs. just using the crystal commands?
Liosha has joined #crystal-lang
<Liosha> Sometimes, Crystal is just like C https://carc.in/#/r/2lw2 <3 <3 <3
Liosha has quit [Client Quit]
<travis-ci> crystal-lang/crystal#e844983 (master - Don't show compiler bug message on invalid target machine): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269192601
Philpax__ has quit [Ping timeout: 248 seconds]
<travis-ci> crystal-lang/crystal#e844983 (master - Don't show compiler bug message on invalid target machine): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269192601
<FromGitter> <bitmappergit> is it possible to use a variable in quotes
<Groogy> "#{a + b}"
<FromGitter> <krypton97> I did some benchmarking between playlyfe/go-graphql and crystal graphql
<FromGitter> <sdogruyol> ```name = "Crystal" ⏎ "Hello #{name}"``` [https://gitter.im/crystal-lang/crystal?at=59a42f9aba0f0f6e38f02ef5]
<FromGitter> <krypton97> // Graphql-Cr ⏎ BenchmarkGraphQLGolang-8 200000 5986 ns/op ⏎ PASS ⏎ ok _/home/alex/Projects/Crystal/graphql 1.273s ⏎ ... [https://gitter.im/crystal-lang/crystal?at=59a42fa0614889d475963fa9]
<FromGitter> <krypton97> I thinkg I'm doing something wrong
<FromGitter> <sdogruyol> @krypton97 that seems weird
<FromGitter> <krypton97> Well, time to try with the good old time substraction
<Papierkorb> You're measuring total time of benchmarking tools. You should compare the per operation times as given by them instead
<Papierkorb> 5986ns/op doesn't sound so bad
<FromGitter> <krypton97> ok, here's the code that I used for each lang
<FromGitter> <krypton97> require "graphql-crystal" ⏎ require "benchmark" ⏎ ⏎ schema_definition = <<-graphql_schema ⏎ schema { ... [https://gitter.im/crystal-lang/crystal?at=59a430559acddb2407d986cc]
<FromGitter> <krypton97> and for go
<FromGitter> <krypton97> package graphql ⏎ ⏎ import ( ⏎ "testing" ⏎ "github.com/playlyfe/go-graphql" ... [https://gitter.im/crystal-lang/crystal?at=59a43075210ac26920cdafbe]
<FromGitter> <krypton97> either way, I like how light is the crystal version comparing to the go one
<FromGitter> <krypton97> nvm, now I got 0.002s for golang version
<Papierkorb> Yeah I know which lang I'd choose of those two if the only point of difference would be those exact two snippets
<FromGitter> <krypton97> well, the go version is used in production by the playlyfe guys, the crystal version is kinda new-ish
<FromGitter> <bararchy> Never used GO, WTH is this: `{}{}`
<Papierkorb> Sure, however even if there are any showstopper bugs in the Crystal version, its API wouldn't change (much) by fixing them
<Papierkorb> bararchy, my guess is `interface{}` is an anonymous interface type (in Go, that's "any type goes"), and the following {} could be anything, possibly an empty body for the anon interface we just defined (?)
<FromGitter> <bararchy> Also, what is `:=` is it like `||=` ?
<Groogy> assignment
<FromGitter> <bararchy> Oh, so `=` became `:=`
<FromGitter> <bararchy> ...
<travis-ci> crystal-lang/crystal#fcce0c2 (master - Normalize Flate's block interface to `.open`): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/269195370
<Papierkorb> That syntax was also used by Pascal dialects, possibly others
<Groogy> yeah it is often used in faux code
<Papierkorb> At least then it was meant to hinder you from missing an equal sign in a condition
<FromGitter> <krypton97> map[string]interface{}{} means a map that takes string keys with interface{} value
<FromGitter> <krypton97> := seems better to me for assignment
<FromGitter> <bararchy> it does ? it's an extra char
<FromGitter> <krypton97> but there won't be confusion
<FromGitter> <krypton97> and := is used for declaration and assignment
<FromGitter> <krypton97> not only for assignment
<Groogy> If your performance in coding stuff is affected by an extra char
<Groogy> then I donnu
<FromGitter> <krypton97> Maybe I got used this way
<FromGitter> <kazzkiq> Go shines in terms of performance and compiling speed, but we do have to agree its syntax seems kinda frankenstein sometimes
<FromGitter> <krypton97> I've tried working with postgres go today. It felt like even c++ could do it easier lol
<FromGitter> <bararchy> I'm really looking for an excuse to try the Crystal QT5 lib
<FromGitter> <krypton97> if you wanna use it in production, you need to get a license
<FromGitter> <bararchy> really ??
<FromGitter> <bararchy> even for OpenSource projects ?
<Papierkorb> Not at all
<FromGitter> <krypton97> That's qt as far as I know
<Papierkorb> NO NO NO NO
<FromGitter> <krypton97> Open source is free
<Papierkorb> Heck no
<FromGitter> <krypton97> but for comercial nope
<Papierkorb> krypton97, you're wrong
<FromGitter> <krypton97> Qt free for comercial user, I dont think so
<FromGitter> <krypton97> use*
<Papierkorb> Yeah no I was years in #Qt, and talked to the maintainers time and again about this
<Papierkorb> I think I know what's ok wrt LGPL and what's not
<FromGitter> <krypton97> If you make your code public you can use it for comercial use, but that makes no sense
<Papierkorb> Dude no.
<Papierkorb> Please read the LGPL.
<FromGitter> <krypton97> wth man, qt is not free if you wanna make money with it
<FromGitter> <krypton97> If so, why would they sell license keys??
<Papierkorb> bararchy, Qt is dual-licensed: 1) LGPL 2) Commercial license. You can choose freely among these. You can absolutely create a closed source product (and also sell it). The kicker is this: The LGPL requires you that the end-user can change the LGPL'libraries
<Papierkorb> LGPL'd library in use, e.g., to a patched one, of their choosing
<Papierkorb> This means in practice that you bind dynamically to Qt, and then distribute the dynamic libraries with your product.
<Papierkorb> You must not however statically bind to Qt and then ship it closed-source: If you want to do this, you have to acquire a commercial license, which does allow this
<FromGitter> <krypton97> Knew about dinamically linking, either way I'm not that much into it
<FromGitter> <bararchy> Oh, so it's only the QT libs I need to keep dynamic linked, not that bad, it's pretty standrd too, why would I want to static compile against QT
<FromGitter> <krypton97> Don't mind if I seemed to be a little rude..
<Papierkorb> bararchy, yeah that's what we said in #Qt too: "Why would you?". There are reasons, and some developers simply prefer a (in their view) "proper" commercial license. Which is perfectly fine, I don't want to argue against it. Though for most developers, the LGPL won't be much of an issue at all.
<Papierkorb> Even if you do decide on a commercial license (Which has other benefits over the effective linking restriction!), it's not that expensive anymore like it used to.
<Papierkorb> Regarding Qt, there are actually quite some pitfalls of doing so: At least on Windows, a EXE can't export symbols (like ELF can on linux). Hence, if you link statically, you won't be able to load Qt plugins (for loading pictures, ..) dynamically anymore. Only static plugins. Which is why many manufacturers choose a commercial license, but link dynamically either way. A strong plus for going this route is that you're allowed to change Qt
<Papierkorb> sources, without having to share them (Like you would have to under the LGPL)
<Groogy> Yeah I mean I use Qt at work
<Papierkorb> So, in short, the LGPL is fine and neither Qt itself, nor qt5.cr's license, itself keep you from selling your closed-source products.
<Groogy> not the libs though, just the maker
<Papierkorb> QtCreator is fantastic <3
<Groogy> ages ago it got looked into but our legal team said "This is fine"
<Groogy> and I mean we have licences for Sublime
<Groogy> not because need to but because it's nice to have
mark_66 has quit [Remote host closed the connection]
<Papierkorb> bararchy, What project did you have in mind? Or just toying with it?
<Papierkorb> I ran a crude search yesterday, and it appears that currently, about 13% of all classes from Core, Gui and Widgets modules are wrapped. Many types don't require any special handling at all, adding the class and its enums usually makes them work
maxpert has joined #crystal-lang
<FromGitter> <bararchy> Papierkorb I guess I'll try to add a GUI to my ssl-scanner https://github.com/bararchy/sslscanner/ ⏎ Then if that goes smothly I'll try to bind something to one of my closed-source ideas
<FromGitter> <bararchy> I'll give you credit in both cases :)
<FromGitter> <jwaldrip> Been 4 days since the last comment on my PR, is this gtg? https://github.com/crystal-lang/crystal/pull/4838
<FromGitter> <bararchy> I guess just ping everyone and ask if it's ok to be merged
<FromGitter> <bararchy> everyone who has reviewed it
maxpert has quit [Ping timeout: 248 seconds]
<FromGitter> <luislavena> @jwaldrip you most likely are going to be asked to squash your commits into atomic ones, so they have a clean history.
<FromGitter> <sdogruyol> hey @luislavena long time no see, how are you :)
<FromGitter> <jwaldrip> That can be done on github as part of the merge can it not?
<FromGitter> <luislavena> @sdogruyol been busy :D
<FromGitter> <luislavena> @jwaldrip GitHub squash is not as good as human-made squash, it also helps cleanup the commits messages
<FromGitter> <jwaldrip> Okay, will do now.
<FromGitter> <jwaldrip> squashed
Disrecollection has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 276 seconds]
<jokke> hey
<FromGitter> <sdogruyol> hey
<FromGitter> <jwaldrip> hey
<FromGitter> <johnjansen> hey
maxpert has joined #crystal-lang
<jokke> what's the syntax for creating procs from methods again? i tried ->my_method but it gives me an error "error instantiating ->my_method"
<jokke> i'm writing a FSM
<FromGitter> <johnjansen> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59a44a00bc46472974cf8976]
<jokke> ahh
<jokke> thx
<jokke> fb
<jokke> hm now i get: https://p.jreinert.com/UpTX/
<jokke> ccccccgbceglnuibtrvdvbhrutbtunnrhtveliebljkc
<jokke> whops
maxpert has quit [Ping timeout: 248 seconds]
<FromGitter> <johnjansen> looks rather recursive
<FromGitter> <luislavena> @jokke, please share the source code that triggered that for us to be able to help.
<FromGitter> <johnjansen> :-)
tdc_ has joined #crystal-lang
tdc has quit [Ping timeout: 248 seconds]
<FromGitter> <mgarciaisaia> @jokke sounds like https://github.com/antirez/redis/issues/3909
<FromGitter> <sdogruyol> haha lol
<jokke> i also tried setting alias Transition = Tuple(String, Proc(String, Transition))?
<jokke> shouldn't this work? https://p.jreinert.com/TIW/crystal
<FromGitter> <mverzilli> I'm not 100% sure of this, but the fact that Tuples are structs, and structs are stored in the stack, would make it impossible to create recursive tuples
<jokke> oh i see
<jokke> good point!
<jokke> hm no that didn't help either
<watzon> Wondering why `String.bytes` returns an `Array(UInt8)` when `Bytes` is an alias for `Slice(UInt8)`
<FromGitter> <johnjansen> @watzon you are not the first to wonder … if only i could recall the answer
<watzon> It just seems very inconsistent to me
<FromGitter> <johnjansen> yeah, there was a logical answer though from memory
<watzon> So what's the best way to turn a String into a Slice of Bytes rather than an Array?
<FromGitter> <johnjansen> ummm string.to_slice?
<jokke> :(
Ven has joined #crystal-lang
Ven is now known as Guest73037
<FromGitter> <johnjansen> @jokke the error is compile time right?
<FromGitter> <johnjansen> on line 17?
<jokke> yes
<FromGitter> <johnjansen> so Transition recursively refers to Transition, forever
<jokke> no line 22
<FromGitter> <johnjansen> yeah probably because the alias isnt resolved until the compiler sees it used (guess)
<jokke> according to the docs that shouldn't be a problem
<FromGitter> <johnjansen> i cant see how 17 could happen … but im no compiler expert
<jokke> alias RecArray = Array(Int32) | Array(RecArray)
<jokke> or json
<FromGitter> <johnjansen> hmmm … ok well that mystifies me … but so many things in life do
<jokke> also the error message is totally not helpful...
<jokke> sdogruyol, any ideas?
<FromGitter> <sdogruyol> it's hard to read your pastebins :/
<FromGitter> <johnjansen> oh thats a different error
<FromGitter> <sdogruyol> with no highlighting
<jokke> it is?
<jokke> there is highlighting
<jokke> the last one is just an error
<Papierkorb> Nope, that's a bare text file
<jokke> yeah
<jokke> because it's from the console
<jokke> just the error message
<jokke> oh
<jokke> ok the color stuff
<FromGitter> <johnjansen> here you go https://carc.in/#/r/2lx4
<jokke> hm?
<jokke> don't see the problem
<FromGitter> <johnjansen> you need to call the code to see the problem … edit that and send us the link
Disrecollection has quit [Quit: Leaving.]
<FromGitter> <johnjansen> id try writing this longhand without the macro (or alias) for now and figure out what will work … then come back to this
<FromGitter> <johnjansen> @jokke
<Yxhuvud> mverzili: recursive structs is not allowed, I've tried to make that before. You'd have to resort to pointers to simulate that
<Yxhuvud> jokke: it is easier to find the issue if you a: paste the error too and b: try to reduce the code to a minimal example.
<FromGitter> <johnjansen> ive got this far on the reduction … but unfortunately i have my own work to do, sorry @jokke https://carc.in/#/r/2ly0/edit
<Yxhuvud> you have an infinite macro expansion, of course it doesn't work.
<Yxhuvud> as in you have a macro that expands to itself.
<Yxhuvud> the error even tells you which the first macro in the cycle is
<FromGitter> <johnjansen> that was what i thought … wouldnt want to claim to know anything about what magic a compiler will handle though ;-)
<Yxhuvud> find_button -> click -> ask -> ask_time -> find_button
baweaver is now known as baweaver_away
baweaver_away is now known as baweaver
<Yxhuvud> Hmm. no, I'm stupid. never mind.
baweaver is now known as baweaver_away
<FromGitter> <johnjansen> im not even sure how you could instantiate a β€œTransition” in the first place … given you cant supply a transition as a param
baweaver_away is now known as baweaver
baweaver is now known as baweaver_away
<Yxhuvud> heh, the problem is pretty silly. find_button takes one argument, but the macro expands to a proc-ified version of it taking two.
<Yxhuvud> error message could have been more clear
Guest73037 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Disrecollection1 has joined #crystal-lang
Disrecollection1 has quit [Client Quit]
<FromGitter> <bitmappergit> so what does # mean in some crystal/ruby library documentation
<FromGitter> <bararchy> @bitmappergit you mean `String#size` for example ?
<FromGitter> <bararchy> or just `#` as in comments ?
<FromGitter> <bitmappergit> as in String#size
<FromGitter> <bararchy> It's a method of initialize object
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59a46fe78f4427b462aab019]
<FromGitter> <bararchy> For class methods\modules you will use the regular point
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59a4702dba0f0f6e38f168ae]
franzejr has joined #crystal-lang
tdc_ has quit [Ping timeout: 240 seconds]
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 276 seconds]
baweaver_away is now known as baweaver
<oprypin> sigh
<Papierkorb> > Web centric
<FromGitter> <krypton97> Has anyone played with this https://github.com/jwaldrip/graphql.cr
<FromGitter> <krypton97> I think I saw the author on gitter few days ago
franzejr has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 255 seconds]
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 248 seconds]
<FromGitter> <matrixbot> `@Renich:matrix.org` o/
<oprypin> no, just no.
<FromGitter> <jwaldrip> hey @krypton97, that was a work in progress some time ago.
<FromGitter> <jwaldrip> Had a kid, and things halted for a bit. Should be picking up development again soon. Its a direct port of the fb/graphql js parser.
<FromGitter> <jwaldrip> and all in crystal, no C binding.
<FromGitter> <krypton97> No worries man, having kids is one of the best things. I was also thinking to port a go version
<FromGitter> <krypton97> But for now I'm reading through the source codes of the crystal implementations
<FromGitter> <jwaldrip> Don't be too critital, as I said, still much of a work in progress
<FromGitter> <bew> hey guys, any way to make sth like this to work? https://carc.in/#/r/2m16 or is it too demanding to the *broken* generic type inference?
<Papierkorb> A *T is already a tuple-type
<FromGitter> <bew> uh thank you!
<FromGitter> <bew> Papierkorb, I've been looking at your cannon RPC (as I'm on the way to make a msgpack RPC lib too), I think you have some type annotations you can remove here and there
hightower2 has joined #crystal-lang
<Papierkorb> bew, do they disallow something that would make sense otherwise? I often use explicit typing for clarity to the reader, and to the compiler (for it to generate better errors)
<FromGitter> <bew> no it's perfectly fine, just some 'obvious' ones, like `@owned : Bool = false` for example
<FromGitter> <bitmappergit> in crystal does it matter if i have a single string on multiple lines?
<Papierkorb> bew, well ok *that* is a bit redundant I guess.
<Papierkorb> bew, truth be told, you should consider if you actually want to implement such a heavy-weight RPC library, or if a simpler design suffices
<FromGitter> <bew> I do, because I have no choice in this case, this is how nvim does communication between in its plugin system, and I reaaally want to write nvim plugins in crystal :p
<Papierkorb> The Cannon RPC stuff is explicitly for "dude I got other things to do, make it work now". Pretty much the human-pendant to Cannons slogan itself ("The computer has other things to do than serialisation"). This makes it quite powerful, and also makes it offer some unique features (Which I only offer 'cause Cannon RPC is for organisation-internal use ONLY) like remote object ownership. But it also makes it quite complex
<FromGitter> <elorest> Nice. should I stick with nvim. A couple issue are really making me want to switch back?
<FromGitter> <bew> Papierkorb, I understand that, and you did a great job at simplifying the process of rpc for flexibiliy & speed!
<FromGitter> <elorest> Relative line numbers are super laggy. There’s no :X encryption option and it doesn’t reload file changes for open files.
<FromGitter> <bew> @elorest what kind of issues do you have?
<FromGitter> <elorest> @bew ^
<Papierkorb> bew, just wanted to mention that lul. If its architecture helps you decide for msgpack, then that's awesome :)
<FromGitter> <bew> @elorest I use relative numbers all the time, I've no issue with it personally.. about the 2 others, I don't use them so I can't say
<FromGitter> <elorest> @bew Weird. For me when I let up `j` it just keeps scrolling for like 2 seconds until it catches up. Same files and plugins from vim.
<FromGitter> <bew> Papierkorb actually it helped when I was banging my head to find proper names for things ^^, and also on how you wrote your description (I was going directly with macro & stuff when cannon uses simple crystal module and abstract def, pretty simple, it perfect πŸ‘ )
<FromGitter> <bew> @elorest you mean.. when you keep `j` pressed for a few sec, then release it? 😨
<FromGitter> <elorest> yeah like if I scroll down 5 lines it keeps going like 6 more.
<FromGitter> <bew> weird, I just tried in big file, when I release it stops instantly..
<FromGitter> <elorest> Are you using vim-crystal?
<FromGitter> <bew> yes
<FromGitter> <bew> tried in string.cr (in the compiler, 4000~ lines)
<FromGitter> <elorest> Hmmm. I’m guessing I must have a plugin that works fine in normal vim but makes certain aspects of nvim slow.
<FromGitter> <elorest> Thanks.
<FromGitter> <bew> maybe you have some mapping on `j` ? try `:nmap j`
<FromGitter> <bew> to see if there's a mapping
<FromGitter> <bew> (normal)
<FromGitter> <bew> otherwise it could be a good exercise to not press j/k multiple times, and use `4j` to move 4 lines below :p
<FromGitter> <elorest> yeah I do that usually do that. Although in the case of just 2 or 5 lines I usually just hold j/k since it’s less movement.
<FromGitter> <elorest> Might have to re-adjust if I can’t fix this.
<FromGitter> <elorest> `no mapping found`
<FromGitter> <bew> in any case, it doesn't seems to be a nvim issue, you should try with empty config, to see if it because of one of your plugin
Disrecollection has joined #crystal-lang
sz0 has joined #crystal-lang
<FromGitter> <bew> @elorest it could be because of a plugin that triggers on CursorMoved hook, e.g a linter, or autocompletion engine (you should use asynchronous linter/completer in nvim like neomake/deoplete, to avoid blocking the UI)
franzejr has joined #crystal-lang