<FromGitter>
<watzon> Should I go ahead and create an issue?
faitswulff has quit [Remote host closed the connection]
<FromGitter>
<bcardiff> Hi! I'm looking for some apps repositories using crystal (apps, not shards libraries) to check some build stuff. I would like to check it with some repos I don't know :-) . As long as it's a linux app (cli, webserver, image processing) it should be fine. Send PM of @ with the repo if you can. Thanks!
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter>
<watzon> Pretty printing of matrices working :)
<rkeene>
I was working an SSH Agent daemon that used Duktape to run my JavaScript-based SSH Agent ported from ChromeOS but I've since abandoned Crystal for it
<FromGitter>
<bcardiff> I would say that apps that a end-user could want to use. Or something that will require small context/environment. My best sample is https://github.com/manastech/benchy a CLI tool that given a config (in yaml ) does something and exit
<FromGitter>
<bcardiff> So, an app that could appear in a store for someone to download and use it.
<FromGitter>
<watzon> Damn Canadians having all the fun
<rkeene>
I'm pretty sure I'm the only user of most of my software, it's handy
<FromGitter>
<watzon> I'm definitely the opposite, I love creating things for other people to use
<rkeene>
I just want to solve problems I'm having
<rkeene>
I just have unique problems, apparently
<FromGitter>
<bcardiff> @rkeene usually the problems are shared, the challenge is finding the audience (or finding another approach that is shared among others). But doing software for yourself is definitely good.
blassin2 has joined #crystal-lang
blassin has quit [Ping timeout: 246 seconds]
faitswulff has joined #crystal-lang
<rkeene>
bcardiff, Tangentially related to your conference is AppFS: http://appfs.rkeene.org
<FromGitter>
<bcardiff> but that is not written in crystal, or am I missing somthing?
<rkeene>
But it is related to the conference topic
<rkeene>
(It makes the number of steps before running software lower -- specifically to 0, where snaps still require you to install the snap. With AppFS, you just run it and any dependencies are pulled in -- but it doesn't handle sandboxing, but sandboxing can be built on top of it)
<FromGitter>
<watzon> I think @bcardiff is looking for projects specifically written in Crystal rkeene
<FromGitter>
<watzon> I'd say to use my Tourmaline library, but you'd have to set up a telegram bot to run the examples
<FromGitter>
<bcardiff> Oh! I see rkeene. But it might be beyond my limits and knowledge :-)
<FromGitter>
<bcardiff> @watzon is an end up or I need to code to use it?
<FromGitter>
<watzon> You could for the repo and run the examples with little to no code. All you need is an API key which you can get from @BotFather on Telegram
<oprypin>
thanks for suggestion. i realize that i might be impossible to satisfy, though. i suppose it would need to be tightly integrated with Crystal
<FromGitter>
<dscottboggs_gitlab> @oprypin holy crap those fuzz results
<FromGitter>
<Blacksmoke16> also if you want to use https do like `HTTP::Client.new("google.com", 443, true)`
duane has joined #crystal-lang
<jokke>
or more verbosely `tls: true`
<FromGitter>
<r00ster91> aaaah
<FromGitter>
<r00ster91> thanks
<z64>
@r00ster91 the difference is whether or not you want to re-use a single connection for multiple request. if you make an instance of a client, a single tcp connection will be used; using the class methods will use a new connection each time
<FromGitter>
<r00ster91> ooh.. I have 4 other `HTTP::Client.get(...)`s in my code. maybe I should all turn them into object versions so not a new connection is made every time (probably faster)
<z64>
if you're doing them sequentially, it's probably a good idea. if they can happen "randomly" with any amount of time in between, its fine to connect when needed
<FromGitter>
<Blacksmoke16> i always made an obj version tied to a constant and used the const everywhere...
<FromGitter>
<r00ster91> oh well then I will leave it all as needed because the requests all happen on request
<FromGitter>
<r00ster91> s/as needed/as-is
<z64>
@Blacksmoke16 that can be fine, but you can block concurrent operations that way, if thats important to you
<FromGitter>
<Blacksmoke16> prob fine for now
alex`` has joined #crystal-lang
<FromGitter>
<mwlang> How do I check a specific class is assigned to a variable? ⏎ ```response.is_a?(Cossack::Response) ? response.body == "{}" : false``` gives me this error: "undefined method 'body' for Nil (compile-time type is (Cossack::Response | Nil))"
<FromGitter>
<Blacksmoke16> well that doesnt make sure `response `isnt nil
<FromGitter>
<Blacksmoke16> hence your error
<FromGitter>
<mwlang> because of the union possibilities?
<FromGitter>
<Blacksmoke16> response can either be Nil or a Cossack::Response
<FromGitter>
<z64> what is `response`? is it a method or a variable
<FromGitter>
<Blacksmoke16> id imagine its the var from a like `HTTP::Client.get`
<FromGitter>
<mwlang> response is a property on the class, ```property response : Cossack::Response?```
<FromGitter>
<Blacksmoke16> oh, well that would do it
<FromGitter>
<z64> okay, so its a method - when you call a method, it will be fully typed because crystal can't know that it will return the same thing every time. assigning it to a local variable first will only call the method once, allowing the type `Nil` to be removed from the union with the ternary expression
<FromGitter>
<Blacksmoke16> same reason why you have to do like `if val = @value`
<FromGitter>
<Blacksmoke16> id imagine?
<FromGitter>
<Blacksmoke16> since its just a getter of the underlying ivar
<FromGitter>
<mwlang> Ah, I haven't encountered that problem yet, @Blacksmoke16
<FromGitter>
<mwlang> thanks, @z64 -- that explains it well.
<FromGitter>
<mwlang> unlearning some Ruby here.
<jokke>
:)
<FromGitter>
<z64> @Blacksmoke16 yeah it's a similar reason, but the implementation of the getter doesn't matter here; this would happen with any method call that returns a union. in the case of `@var`, they are always fully typed because its value could be any one of its types each time you observe it, so to speak
<FromGitter>
<z64> the `sleep 1` keeps the main fiber alive for a second. the `Fiber.yield` allows a context switch to occur, but once that happens execution returns back to the main fiber - the only thing it has left to do is to `puts "MORE STUFF"`, and then the main fiber is done so the program exits
<FromGitter>
<z64> if you want to block and wait for another fiber to complete, you can use a Channel to communicate with the main fiber
<FromGitter>
<cserb> Yes, I have a heavy CPU task (similar to the one in the example) and I want it to take a break to switch context and than resume
<FromGitter>
<cserb> Not sure I understand how this would work with Channels
<FromGitter>
<mwlang> One thing I could not figure out was how to pass a block given in one method call to another. So I ended up doing the yield from the first method call ```with_vcr_cassette``` -- it took a little rethinking of how I would normally have done this in Ruby, but fortunately, webmock's wrap and callback approach made it doable.
<FromGitter>
<mwlang> So I am wondering...is it possible to pass a block along? I sort of kind of got close, I think, but my attempts led me to believe implementing such required knowing the return type of the methods for the &block variable.
<FromGitter>
<Blacksmoke16> you dont actually `_need_` the `&block` arg
<oprypin>
so have they actually removed "language" support? you always directly reference docker?
<FromGitter>
<Blacksmoke16> no, can still do `language: crystal`
<jokke>
oprypin: i use gitlab ci and i love it
duane has quit [Ping timeout: 248 seconds]
<jokke>
oprypin: i havent tried circle but i _hated_ travis.
<jokke>
i think gitlab ci is very flexible. You can install runners on pretty much anything (the runner is written in golang) and compile natively on mac for example or windows or arm or whatever
<jokke>
or - and this is what i mostly do - just use docker containers for the scripts to run in
<z64>
sorry if my last message was confusing - i was referring to circle configs being based on docker, not travis. and yeah - i maintain a ruby library where we use travis and we run CI against all supported ruby versions. it takes like 10min, minimum, to complete
<z64>
build times can vary +/-5min
<z64>
sometimes provisioning just takes forever
<oprypin>
@Blacksmoke16: why isnt that the recommended way then?
<alex``>
this resolve is a feature or a borderline behavior?
<z64>
feature, i guess
<alex``>
if I link this type of link, I would like to be sure it will not break later
<z64>
it should be fine to use those links; the only time they will break is if the API changes - like if YAML was removed
<FromGitter>
<kinxer> Yeah, I'd generally say that z64's suggestion (https://crystal-lang.org/api/latest/) would be better, since it's a stable release.
<FromGitter>
<kinxer> I'd forgotten it exists.
<FromGitter>
<kinxer> And I prefer that over your option 2 because it's explicit in the URL that it's the latest release.
<FromGitter>
<watzon> Translating that into Crystal it becomes an infinite loop
<FromGitter>
<r00ster91> oh
<FromGitter>
<watzon> I think so. For some reason they're building a hash of words using multiple arrays instead of a hash table. I think it's because they want it to be sortable, but it makes things so complicated.
<FromGitter>
<r00ster91> you can do it better in Crystal
<FromGitter>
<watzon> I feel like I can haha
<FromGitter>
<watzon> But deciphering that C# is a pain in the ass
<FromGitter>
<watzon> Thank you :) I thought it would improve the API a bit
<FromGitter>
<mwlang> makes me happy I'm not doing C# coding. :-D I ditched .Net in, oh...2002, I think...it was still in "beta" at the time and so full of bugs, it was not even funny.
<FromGitter>
<watzon> Now it just looks like Microsofty Java
<FromGitter>
<mwlang> nice find @kinxer -- I agree and I'm totally stealing that idea.
<FromGitter>
<watzon> @j8r I believe you want something like the `ExceptionHandler`. Then attach it with this http://kemalcr.com/docs/Kemal/Config.html#add_error_handler%28status_code%3AInt32%2C%26handler%3AHTTP%3A%3AServer%3A%3AContext%2CException-%3E_%29-instance-method
<FromGitter>
<Blacksmoke16> in Athena you could prob define a custom exception that accepts an array of `Exception`, then define a custom `handle_exception` that would render it
<FromGitter>
<j8r> `ExceptionHandler` doesn't have a notion of error stack
<FromGitter>
<Blacksmoke16> could maybe have a class var that is an array of errors
laaron has joined #crystal-lang
<FromGitter>
<Blacksmoke16> with a handler for each error case
<FromGitter>
<Blacksmoke16> then one final that renders all the errors on the stack, then resets it
<FromGitter>
<watzon> ExceptionHandler itself doesn't, but you can write a handler that catches multiple errors
<FromGitter>
<j8r> We had a solution like this, that was monkey patching Context
laaron has quit [Client Quit]
<FromGitter>
<j8r> Thanks, yes it may do the job
<FromGitter>
<j8r> I think we could also use the `@cause` inside the `Exception` to build the JSON errors list