RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
justinmcp_ has quit [Quit: No Ping reply in 180 seconds.]
justinmcp has joined #crystal-lang
justinmcp has quit [Client Quit]
justinmcp has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
Creatornator has joined #crystal-lang
<FromGitter> <girng> Hello!!!
<FromGitter> <girng> How is everyone doing
pabs has quit [Ping timeout: 264 seconds]
pabs has joined #crystal-lang
rohitpaulk has joined #crystal-lang
Creatornator has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <bararchy> all good @girng , and you? ⏎ I'm still waiting to get a beta access to your game ;)
<FromGitter> <fusillicode_twitter> everything ok @girng :)
<FromGitter> <fusillicode_twitter> guys is there a way to tell the compiler that at some point in my code a variable isn't `nil`?
<FromGitter> <fusillicode_twitter> I have an explicit check with an `unless` but unfortunately it seems that the compiler can't figure out that the var is `nil`
<FromGitter> <fusillicode_twitter> btw the var is actually a record extracted from the db πŸ€”
<FromGitter> <girng> glad to hear! you guys are awesome
<FromGitter> <fusillicode_twitter> πŸ˜„
<FromGitter> <bew> How your unless looks like?
<FromGitter> <fusillicode_twitter> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbee7ef1e23486b93aee06a]
<FromGitter> <fusillicode_twitter> this is part of an iteration block
<FromGitter> <fusillicode_twitter> inside the iteration I do some validations by also querying a db and if something is broken I store the errors, log them and then skip to the next iteration
<FromGitter> <fusillicode_twitter> but if everything is ok I go on but unfortunately the compiler complains about nilable refs :(
<FromGitter> <fusillicode_twitter> in the over mentioned case the `record` that I need to use to perform some other stuff
<FromGitter> <fusillicode_twitter> P.S: in particular I need some of the `record` properties and I would really like to avoid a whole bunch of `.try(&.record_property)` :(
<FromGitter> <HarrisonB> Do you have the full stack trace?
<FromGitter> <fusillicode_twitter> ok without the `--error-trace`
<FromGitter> <fusillicode_twitter> I get the error where I try to use the `record`, i.e. `record.name`
<FromGitter> <fusillicode_twitter> `undefined method 'name' for Nil (compile-time type is (Db::Company | Nil))`
<FromGitter> <fusillicode_twitter> but with the `--error-trace` I end up in `Crecto` πŸ˜…
<FromGitter> <bew> Can you show the code around record.name?
<FromGitter> <proyb6> use
<FromGitter> <fusillicode_twitter> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbeea32435c2a518e8833be]
<FromGitter> <fusillicode_twitter> @bew let me see if I can extract the piece of code
<FromGitter> <fusillicode_twitter> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbeea6be65a634336baf9f0]
<FromGitter> <fusillicode_twitter> I tried to extract only the meaningful pieces @bew, I hope that it gives an idea about what I'm doing (i.e. an incredible mess XD)
<FromGitter> <fusillicode_twitter> btw this `Db::RecordsRepo.by_email(email)` is this: ⏎ ⏎ ```Repo.get_by(MODEL, email: email)``` ⏎ ⏎ MODEL is just a constant referencing the a Crecto model :) [https://gitter.im/crystal-lang/crystal?at=5bbeeb06c7bf7c3662ef5c8c]
<FromGitter> <bew> The unless only protects the `task_errors...`
<FromGitter> <fusillicode_twitter> mmm
<FromGitter> <fusillicode_twitter> so...I need to...let me see...
<FromGitter> <bew> I suggest you a `if record` with your stuff, then an `else` with the error (for example)
<FromGitter> <fusillicode_twitter> I also thought about it but I have a few of these checks and the `if record` `else` would clutter the code
<FromGitter> <fusillicode_twitter> :(
<FromGitter> <fusillicode_twitter> just to know, there's no way to make an "unsafe" not nilable cast? πŸ€”
<FromGitter> <Blacksmoke16> `.not_nil!`
<FromGitter> <bararchy> Yeha, but be careful about using the not_nil! Call , I hate seeing it in the code, usually the compiler logic on nilabillty is better then the devs XD
<FromGitter> <fusillicode_twitter> @bararchy I totally agree with you but I really don't know what to do in my case :(
<FromGitter> <Blacksmoke16> prob that
<FromGitter> <Blacksmoke16> i dont use crecto so not sure, or https://www.crecto.com/untitled/database-operations#get-1
<FromGitter> <fusillicode_twitter> @Blacksmoke16 I saw the `get` with exception but in my case it is actually possible to not have any record
<FromGitter> <Blacksmoke16> yes thats the point then
<FromGitter> <Blacksmoke16> because the exception would probably remove the nil type from the `record` var
<FromGitter> <fusillicode_twitter> yep but after the "nilable" `get` however I explicitely check for the presence and store + log the proper error
<FromGitter> <fusillicode_twitter> mmm
<FromGitter> <fusillicode_twitter> but with the exception I would still need to handle the missing record case, i.e. rescue with something...`nil` XD
<FromGitter> <Blacksmoke16> > @Blacksmoke16 I saw the `get` with exception but in my case it is actually possible to not have any record
<FromGitter> <Blacksmoke16> oh wait, i read that wrong
<FromGitter> <fusillicode_twitter> wait I may have written that wrong XD
<FromGitter> <Blacksmoke16> either way you're going to have to do some check to see if it actually returned a value or not
<FromGitter> <fusillicode_twitter> > either way you're going to have to do some check to see if it actually returned a value or not ⏎ ⏎ yep
<FromGitter> <Blacksmoke16> what do you want to happen if it doesnt return? like just add that log and return?
<FromGitter> <Blacksmoke16> could prob do like
<FromGitter> <Blacksmoke16> ```unless record ⏎ task_errors.lead << "Not found for email '#{email}'" ⏎ return``` [https://gitter.im/crystal-lang/crystal?at=5bbeefe5435c2a518e8858af]
<FromGitter> <fusillicode_twitter> unfortunately I only need to store the error because I have other things that I want to check beside the record presence
<FromGitter> <fusillicode_twitter> after all the checks however I would rely on the errors to decide to skip to the next record (I'm actually inside an iteration) or tho procede further
<FromGitter> <Blacksmoke16> maybe wrap that logic into a method that gets called if record.nil?
<FromGitter> <fusillicode_twitter> yep let me see
<FromGitter> <fusillicode_twitter> btw thanks a lot for the support πŸ™‡
<FromGitter> <fusillicode_twitter> you guys are indeed awesome :D
DTZUZO_ has quit [Ping timeout: 244 seconds]
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <fusillicode_twitter> unfortunately I think that even the method doesn't solve my problem :(
lvmbdv has joined #crystal-lang
<FromGitter> <ljuti> @jokke Found your OpenAPI spec library. If I’d add support for OAS version 2, how should I go about it?
<FromGitter> <ljuti> Oh, sorry. It was written by another Joakim (Reinert). :)
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
<jokke> no that's me
<FromGitter> <fusillicode_twitter> uhm
<FromGitter> <fusillicode_twitter> destructuring... πŸ€”
rohitpaulk has quit [Ping timeout: 272 seconds]
<jokke> ljuti: cool :) Hmm good point... I think we should provide namespaces then.
<FromGitter> <ljuti> @jokke OK, so it’s just Gitter then showing someone else’s profile :)
<jokke> well. i'm connected over irc
<FromGitter> <ljuti> Yeah, I just realized that
<jokke> but probably also over gitter
<jokke> no, apparently not
<FromGitter> <ljuti> Well, you’ll think about it and then tell me what to do :)
<jokke> ljuti: i assume many things are reusable. Maybe just providing the namespaces V2 and V3 or so and then moving only conflicting things into those namespaces would suffice. The version has to be set to some constant over a macro though, otherwise we can't branch out to differing versions from deeper levels..
rohitpaulk has joined #crystal-lang
<jokke> are HTTP::Cookies secure?
<jokke> as in signed?
<FromGitter> <bararchy> "Sigend"?
<FromGitter> <bararchy> what do you mean by a sigend cookie?
<jokke> HMAC
<jokke> as in i can be sure i was the one issuing it
<FromGitter> <proyb6> It won’t be secure if Monster Cookie is around, joking
<FromGitter> <aboeglin> If someone can clarify something for me
<FromGitter> <aboeglin> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbf394eef4afc4f2855fb7a]
<FromGitter> <aboeglin> In that piece of code that I found online, what is the & symbol for for the formatter argument ?
<FromGitter> <vladfaust> People spend a lot of time writing docs, @aboeglin https://crystal-lang.org/docs/syntax_and_semantics/capturing_blocks.html
<FromGitter> <drum445> @jokke if you are using kemal-sessions then yes they use HMAC and append it to the cookie
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <aboeglin> @vladfaust I do spend quite some time reading it. But I find it hard to google that kind of things, if you don't know the term behind a syntax it's very hard to know what it refers to. Also, I don't really find that syntax on the docs. I still have no clue how one would use that class though.
<FromGitter> <j8r> @aboeglin I would advice to directly code a project to learn the language - you'll learn better how it works. Then, you can dig around to use more advanced features to improve you code
<FromGitter> <aboeglin> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbf4589435c2a518e8b0bab]
<FromGitter> <j8r> @aboeglin TLDR: liek any language (even spoken one), learn what you need to bootstrap, then worry to learn more advanced vocabulary πŸ˜„
<FromGitter> <aboeglin> @j8r I actually do, I'm currently rewriting a service with kemal
<FromGitter> <aboeglin> but sometimes when reading docs I come across some syntax I do not understand
<FromGitter> <j8r> In that case, for me, I search this syntax in the compiler
<FromGitter> <j8r> `grep -rn '&block'` for example, this returns me were the syntax is used
<FromGitter> <j8r> this gives me examples :)
<FromGitter> <j8r> @aboeglin you are new, yeah? No worry to start slowly.
<FromGitter> <aboeglin> but here it's not only about blocks, I use blocks with kemal and HTTP::Client already
<FromGitter> <aboeglin> yes I am, the command gives me `grep: crystal: No such file or directory` though.
<FromGitter> <j8r> yeah, you have to clone the repo `git clone https://github.com/crystal-lang`
<FromGitter> <aboeglin> oh I see, I thought it was weird trying to grep in a binary
<FromGitter> <j8r> also `git clone https://github.com/crystal-lang/crystal-book` if you want to grep in the docs too!
<FromGitter> <j8r> and then you have the repo in local to contrib to, feel free
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> hooo, I remind I need to send a PR to better explain `struct` vs `class`...
DTZUZO_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <aboeglin> Great, you can hit me when it's live !
<FromGitter> <aboeglin> And can you confirm that my sample use of the Formatter class is correct ?
<FromGitter> <fusillicode_twitter> > hooo, I remind I need to send a PR to better explain `struct` vs `class`... ⏎ ⏎ I actually need to contribute too to a great shard ;)
<FromGitter> <j8r> It looks good
<FromGitter> <fusillicode_twitter> and I also think I've found a bug in the compiler XD
<FromGitter> <aboeglin> The docs don't say that though, when we want to capture a block, we just need not to yield anything inside it ?
<FromGitter> <bararchy> @drujensen you're here?
<FromGitter> <aboeglin> Capturing a block is something that happens in the implemented method, or in the user of it ? I don't really grasp where it happens from the docs. I read the page on capturing blocks twice now.
<FromGitter> <aboeglin> say: ⏎ ⏎ ```def double(n : Int32, &block : Int32 -> Int32) ⏎ yield n * 2 ⏎ end``` ⏎ ⏎ Could I capture this block ? [https://gitter.im/crystal-lang/crystal?at=5bbf4fd4ef4afc4f2856b8e6]
<FromGitter> <j8r> @aboeglin https://carc.in/#/r/57fq
<FromGitter> <j8r> this is explained also in the docs about blocks and cie
<FromGitter> <aboeglin> > To capture a block you must specify it as a method's block argument, give it a name and specify the input and output types. For example:
<FromGitter> <aboeglin> I don't understand what this means, as I do the same thing with the double method
<FromGitter> <aboeglin> I just don't find it clear
rohitpaulk has joined #crystal-lang
<FromGitter> <j8r> feel free to send a PR at https://github.com/crystal-lang/crystal-book/pulls
<FromGitter> <j8r> the docs are far to be perfect
<FromGitter> <fusillicode_twitter> > the docs are far to be perfect ⏎ ⏎ I think that they're pretty close though ;)
<FromGitter> <fusillicode_twitter> So, kudos for that
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <aboeglin> first I'd need to understand the concepts though ^^
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<FromGitter> <fusillicode_twitter> mmm
<FromGitter> <fusillicode_twitter> ```code paste, see link``` ⏎ ⏎ does something like this make sense πŸ€” [https://gitter.im/crystal-lang/crystal?at=5bbf6924435c2a518e8c2dba]
<FromGitter> <j8r> totally
DTZUZO_ has quit [Ping timeout: 276 seconds]
<FromGitter> <j8r> that's how composition works. I always use it over inheritance
<FromGitter> <fusillicode_twitter> yep yep but unfortunately the compiler complains about a missing initialization πŸ€”
<FromGitter> <fusillicode_twitter> https://play.crystal-lang.org/#/r/57hz
<FromGitter> <fusillicode_twitter> :(
<FromGitter> <j8r> that's logic
<FromGitter> <fusillicode_twitter> wait
<FromGitter> <fusillicode_twitter> you're right
<FromGitter> <j8r> or create `def initialize` that defines `@email`
<FromGitter> <fusillicode_twitter> right right
<FromGitter> <fusillicode_twitter> let me see if I can achieve what I want
<FromGitter> <j8r> you can even use generics, like `include C(Int32)` :D
<FromGitter> <ljuti> Geez, macros are too powerful and confusing for me yet
<FromGitter> <fusillicode_twitter> > Geez, macros are too powerful and confusing for me yet ⏎ ⏎ we're on the same boat XD
<FromGitter> <j8r> πŸ’― @ljuti
<FromGitter> <fusillicode_twitter> but they're definitely more readable than the ones that you can find in a language like...I don't know...Scala XD
<FromGitter> <proyb6> True, Scala is way complex
<FromGitter> <proyb6> I get Crystal clear in a day
<FromGitter> <fusillicode_twitter> +1
<FromGitter> <proyb6> Just like the Capture block in the last few message
<FromGitter> <proyb6> &block refer to {...}
<FromGitter> <fusillicode_twitter> I didn't had the time to follow that but I think that I got the main point :)
<FromGitter> <fusillicode_twitter> btw @j8r what do you think of using a `forward_missing` and a wrapper approach rather than sharing a behavior with mixins? πŸ€”
return0e has quit [Remote host closed the connection]
<FromGitter> <ljuti> Given ```module OpenAPI ⏎ module Object ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5bbf6bcf600c5f64238fab10]
<FromGitter> <fusillicode_twitter> sorry for the bothering but I'm really interested in what other people thinks about these kind of stuff XD
<FromGitter> <proyb6> Now it got me thinking, how Node.js, Ruby and PHP are still popular among the community. Newbies could find interpreter language are less complicated and ability move quickly without worry about one compile time error will halt the whole project or spending too long to learn before you do something useful. ⏎ ⏎ If we keep saying Crystal is better for performance, isn’t going to attract much when Kotlin and
<FromGitter> ... Swift does well in their ecosystem and Go and Rust does well in system programming. Lua is great for gaming industry, python for data and academic. ⏎ ⏎ What do you intend to use Crystal for? [https://gitter.im/crystal-lang/crystal?at=5bbf6bde435c2a518e8c4541]
<FromGitter> <ljuti> Formatting fail :)
<FromGitter> <ljuti> And ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbf6c021e23486b93b03f6f]
return0e has joined #crystal-lang
<FromGitter> <j8r> @fusillicode_twitter you can, but if you can use just `include`s that's the best
<FromGitter> <ljuti> The macro generates method definitions out of OBJECT_TYPES, right?
<FromGitter> <fusillicode_twitter> @j8r got it but I think that in my case the wrapper approach would be more appropriate, i.e. I have two structs that are identical but for one field that in one is a string and the other a float
<FromGitter> <ljuti> Now, I want to control which types it should define in a module with conditions
<FromGitter> <fusillicode_twitter> and I'm going from the string one to the float one by trying to convert the a string to a float
<FromGitter> <bajro17> how to use ?HTTP::Server::Response.status_code
<FromGitter> <fusillicode_twitter> @proyb6 whenever I talk about Crystal (pretty often right now) the first thing that I mention is not how much performant it is but how fast it makes you
<FromGitter> <j8r> @fusillicode_twitter use generics
<FromGitter> <ljuti> I tried putting specific structs and classes into a separate SCOPED_OBJECT_TYPES array, didn’t fully work
<FromGitter> <fusillicode_twitter> @j8r oh gosh...I'm scared by them XD
<FromGitter> <fusillicode_twitter> @j8r 🀩
<FromGitter> <aboeglin> @proyb6 so if you understand captured blocks well, you define that when implementing the method right ? It's basically a function that takes a block and makes it a proc to be called later, otherwise a callback.
<FromGitter> <bajro17> can someone tell me what is wrong with that code https://play.crystal-lang.org/#/r/57ig
<FromGitter> <bajro17> in terminal it show me status 200
<FromGitter> <bajro17> but I dont see anything
DTZUZO_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> you never print anything
<FromGitter> <bajro17> @Blacksmoke16 can you help me please
<FromGitter> <Blacksmoke16> nvm, main reason is im not sure the http server works in the playground? Its exiting with error code 1 so thats prob not good
<FromGitter> <bajro17> I dont understand good this
<FromGitter> <bajro17> #add method to dynamically add routes ⏎ ⏎ ```def get(route, &block : (-> String)) ⏎ @routes[route.to_s] = block ⏎ ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bbf713d82893a2f3bcb426c]
rohitpaulk has joined #crystal-lang
<FromGitter> <Blacksmoke16> im not too familiar with the HTTP:Server, sorry :/
return0e has quit [Remote host closed the connection]
<FromGitter> <bajro17> no problem thank you anyway
return0xe has joined #crystal-lang
<FromGitter> <rickychilcott> If I have a Tuple of arguments in a macro, is it possible to flatten it? I have an example at https://gist.github.com/rickychilcott/2b294420d95b2d828d5963fe6a8e2141
<FromGitter> <rickychilcott> I've tried splats, by the don't seem to work well in a method definition.
<FromGitter> <rickychilcott> Said another way, without macro part of the example to provide more complexity, is it possible to use a Tuple in a method definition to act as arguments ⏎ ⏎ ```def test_method({name, age}) ⏎ #code ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bbf7302c7bf7c3662f37f86]
return0xe has quit [Read error: Connection reset by peer]
<FromGitter> <vladfaust> Stop yelling, @bajro17!
<FromGitter> <vladfaust> See https://github.com/tbrand/router.cr and Kemal. Dive into the code, it the only best way to learn Crystal!
<FromGitter> <bajro17> @vladfaust sorry bro its comment :)
<FromGitter> <bajro17> in code accidentally come like that
<FromGitter> <vladfaust> router.cr has ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ in its README [https://gitter.im/crystal-lang/crystal?at=5bbf7411c7bf7c3662f38b6b]
<FromGitter> <bajro17> @vladfaust thank you I will try it now <3
return0e has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 268 seconds]
<FromGitter> <vladfaust> πŸ’ͺ
<FromGitter> <aboeglin> @bajro17 well, that's what I tried to understand above, so from what I understand, with that method you can use it like this : ⏎ ⏎ ```get "/some-route" { |context| handle_request }``` ⏎ ⏎ And it would just add it to the routes property. [https://gitter.im/crystal-lang/crystal?at=5bbf75f4384492366120de79]
<FromGitter> <bajro17> @aboeglin if I do like this I get Error in redis.cr:46: wrong number of block arguments (given 1, expected 0) ⏎ ⏎ app.get "/some" { |context| handle_request }
<FromGitter> <bajro17> I cant pass with that any argument
<FromGitter> <proyb6> @aboeglin You are correct, further more, I read Crystal programming from Pragmatic Books is very clear if you like to get a book
<FromGitter> <aboeglin> @bajro17 well, I don't really understand the type of the block though, that may be part of your issue
<FromGitter> <aboeglin> what is (-> String) supposed to be ?
<FromGitter> <rickychilcott> It's a type annotation to say that block needs to be a Proc which returns a String, right?
<FromGitter> <rickychilcott> you need to make sure your Proc returns a string, likely not what `context` is
<FromGitter> <aboeglin> but takes no argument right ?
<FromGitter> <vladfaust> Or change Proc to return `Nil` or `Void`, which is more common in this case
<FromGitter> <vladfaust> `Void` is the best here, because AFAIK it ignores any output from the proc
<FromGitter> <aboeglin> should it rather be something like ( HTTP::Context -> Void ) ?
<FromGitter> <vladfaust> +
<FromGitter> <aboeglin> not sure about the type of context
<FromGitter> <vladfaust> If not sure, dive into API
<FromGitter> <vladfaust> https://crystal-lang.org/api
<FromGitter> <vladfaust> And enter `Context`
<FromGitter> <aboeglin> well it's not for me here, but would that be the type ?
<FromGitter> <vladfaust> Viola ✨
<FromGitter> <vladfaust> HTTP::Server::Context
<FromGitter> <aboeglin> also I'm not sure why we need the parens here
<FromGitter> <j8r> Voila you mean :)
<FromGitter> <aboeglin> can't it be just HTTP::Server::Context -> Void ?
<FromGitter> <j8r> Better not to say what you said @vladfaust , this close to the rape word :o
<FromGitter> <vladfaust> Typical slav error
<FromGitter> <vladfaust> Viola is a musical instrument :thinking:
<FromGitter> <aboeglin> ```def get(route, &block : HTTP::Server::Context -> Void) ⏎ # assign block ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bbf7894f659e677729b7920]
<FromGitter> <aboeglin> but get is probably a bad name for it, I'd rather call that method add_route
<FromGitter> <j8r> This isn't idiomatic to use Void
<FromGitter> <j8r> use `Nil`. `Void` is typically when you do bindings
<FromGitter> <aboeglin> @vladfaust seems to say something different above
<FromGitter> <j8r> `grep -r Void crystal` an you'll see
<FromGitter> <j8r> yeah but @vladfaust is @vladfaust :P
<FromGitter> <vladfaust> Nothing I say makes sense!
<FromGitter> <j8r> Hahaha
<FromGitter> <vladfaust> Just sharing experience
<FromGitter> <vladfaust> Works good for me!
<FromGitter> <vladfaust> Wouldn't compiler say "no" if a `-> Nil` Proc returns a non-nil value?
<FromGitter> <j8r> in the end both do more or less the same, but greping in the stdlib shows that Void is used on paths like openssl, yaml and socket with `Void*` for example.
<FromGitter> <j8r> You can use also `-> _`
<FromGitter> <vladfaust> Can't do `-> _` if variable!
<FromGitter> <j8r> ?
<FromGitter> <j8r> this syntax is quite used on the stdlib, and also referenced in the docs
<FromGitter> <vladfaust> https://carc.in/#/r/57j1
<FromGitter> <j8r> @vladfaust https://carc.in/#/r/57jf
<FromGitter> <vladfaust> Why do you respond me with that carc?
<FromGitter> <vladfaust> It makes no sense, never said this wouldn't work. However, `pp` returns `nil`
<FromGitter> <vladfaust> https://carc.in/#/r/57jg now this makes sense
<FromGitter> <vladfaust> Yes, `Nil` and `Void` are the same
<FromGitter> <j8r> the Void mention should be removed from https://crystal-lang.org/docs/syntax_and_semantics/literals/proc.html
<FromGitter> <j8r> `Void` is never used outside C related stuff
<FromGitter> <jwoertink> if I'm making a `HEAD` request to a server, and I have access to `HTTP::Server::Response`, is there anything I can use from that to tell that it was in fact a HEAD request?
<FromGitter> <vladfaust> `# A proc accepting no arguments and returning Void` I thinks that makes sense
<FromGitter> <jwoertink> also, does crystal http server skip writing to the body when it's a HEAD request?
<FromGitter> <vladfaust> No, it does not make sense https://carc.in/#/r/57jo
<FromGitter> <vladfaust> Should be removed then
<FromGitter> <j8r> one way to know is `typeof()`
<FromGitter> <vladfaust> Huh?
<FromGitter> <vladfaust> @jwoertink you can see its headers?
<FromGitter> <j8r> https://carc.in/#/r/57jq
<FromGitter> <vladfaust> https://crystal-lang.org/api/0.26.1/HTTP/Request.html#method%3AString-instance-method
<FromGitter> <j8r> that's `Nil`
<FromGitter> <vladfaust> Yea, I see
<FromGitter> <jwoertink> Yeah, that's on the Request though. Maybe I'm not thinking about this problem correctly
<FromGitter> <j8r> We can return everything with `Void` https://carc.in/#/r/57jt
rohitpaulk has quit [Ping timeout: 245 seconds]
akaiiro has quit [Ping timeout: 252 seconds]
non-aristotelian has joined #crystal-lang
<FromGitter> <bararchy> Is there a way to create a buffer overflow with Crystal? Maybe using unsafe and pointers ?
<FromGitter> <bararchy> As in, I want a small code example that does a buffer overflow and hopefully crashes
<FromGitter> <bew> What for?
<FromGitter> <bararchy> "AI research on vulnerability generation" ;)
<FromGitter> <bararchy> Any idea on how to do it @bew ?
<FromGitter> <bew> Ah :p Never tried
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter> <bararchy> Hmmm
<FromGitter> <bararchy> https://crystal-lang.org/api/0.26.1/Pointer.html#malloc%28size%3AInt%2Cvalue%3AT%29-class-method
<FromGitter> <bararchy> This sounds unsafe enough to work XD
<FromGitter> <bew> Yeah you can try that!
<jokke> has someone successfully built and pushed docker images to docker hub from travis?
<jokke> i can't run docker login successfully
<jokke> either it complains that there's no TTY or it prompts for the password
<jokke> depending on how i call it
<jokke> i encrypted the env var using travis encrypt
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii is now known as Raimondi
<jokke> guhh this is so annoying
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
akaiiro has joined #crystal-lang
<FromGitter> <aboeglin> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bbfa4eeef4afc4f285988da]
ashirase has quit [Ping timeout: 252 seconds]
ashirase has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
<jokke> wow... gitlab ci is _SO_ much better
<jokke> and faster <#
<jokke> <3
<jokke> and works with github repos
<jokke> i think i'll just use gitlab and make it sync with github
<FromGitter> <wontruefree> I like gitlab
<FromGitter> <wontruefree> I use it for most of my things now
<jokke> cool!
<FromGitter> <wontruefree> Also I am still worried about what Microsoft will do to Github
<jokke> yeah
<jokke> same here
<jokke> lol i migrated all my github projects which are like > 200 now to gitlab as soon as they announced that microsoft is taking over :D
<FromGitter> <wontruefree> yeah I migrated alot too
<FromGitter> <wontruefree> Microsoft has integrated a far ammount of stuff on there side
<FromGitter> <wontruefree> I am just waiting for the other shoe to drop
<FromGitter> <bararchy> RX14 @bcardiff -> https://blog.travis-ci.com/2018-10-11-windows-early-release
<FromGitter> <bararchy> We can now test Windows builds on CI :)
<FromGitter> <bcardiff> Ohhhhhhhhh
<FromGitter> <fridgerator> πŸ‘
<jokke> you can do this with gitlab ci too :P
<jokke> you would need a windows server though :P
<FromGitter> <bcardiff> I hope CircleCI joins the party
<FromGitter> <bararchy> Reading the post let me feel like we might be needed to wait for 3-6 month for proper tooling support, unless a spec can run with what they have now (visual 2017)
<FromGitter> <straight-shoota> nice
<FromGitter> <straight-shoota> jokke, it runs on GCE
<jokke> hmmm weird...
<jokke> can you pull this image? https://hub.docker.com/r/jreinert/slide_server/
<jokke> i get: Error response from daemon: Get https://registry-1.docker.io/v2/jreinert/slide_server/manifests/latest: unauthorized: incorrect username or password
<jokke> ah
<jokke> i changed it recently
<jokke> probably authenticates when it recognizes it's my own repo
<FromGitter> <bajro17> is it possible to class start own method in initialize I try with just name and it dont work also I dont get any error?
<FromGitter> <bew> I don't understand can you give an example?
<FromGitter> <bajro17> https://carc.in/#/r/57lf
<FromGitter> <bajro17> is it possible this app.run method to run inside initialize
<FromGitter> <bajro17> when I try nothing happen in program but I dont get any error
<FromGitter> <aboeglin> anyone has experience with using databases in crystal ?
Heaven31415 has joined #crystal-lang
<FromGitter> <bew> @bajro17 if should work i guess (can't try right now), but I don't see why you'd want to do that: you should use the `initialize` method only to *initialize* your object, not do fancy stuff, either do the fancy stuff explicitely, or make a wrapper around the constructor that does some other things after initializing the object
johndescs has quit [Ping timeout: 245 seconds]
johndescs has joined #crystal-lang
<FromGitter> <aboeglin> Code style question, let's say I just want to print the body of a request
<FromGitter> <aboeglin> defined here in the HTTP module : https://crystal-lang.org/api/0.26.1/HTTP/Request.html#body%3AIO%3F-instance-method
<FromGitter> <j8r> @wontruefree the problem was here before GitHub was acquired Microsoft - dependence to a private company. Nothing change. Look at China repo removals, DMCA take downs etc. And if Google or whatever evil buys Gitlab, you'll migrate again? The only answer is decentralization.
<FromGitter> <bajro17> @j8r yes we can focus mostly on blockchain to whole web be decentralized
DTZUZO has quit [Ping timeout: 252 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]