ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
alexherbo231 has quit [Remote host closed the connection]
<FromGitter> <randiaz95> Sup gang!
<FromGitter> <randiaz95> Any one down to write a stripe api for Crystal?
<FromGitter> <Blacksmoke16> o/
<FromGitter> <randiaz95> lol
<FromGitter> <randiaz95> Also, wondering if there was a gem/pip package manager equivalent in the works for Crystal?
<FromGitter> <randiaz95> great! I thought it was a dependency manager
<FromGitter> <randiaz95> got confused,
<FromGitter> <randiaz95> gonna google a library repo for shards
<FromGitter> <Blacksmoke16> `crystal init lib my_app`
<FromGitter> <Blacksmoke16> and sorry, yes its just a dep manager
<FromGitter> <randiaz95> https://crystalshards.xyz/
<FromGitter> <Blacksmoke16> package manager meaning what?
<FromGitter> <randiaz95> I am a little confused as to the definition, and how it differs from package managers
<FromGitter> <Blacksmoke16> shards handles installing other crystal libraries into your project
<FromGitter> <randiaz95> well, I guess that would be what I am looking for lol
<FromGitter> <randiaz95> Blacksmoke, thanks for the help!
<FromGitter> <randiaz95> I am gonna come back after making myself a rum n coke
<FromGitter> <randiaz95> then I will be ready to learn to make a shard
<FromGitter> <randiaz95> Hey Blacksmoke, I initialized a new package, should all my code be in separate files and imported into the module?
<FromGitter> <Blacksmoke16> its common to have `src/my_app.cr` just require all the other code located in `src/my_app/`
<FromGitter> <Blacksmoke16> as `my_app.cr` is what would get required when someone does `require "my_app"`
<FromGitter> <Blacksmoke16> after installing it
<FromGitter> <Blacksmoke16> i use a more hybrid approach where the root file `src/my_app.cr` includres required files, but also defines stuff common to that module (like the docs on the module itself etc)
<FromGitter> <Blacksmoke16> depends on if your project will have one requireable thing or more than one
<FromGitter> <Blacksmoke16> https://crystal-lang.org/reference/conventions/coding_style.html#directory-and-file-names not really strict, id just go with whatever makes the most sense for your project/stye
<FromGitter> <randiaz95> That makes sense.
<FromGitter> <randiaz95> im finding the documentation a little insequential
<FromGitter> <randiaz95> im jumping back and forth alot lol.
<FromGitter> <Blacksmoke16> yea theres not really a "guided tutorial" per say anywhere atm
<FromGitter> <randiaz95> would love to learn about alias and property, I am looking at a shard called stats and
<FromGitter> <randiaz95> it's a lot of those in main my_app.cr
<FromGitter> <randiaz95> Im guessing the constructor for the shard
<FromGitter> <Blacksmoke16> `property` is just a macro that defines a getter and setter for that ivar
<FromGitter> <Blacksmoke16> similar to ruby's like `attr_accessor`
<FromGitter> <Blacksmoke16> just named better :p
<FromGitter> <randiaz95> ah brilliant
<FromGitter> <randiaz95> I love that :D
<FromGitter> <randiaz95> attr_accessor was a little cryptic, but in the context of ruby it looked super cryptic
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/Object.html#property(*names,&block)-macro
<FromGitter> <randiaz95> dude thanks for the major support, i have only worked professionally with python and SQL and my learning curve is big
<FromGitter> <Blacksmoke16> np
<FromGitter> <randiaz95> What are you currently working on blacksmoke?
<FromGitter> <Blacksmoke16> rewriting my web framework, decided on some design changes that'll make it better/more flexible/easier to maintain than before
<FromGitter> <randiaz95> oo super cool, is it a microframework or more like django sinatra
<FromGitter> <Blacksmoke16> its more so inspired by symfony, current plan is to KISS and focus on JSON REST APIs
<FromGitter> <randiaz95> im ignorant of php frameworks :/
<FromGitter> <Blacksmoke16> crystal has quite a few web frameworks, so mainly just going for a niche versus a full feature framework like lucky
<FromGitter> <randiaz95> ah
<FromGitter> <Blacksmoke16> plus afaik im the only one that has an annotation based framework, so that makes it a bit neat too i suppose
<FromGitter> <randiaz95> Sorry im ignorant of annotation based
<FromGitter> <Blacksmoke16> familiar with rails?
<FromGitter> <randiaz95> no, only sinatra in ruby,
<FromGitter> <randiaz95> do you mean like cli commands?
<FromGitter> <Blacksmoke16> in that case, in sinatra routes are defined by doing like
<FromGitter> <Blacksmoke16> ```get '/' do ⏎ 'Hello world!' ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5df454ec0616d6515e36288f]
<FromGitter> <randiaz95> right
<FromGitter> <randiaz95> its a dsl
<FromGitter> <Blacksmoke16> in rails they're defined in a file like `get '/patients/:id', to: 'patients#show'`
<FromGitter> <Blacksmoke16> that ties a route to a specific method in a controller class
<FromGitter> <randiaz95> ah like urls in django
<FromGitter> <randiaz95> django has a urls file that is separate from the business logic
<FromGitter> <Blacksmoke16> where in my thing stuff is defined like
<FromGitter> <randiaz95> of each route's function/class
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df4556055d939230008f121]
<FromGitter> <randiaz95> interesting...
<FromGitter> <randiaz95> is < ART::Controller a mixin or inheritance?
<FromGitter> <Blacksmoke16> inheritance
<FromGitter> <Blacksmoke16> can define methods on there that all controllers should have, like helper methods for doing redirects etc
<FromGitter> <randiaz95> would be interesting if you can get the initializer of the child class to set the port
<FromGitter> <randiaz95> right
<FromGitter> <Blacksmoke16> port gets set when you start the server
<FromGitter> <Blacksmoke16> like `ART.run(port: 1234)`
<FromGitter> <Blacksmoke16> ideally you'd have like nginx in front of it
<FromGitter> <randiaz95> how does ART.run get the child class' functions? MyController.run(port: 1234) seems like what I wouldve tried.
<FromGitter> <randiaz95> yeah nginx serves port 80
<FromGitter> <randiaz95> and your servers are listening to other ports
<FromGitter> <randiaz95> do crystal http servers run on systemd services?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df4566355d939230008f7b0]
<FromGitter> <Blacksmoke16> is what it is atm (WIP)
<FromGitter> <randiaz95> interesting, wifi port as default?
<FromGitter> <Blacksmoke16> some compile time magic happens that "registers" each controller/route at compile time
<FromGitter> <randiaz95> hm
<FromGitter> <Blacksmoke16> wip :P is what my finger was on at the time
<FromGitter> <randiaz95> so {% %} is metaprogramming stuff right?
<FromGitter> <randiaz95> sry not there yet lol
<FromGitter> <Blacksmoke16> yea it has its own learning curve ha
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/athena/blob/rewrite/src/routing/route_resolver.cr is where the route registration lives
<FromGitter> <randiaz95> It's wierd, this language seems fully functional. but people call it not production ready
<FromGitter> <Blacksmoke16> looks a lot more complicated then it is, essentially just iterate over each child controller type, new it up, iterate over routes, using other annotations for like query params and stuff, then finally add a wrapper type to the router tree
<FromGitter> <Blacksmoke16> mainly due to the breaking changes ^, API isn't stable yet
<FromGitter> <Blacksmoke16> so each release has some
<FromGitter> <randiaz95> ah
<FromGitter> <randiaz95> interesting
<FromGitter> <randiaz95> [] of Controller ;)
<FromGitter> <randiaz95> I love what I see man, I might invest 100 bucks this christmas
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ granted its not really doing and prob is a contrived example but ill take it ;P [https://gitter.im/crystal-lang/crystal?at=5df45a9555d9392300091379]
<FromGitter> <Blacksmoke16> doing anything*
<FromGitter> <watzon> What am I looking at @Blacksmoke16?
<FromGitter> <Blacksmoke16> quick benchmark i did of my athena rewrite on an endpoint that just returns `"Hello world"`
<FromGitter> <watzon> Ahh nice
<FromGitter> <Blacksmoke16> should also note is MT mode with 6 workers
<FromGitter> <Blacksmoke16> single thread is like 80k iirc
<FromGitter> <Blacksmoke16> 83k/sec*
<FromGitter> <watzon> That's really not bad, even single threaded
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <Blacksmoke16> 95% of the credit goes to crystal stdlib ha
<FromGitter> <randiaz95> lol
<FromGitter> <randiaz95> me here, trying to run the simple http/server without an error
<FromGitter> <randiaz95> Crystal 0.32.0 (2019-12-12) gives me libssl missing error
<FromGitter> <randiaz95> `library not found for -lssl (this usually means you need to install the development package for libssl`
<FromGitter> <Blacksmoke16> are you on new mac os version?
<FromGitter> <randiaz95> probably.
<FromGitter> <randiaz95> Mojave
<FromGitter> <randiaz95> I've skipped tons of updates though
<FromGitter> <randiaz95> should I update clang or llvm?
<FromGitter> <watzon> This might be relevant https://github.com/crystal-lang/crystal/issues/6875
<FromGitter> <Blacksmoke16> :p
<FromGitter> <randiaz95> 1) o lol
<FromGitter> <randiaz95> so much for not booting up my ubuntu vm
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/8548 issue is being tracked here
<FromGitter> <randiaz95> ahh.. such a relief too, after reinstalling crystal I restarted vscode and my text editor finally colored the syntax of crystal lol
<FromGitter> <randiaz95> colored syntax => professional programmer lol
<FromGitter> <Blacksmoke16> nice one
<FromGitter> <randiaz95> library not found for -lssl Wahtadafagg
<FromGitter> <randiaz95> :( i have openssl installed and in environment
<FromGitter> <Blacksmoke16> did you try and uninstall and reinstall crystal?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df46603e7265623013ef90e]
<FromGitter> <randiaz95> ima re uninstall
<FromGitter> <randiaz95> but yeah
<FromGitter> <randiaz95> my path is diff
<FromGitter> <randiaz95> i had /usr/local/Cellar***
<FromGitter> <randiaz95> brew is Cellar nowadays
<FromGitter> <Blacksmoke16> id try that one as well if it still doesnt work tho
<FromGitter> <randiaz95> neither
<FromGitter> <randiaz95> and both dirs exist
<FromGitter> <randiaz95> uninstalled and reinstalled
<FromGitter> <randiaz95> on both paths
<FromGitter> <Blacksmoke16> uninstalled and reinstalled crystal itself?
<FromGitter> <randiaz95> yeah
<FromGitter> <randiaz95> wierd
<FromGitter> <randiaz95> when printing out the env variable
<FromGitter> <randiaz95> it states: No such file or directory
<FromGitter> <Blacksmoke16> dunno
<FromGitter> <randiaz95> ugh..
<FromGitter> <randiaz95> dude... I wasnt using the unix command export..
<FromGitter> <Blacksmoke16> rip
<FromGitter> <randiaz95> lol.. I had python, flutter, golang paths all with export in my bash_profile
<FromGitter> <randiaz95> that will do it..
<FromGitter> <randiaz95> its so wierd, I thought it was ok because I was echoing the var from cli
<FromGitter> <randiaz95> and it was showing the correct path...
<FromGitter> <randiaz95> lol
<FromGitter> <randiaz95> Blacksmoke, did you study cs?
<FromGitter> <randiaz95> I studied Economics
<FromGitter> <Blacksmoke16> yes
<FromGitter> <randiaz95> I <3 CS
<FromGitter> <randiaz95> Wow, this new movie on netflix 6 underground is good
<FromGitter> <randiaz95> yo blacksmoke u there?
<FromGitter> <randiaz95> `require "http/server" ⏎ ⏎ class Raynode ⏎ def initialize(routes, port) ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5df4711d2cc1b31e34166161]
<FromGitter> <randiaz95> would love to learn how cors works
<FromGitter> <randiaz95> https://github.com/randiaz95/raynode
<FromGitter> <randiaz95> first shard ever...
<Yxhuvud> I wonder what the undefined reference to `__muloti4' errors I got when using i128 in todays advent of code is.
<FromGitter> <watzon> Yxhuvud: In crystal?
ht_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 252 seconds]
<Yxhuvud> yes. probably some issue with Int128. I'll see if I can reduce it.
<Yxhuvud> Uh. That reduced a bit more than I expected. `1i128 * 1i128` fails to compile for me. o_O
<Yxhuvud> Seems wontruefree have an WIP branch for it.
<FromGitter> <Blacksmoke16> @randiaz95 I am now
woodruffw has quit [Ping timeout: 268 seconds]
woodruffw has joined #crystal-lang
woodruffw has quit [Ping timeout: 265 seconds]
woodruffw has joined #crystal-lang
<FromGitter> <Blacksmoke16> ogh, found some obscure compiler bug i cant seem to figure out :/
<FromGitter> <tenebrousedge> poke it with a stick
<FromGitter> <Blacksmoke16> `Error: can't infer the type of instance variable '@type' of Athena::Routing::Parameters::RequestParameter(HTTP::Request)`
<FromGitter> <Blacksmoke16> `getter type : T.class`
<FromGitter> <Blacksmoke16> its a generic and i can see the type right there...
<FromGitter> <tenebrousedge> can you use generics like that?
<FromGitter> <Blacksmoke16> i mean everything works fine, only seems to happen in my spec
<FromGitter> <tenebrousedge> hmmmm
<FromGitter> <tenebrousedge> does it bug if you write out the getter method explicitly (and add the return type) ?
<FromGitter> <Blacksmoke16> no, but then errors on another ivar :S
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df4fa532bca3016aa7bccf0]
<FromGitter> <Blacksmoke16> on `@default`
<FromGitter> <tenebrousedge> does the type binding happen before or after macro expansion?
<FromGitter> <Blacksmoke16> im not sure, but im not even using macros
<FromGitter> <tenebrousedge> `getter` is a macro
<FromGitter> <Blacksmoke16> let me try manually defining it
<FromGitter> <Blacksmoke16> nope
<FromGitter> <tenebrousedge> `: T.class = T` looks weird to me
<FromGitter> <tenebrousedge> what is this doing?
<FromGitter> <Blacksmoke16> it stores the type
<FromGitter> <Blacksmoke16> need to do `T.class` so its not restricted to an instance of `T`
<FromGitter> <Blacksmoke16> i.e. in this case it stores `HTTP::Request` not an instance of `HTTP::Request`
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> ill start commenting stuff out and see if i can make it happen in the playground
<FromGitter> <Blacksmoke16> im super confused
<FromGitter> <Blacksmoke16> apparently changing the order of my `it` blocks makes it not happen anymore
<FromGitter> <Blacksmoke16> now we're getting somewhere
* FromGitter * tenebrousedge eyes the tests suspiciously
<FromGitter> <bajro17> @watzon I cant wait brother :) I wish you all luck of this world
<FromGitter> <Blacksmoke16> @tenebrousedge https://play.crystal-lang.org/#/r/8770
<FromGitter> <Blacksmoke16> works fine if you move the non empty array above the empty array
<FromGitter> <tenebrousedge> so weird. Probably worth filing a bug
<FromGitter> <Blacksmoke16> also able to reproduce https://github.com/crystal-lang/crystal/issues/6996 :/
<FromGitter> <Blacksmoke16> most annoying thing is not being able to have an array of types with a generic without having the parent type that does nothing
<FromGitter> <Blacksmoke16> first spec i ever wrote that uses `.should be`
<FromGitter> <Blacksmoke16> ogh, it came up again :/
<FromGitter> <Blacksmoke16> found a workaround \o/
<FromGitter> <christopherzimmerman> I have had an issue with certain tests causing compiler bugs only some of the time. For me, it was changing the order in which I allocated memory in a test.
<FromGitter> <christopherzimmerman> But I could only reproduce them like ~25% of the time.
<FromGitter> <Blacksmoke16> maybe find a seed that causes it?
<FromGitter> <Blacksmoke16> now that you can randomize specs
<FromGitter> <Blacksmoke16> `BUG: trying to downcast Athena::Routing::Parameters::Parameter(String) <- Athena::Routing::Parameters::PathParameter(String) (Exception) ⏎ `
<FromGitter> <Blacksmoke16> 😐
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <Blacksmoke16> at this point i might just say screw unit tests
<FromGitter> <Blacksmoke16> and test everything via e2e
<FromGitter> <tenebrousedge> D:
<FromGitter> <Blacksmoke16> lol ikr? when i fix one compiler bug i get another :S
<FromGitter> <Blacksmoke16> *doom*
<FromGitter> <tenebrousedge> gotta catch 'em all! Bugemon!
<FromGitter> <Blacksmoke16> now if only i knew the compiler enough to fix them, id be golden ha
sagax has quit [Quit: Konversation terminated!]
_whitelogger has joined #crystal-lang
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df5438ee72656230144bb0c]
<FromGitter> <Blacksmoke16> much easier and no compile errors :p
<FromGitter> <Blacksmoke16> ideally these would be unit tests but meh
sagax has joined #crystal-lang
<FromGitter> <didactic-drunk> @christopherzimmerman I have the opposite with compiler bugs. They don't trigger in shard specs, but do when I integrate the shards in a larger program.
<FromGitter> <Blacksmoke16> what syntax is better? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df5579c2bca3016aa7e3f25]
<FromGitter> <Blacksmoke16> tl;dr use named or positional arguments for the main argument to the annotation?
<FromGitter> <Blacksmoke16> or option 3, support both
ht_ has quit [Remote host closed the connection]
<FromGitter> <watzon> Why not both?
<FromGitter> <watzon> I like option 3
<FromGitter> <Blacksmoke16> i think i do as well
<raz> i tend to prefer named args for everything, they just help readability so much
<raz> just my 2cents tho
<FromGitter> <Blacksmoke16> guess thats a benefit of option 3, can do it either way