ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
<FromGitter> <alexherbo2> how to `setsid` on macOS?
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
<FromGitter> <alexherbo2> I ended up with a C binding
andremedeiros has joined #crystal-lang
<FromGitter> <alexherbo2> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=605e836f3b9278255bd753b7]
<FromGitter> <alexherbo2> it is the correct way to do?
<FromGitter> <alexherbo2> (is there a difference here between `run` and `new`, as we detach anyway?)
<FromGitter> <grkek> Aren't there any documentation information about what run and new do in the Crystal API?
<FromGitter> <Daniel-Worrall> Crystal -h
<FromGitter> <Daniel-Worrall> Oh not cli
<FromGitter> <Daniel-Worrall> Derp
<FromGitter> <grkek> @Daniel-Worrall How have you been?
<FromGitter> <alexherbo2> @grkek new doesn't wait, while run waits
<FromGitter> <grkek> Thats nice, haven't done any process running with crystal so far
<FromGitter> <grkek> @Blacksmoke16 How is athena going so far?
<FromGitter> <Blacksmoke16> getting there, thanks for asking. Currently working on the enhanced view layer stuff that's taking wayy longer than i expected :p
<FromGitter> <grkek> I saw the new documentation, looks pretty slick :) I love the hard work you are putting into making it all work together!
<FromGitter> <grkek> Yeah the view layer takes a long time
<FromGitter> <Blacksmoke16> posted an example here a little while ago, sec
<FromGitter> <Blacksmoke16> similar to `respond_with` in other framework, but keeps your controller clean, deferring rendering to another place
<FromGitter> <Daniel-Worrall> Same old. Chillin
<FromGitter> <grkek> That looks pretty cool but wrap that in a macro to make it a little less cluttery?
<FromGitter> <Blacksmoke16> make what less cluttered?
<FromGitter> <Blacksmoke16> to be fair the thing above/below the controller are things you just have to define once, so its not like you need to write them multiple times or something
alexherbo2 has quit [Ping timeout: 240 seconds]
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
<FromGitter> <grkek> Ah
<FromGitter> <grkek> then its all gucci
andremedeiros has joined #crystal-lang
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <didactic-drunk> If I have `crystal: ">= 0.36.0"` in shards.yaml, why do I get ``` ⏎ Unable to satisfy the following requirements: ⏎ ⏎ 1) `crystal (>= 0.36.0)` required by ...` when trying to use the shard on crystal 1.0.0? [https://gitter.im/crystal-lang/crystal?at=605e963a3a9448256c31b84b]
<FromGitter> <Blacksmoke16> Do the shards you want to use also have that?
<FromGitter> <didactic-drunk> The application shard.yaml has no crystal version specified. shard.yaml ``` ⏎ dependencies: ⏎ blake3: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=605e970133346c16277c14f3]
<FromGitter> <Blacksmoke16> Can you share your shard.yml?
<FromGitter> <Blacksmoke16> nvm
<FromGitter> <Blacksmoke16> and whats the error exactly?
<FromGitter> <didactic-drunk> That's incomplete.
<FromGitter> <Blacksmoke16> ah, the error message should tell you which one(s) is/are wrong
<FromGitter> <didactic-drunk> I removed all the other shards and it worked. Why then does it mention the shard without dependency problems?
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
astronavt has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
<FromGitter> <didactic-drunk> That's super confusing
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
f1reflyylmao is now known as f1refly
chachasmooth has quit [Ping timeout: 258 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <zomatree0:matrix.org> trying to make a simple event emmiter but having issues with blocks and procs ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=605eaeddf07ffa1eb56ae43d]
chachasmooth has quit [Ping timeout: 245 seconds]
andremedeiros has quit [Quit: ZNC 1.8.2 - https://znc.in]
chachasmooth has joined #crystal-lang
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
<FromGitter> <grkek> @zomatree0:matrix.org
<FromGitter> <grkek> Wait I am investigating right now
<FromGitter> <grkek> and if I get it to work Ill write it here
vasanth has quit [Ping timeout: 240 seconds]
<FromGitter> <grkek> Maybe try something like this? so you can basically have a 2 hooks to use when defining the event?
<FromGitter> <naqvis> @zomatree0:matrix.org change call to `register` function as below for it to work. ⏎ ⏎ ```emmiter.register("my_event") {puts 1}``` [https://gitter.im/crystal-lang/crystal?at=605ec391f07ffa1eb56b1038]
<FromGitter> <grkek> God damn it :D I am not that good with procs am I
vasanth has joined #crystal-lang
<FromGitter> <naqvis> also its better to annotate the type of block in your init method, to avoid call site sending blocks with different return type ⏎ ⏎ ```def register(name : String, &b : -> Nil)``` [https://gitter.im/crystal-lang/crystal?at=605ec4663a9448256c321add]
vasanth has quit [Ping timeout: 246 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 260 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 265 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 265 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 252 seconds]
hendursaga has joined #crystal-lang
hendursa1 has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
_ht has joined #crystal-lang
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 252 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
jhass has quit [Quit: Bye]
straight-shoota has quit [Quit: ZNC 1.8.2 - https://znc.in]
asterite has quit [Quit: Bye]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 260 seconds]
DeBot has joined #crystal-lang
vasanth has joined #crystal-lang
asterite has joined #crystal-lang
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
vasanth has quit [Ping timeout: 246 seconds]
alexherbo27 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo27 is now known as alexherbo2
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 265 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
vasanth has joined #crystal-lang
vasanth has quit [Ping timeout: 240 seconds]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <Blacksmoke16> @zomatree0:matrix.org shameless plug https://athenaframework.org/EventDispatcher/ :P
<FromGitter> <xandy:icbm.codes> i''m trying to add a type restriction to a block parameter. but i want my restriction to be a union type. but i get the errorr "expected block type to be a function type, not (Proc(HTTP::Request, HTTP::Server::Response, Nil) | Proc(HTTP::Server::Context, Nil))"
<FromGitter> <xandy:icbm.codes> is this intended and how would i work around this? overloading the function with all union variants?
<FromGitter> <Blacksmoke16> Got some example code?
<FromGitter> <Blacksmoke16> im not so sure you can do that
<FromGitter> <xandy:icbm.codes> i tried with overloading but no luck either https://play.crystal-lang.org/#/r/anip
<FromGitter> <xandy:icbm.codes> am i asking too much of the type system?
<FromGitter> <Blacksmoke16> probably, idk it's able to know what overload to pick based on blocks like that
<FromGitter> <Blacksmoke16> i dont think*
<FromGitter> <xandy:icbm.codes> i understand that it might not know the blocks param types but at least the arity?
<FromGitter> <xandy:icbm.codes> as CbT1 and CbT2 take a different amount of parameters
<FromGitter> <Blacksmoke16> :shrug: might be an issue for it already?
<FromGitter> <Blacksmoke16> id just always accept the context
Nekka has quit [Ping timeout: 240 seconds]
Nekka has joined #crystal-lang
<FromGitter> <nickbclifford> What's the best way to deal with external C functions blocking on IO? My `Signal::INT.trap` handler is never running because I guess from what I can tell, Crystal is never able to switch to that fiber, but I would like to add some exit cleanup logic. My code essentially boils down to `loop { LibCLibrary.blocks_and_does_stuff }`
<FromGitter> <nickbclifford> I'm thinking maybe something with `IO::FileDescriptor`, since I have an fd I can work with, but I have no idea how to make the scheduler do what I want
alexherbo2 has joined #crystal-lang
<FromGitter> <alex-kampa> Hello everyone, is there any way in the dependencies section of shard.yml to indicate the github branch? This might be useful if we wanted to support both 0.35 and 1.0 for a while.
<FromGitter> <MrSorcus> > Hello everyone, is there any way in the dependencies section of shard.yml to indicate the github branch? This might be useful if we wanted to support both 0.35 and 1.0 for a while. ⏎ ⏎ https://github.com/crystal-lang/shards/blob/master/docs/shard.yml.adoc#dependency-attributes ⏎ Use `branch`, `commit` or `tag` 😉 [https://gitter.im/crystal-lang/crystal?at=605f6957a7dfe1372e00343b]
<FromGitter> <alex-kampa> Cool, thanks @MrSorcus !
<FromGitter> <MrSorcus> @alex-kampa np 😄
daemonwrangler has joined #crystal-lang
daemonwrangler has quit [Quit: ZNC 1.8.2 - https://znc.in]
daemonwrangler has joined #crystal-lang
<FromGitter> <lankford> I have a project I am wanting to get off the ground and could use some help, I am pretty well versed in ruby / rails / etc, but don't have the time needed to come up to speed with a new environment on my own... I would be interested in talking to (and paying) someone about helping me get off the ground with things like getting setup / pair programming ... I like having a mentor to show me the ropes... I have
<FromGitter> ... installed and played with Amber ( can scaffold / migrate / etc ) and it seems like that is what I would be most familiar with... played with Lucky ... not married to anything, but I am a pretty big fan of using Crystal on the project
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
hsh has joined #crystal-lang
<hsh> hello everyone. Just a qq about versioning. I've been reading https://crystal-lang.org/reference/guides/hosting/github.html and just wanted to confirm that to make a release, say 0.1.0, my shard.yml should have `0.1.0` but the git tag should be `v0.1.0`? It's just that I've seen this done differently.
<FromGitter> <Blacksmoke16> thats right yes
<hsh> 👍 great, thanks!
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter> <Daniel-Worrall> @lankford sent you a PM :)
_ht has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> @straight-shoota how do custom function/macros/etc get instantiated in crinja land?
<FromGitter> <Blacksmoke16> nvm, looks like you can also manually add them to an env instance
<straight-shoota> yeah you can use `register_default` to define a feature globally, or just register with an individual instance
<FromGitter> <Blacksmoke16> 👍 perfect
<FromGitter> <Blacksmoke16> been thinking about how an Athena integration would look
<FromGitter> <Blacksmoke16> i think it would be fairly straightforward with the main challenge how to provide the instances of things
<FromGitter> <Blacksmoke16> sec imma try something
<FromGitter> <Blacksmoke16> cool, yea check this out
<straight-shoota> nice
<straight-shoota> where is the actual `Crinja` instance created?
<FromGitter> <Blacksmoke16> in the service container.
<FromGitter> <Blacksmoke16> each request has its own instance of it so each request also gets its own `Crinja` env instance
<straight-shoota> but where is the `Crinja.new` call? :D
<straight-shoota> is it autogenerated from the initializer param type?
<FromGitter> <Blacksmoke16> > private getter crinja : Crinja { Crinja.new(Crinja::Context.new, Crinja::Config.new, Crinja::Loader::FileSystemLoader.new, Crinja::TemplateCache::InMemory.new) } ⏎ ⏎ I did have to add `Crinja::` to the constructor defaults tho
<straight-shoota> that code is not in the gist...
<straight-shoota> if it's just some magic in the background?
<straight-shoota> well, I just stumbled over the loader assignment which should ideally happen at instance creation
<straight-shoota> the crinja instance should actually be re-usable. You don't necessarily need a new one per request. All state is limited to the current render context.
<FromGitter> <Blacksmoke16> it's a bit of magic from the DI component: https://athenaframework.org/components/dependency_injection
<FromGitter> <Blacksmoke16> but what about the case where i wanted to do something like:
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=605fbf7b28e6153d724a7bba]
<FromGitter> <Blacksmoke16> e.g. when a custom function has a dependency on a service
<FromGitter> <Blacksmoke16> cant share the dependency as it would leak state between requests
<straight-shoota> yeah, if you want to do that...
<straight-shoota> the more idiomatic approach would be to encapsulate everything relevant for the template runtime in the render context.
<FromGitter> <Blacksmoke16> which is a singleton?
<straight-shoota> no, the context created by the render method
coderobe has quit [Remote host closed the connection]
coderobe has joined #crystal-lang
<straight-shoota> like `template.render({"router" => router})`
<FromGitter> <Blacksmoke16> oh, would that work?
<straight-shoota> the router type needs to include `Crinja::Object`
<straight-shoota> and then the function uses `env["router"].raw.as(Router).generate`
<straight-shoota> it's not type safe, of course
<straight-shoota> but it's should be much more performant than initializing new crinja environments all the time
<FromGitter> <Blacksmoke16> hmm
* straight-shoota thinks about alternatives to encapsulate state with type safety
<FromGitter> <Blacksmoke16> id be curious to see how much overhead it actually adds
<FromGitter> <Blacksmoke16> using DI like that would fit better into the design of things
<FromGitter> <Blacksmoke16> let me test it