ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.0 | 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
<FromGitter> <Blacksmoke16> :rolls_eyes:
<FromGitter> <j8r> What's the point @ImAHopelessDev_gitlab ?!
<FromGitter> <j8r> @watzon you can just keep using 0.34.0 for now
<FromGitter> <j8r> Not a big deal, isn't it?
<FromGitter> <watzon> Well part of the purpose of the code I was working on was getting it updated to 0.35.0, so that's kind of pointless at this juncture
<FromGitter> <Blacksmoke16> any deps?
<FromGitter> <watzon> Well I was working on an update to stumpy_utils
<FromGitter> <watzon> I'll just save it for later though
deavmi has quit [Ping timeout: 256 seconds]
<FromGitter> <watzon> I was wanting to make an image hashing library for determining the similarity between two images. I guess I could still use my own library, pixie for that.
hightower3 has quit [Remote host closed the connection]
deavmi has joined #crystal-lang
<FromGitter> <UnsolvedCypher_gitlab> Is anyone using any code coverage tools for Crystal?
<FromGitter> <j8r> I don't think one exist
<FromGitter> <Blacksmoke16> id be impressed if that still compiles
zorp has quit [Ping timeout: 258 seconds]
zorp has joined #crystal-lang
zorp has quit [Read error: Connection reset by peer]
<FromGitter> <Blacksmoke16> hm, i think i found a bug with `Log` context
<FromGitter> <Blacksmoke16> let me try and reduce
<FromGitter> <Blacksmoke16> ooo interesting
<FromGitter> <Blacksmoke16> http serve reuses the same fiber when keep-alive is true
<FromGitter> <Blacksmoke16> so my log context is bleeding thru multiple requests
postmodern has joined #crystal-lang
<FromGitter> <jwaldrip> ya, only one that comes up: https://crystalshards.org/shards/search?q=coverage
Vexatoast has quit [Ping timeout: 246 seconds]
Vexatos has joined #crystal-lang
<FromGitter> <watzon> I know I've asked this before, but I can't remember the answer. How would you go about doing a `gsub` where you use part of the match in the substitution? Doesn't seem like `str.gsub(/a(foo)b/, "b\1a")` works.
<FromGitter> <watzon> Ahh it's `\\1`
<FromGitter> <Blacksmoke16> groups with like `$1`?
<FromGitter> <Blacksmoke16> or that :p
<FromGitter> <bararchy> ok, seems to work :) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee869d049260560aa63204d]
_ht has joined #crystal-lang
<FromGitter> <grkek> ```/usr/share/crystal/src/io/hexdump.cr:35:28```
<FromGitter> <grkek> an error with the std lib?
<FromGitter> <grkek> ``` 35 | def write(buf : Bytes) : Int64```
<FromGitter> <bararchy> ahahahaha welcome to the club @grkek ;)
<FromGitter> <grkek> What the fuck
<FromGitter> <grkek> is this a global thing?
<FromGitter> <bararchy> you got some shard or class that does `SomeIO < IO ` and implements `write`
<FromGitter> <bararchy> nah, just being discussed
<FromGitter> <grkek> I got the to_json
<FromGitter> <grkek> method
<FromGitter> <grkek> how did you guys miss this?
<FromGitter> <grkek> Now I have to go and change the type for everything
<FromGitter> <grkek> because of this my framework was removed from the benchmarker lmao
<FromGitter> <bararchy> it's being handled, it's not a bug, it's a breaking change that was introduced in 0.35.0, where `write` returns `Int64` instead of `Int64?`
<FromGitter> <bararchy> 1) 35.1 will revert that
<FromGitter> <grkek> Who thought it would be a good idea to do that?
<FromGitter> <grkek> to change the type of the IO function
<FromGitter> <bararchy> The core team apparently
<FromGitter> <grkek> the main one especially
<FromGitter> <bararchy> as they changed it XD
<FromGitter> <grkek> Jesus man instead of accepting my PR for the request method rfc for the HTTP 1.1 they are doing this
<FromGitter> <bararchy> request method RFC?
<FromGitter> <bararchy> anyone, I was in your situation a few days ago, I needed to PR to two shards, and monkeypatch stuff , that's what happens when using a pre-1.0 program I guess.
<FromGitter> <bararchy> still prefer Crystal over anything else hahahah
<FromGitter> <grkek> For an OOP language Crystal is the best
<FromGitter> <grkek> by far to me
<jhass> well there has been a lot of discussion there and you don't seem to have moved one inch from your initial proposal :)
<jhass> also never added even a spec
<raz> they (the overlords) should release 0.35.1 sometime tho, so we can unfix our shards :)
_ht has quit [Ping timeout: 240 seconds]
ua_ has quit [Ping timeout: 260 seconds]
<raz> not sure how widely the Int64 issue (and the plan to roll it back) are known, but i imagine quite a few shard authors are working on updates for 0.35.0 right now which they'll then have to revert
<FromGitter> <grkek> It doesn't require a spec
<FromGitter> <grkek> it returns a 400 if the method is incorrect
<FromGitter> <grkek> why would one spec that?
_ht has joined #crystal-lang
<FromGitter> <xmonader> i'm trying to build a binary and link against libssh2 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee8851e30401c1f245cc169]
<FromGitter> <bararchy> do you have a static libssh i?
<FromGitter> <bararchy> you need to install that
<FromGitter> <xmonader> nope i only installed libssh2, libssh2-dev
<FromGitter> <xmonader> but after installing the static one it builds!! nice thank you
<FromGitter> <bararchy> @grkek i'm against TBH, i'm fine with stdlib being permissive about that.
<FromGitter> <bararchy> np @xmonader , let's see if it runs without Invalid mem access ;)
<FromGitter> <bararchy> what's your usecase for for static libs
ua_ has joined #crystal-lang
<FromGitter> <xmonader> @bararchy I hope so, well I've a small DO machine that I can't build binaries on, so I build locally on alpine and push the static binary to the ubuntu machine, so far it worked without problem. I hate the fact I've to build on alpine, but it is what it is :(
<FromGitter> <bararchy> DO?
<jhass> digitalocean
<raz> grkek: because we want to know when it stops returning 400 if the method is incorrect for some reason </cpt-obvious>
<FromGitter> <bararchy> got you
mps has joined #crystal-lang
<FromGitter> <xmonader> okay i've problem figuring out the stacktrace, it shows nothing related to my code? ⏎ ⏎ https://pastebin.com/WcyqaiDu
<FromGitter> <naqvis> you are using some shard(s) which haven't been upgraded for 0.35.0
<FromGitter> <naqvis> 1) 35.0 does comes with few breaking changes
<FromGitter> <bararchy> @xmonader same issue @grkek is having
<FromGitter> <bararchy> what shards do you use?
<FromGitter> <xmonader> @bararchy ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee8997924a3382d5d6d54bd]
<FromGitter> <xmonader> @straight-shoota I tried going back to a previous commit ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee89b7e7a7f8d2d633aa8d1]
<FromGitter> <xmonader> damn i can't even build kemal hello world ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee89ee97c64f31f1163c0fa]
<FromGitter> <Daniel-Worrall> Gzip is under compress now
<FromGitter> <Daniel-Worrall> Details in release notes
<FromGitter> <Daniel-Worrall> Kemal will need the latest commit hash
<FromGitter> <xmonader> yeah i guess i'll have to stick with 0.34 for now :(
postmodern has quit [Quit: Leaving]
<FromGitter> <xmonader> @straight-shoota fyi i think it's probably crinja ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee8a6cbee693d6eb3c99b23]
<FromGitter> <bararchy> @xmonader just use ⏎ ⏎ ```kemal: ⏎ github: kemalcr/kemal ⏎ branch: master ⏎ ``` [https://gitter.im/crystal-lang/crystal?at=5ee8a7aaee693d6eb3c99de7]
<FromGitter> <Daniel-Worrall> `commit: a8c0f09b858162bd13c96663febef5527b322a32`
<FromGitter> <Daniel-Worrall> `branch: master` isn't good practice
<FromGitter> <bararchy> living on the edge is all the rage
<FromGitter> <xmonader> > `commit: a8c0f09b858162bd13c96663febef5527b322a32` ⏎ ⏎ would have been better if i use tags instead for sure
<sorcus> https://gist.github.com/MrSorcus/e6d75f0782f61bcde4406776577220fc - mmm, why Ameba doesn't like an `unless`?
<sorcus> Ah, seems that Ameba warn about this only when `unless-else` used.
<FromGitter> <rishavs> Would anyone know the apt command to downgrade crystal to 0.34.0? ⏎ I tried ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee8b2c449260560aa63dafd]
sorcus has quit [Ping timeout: 256 seconds]
_ht has quit [Quit: _ht]
<raz> apt is iffy with downgrades
<raz> i've found asdf most useful to manage crystal/ruby/node/etc. versions
<raz> (one-time setup and then just-works for me)
_ht has joined #crystal-lang
<FromGitter> <confact> How do I change a float to a string only showing 1-2 decimals? Say 1.4444 show `"1.44"` as a string
rocx1 has joined #crystal-lang
rocx has quit [Remote host closed the connection]
rocx1 is now known as rocx
rocx1 has joined #crystal-lang
rocx has quit [Ping timeout: 260 seconds]
rocx1 is now known as rocx
<FromGitter> <rishavs> Thanks @raz. Gonna try asdf
<jhass> >> "%.2f" % 1.44
<DeBot> jhass: # => "1.44" - https://carc.in/#/r/9a41
<jhass> confact: ^
<FromGitter> <confact> jhazz: I found humanize and felt a bit stupid so I removed the message on Gitter. But didn't know that works as well, small hack! Thanks!
<jhass> >> 1.444.format(decimal_places: 2) # third way
<DeBot> jhass: # => "1.44" - https://carc.in/#/r/9a42
jetpack_joe has quit [Ping timeout: 256 seconds]
jetpack_joe has joined #crystal-lang
<FromGitter> <watzon> @rishavs just use asdf or something
<FromGitter> <watzon> > Thanks @raz. Gonna try asdf
<FromGitter> <bararchy> hi @baelter thanks for the AMQ client updates :)
<FromGitter> <trans> I'm using JSON Serializable. One of my fields is just a large chunk of static JSON, it never changes. How do I handle that? I figure I make the property type JSON::Any, but how do set the property in code?
<FromGitter> <Blacksmoke16> ideally probably define more types to represent it?
<FromGitter> <j8r> jhass do we create a new issue for ⏎ ⏎ ```array = uninitialized Int32[4096] ⏎ 4096.times do |i| ⏎ array.to_unsafe[i] = 0 ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ee8e21529d8bc28f9fd6e07]
<FromGitter> <j8r> because the PR I created will close the existing one
<jhass> I guess
<FromGitter> <watzon> @j8r so you figured out a fix?
<FromGitter> <j8r> yes, a for macro
<FromGitter> <watzon> Seems like even zig hasn't figured it out. They set a soft limit at 1000 branches, which can be increased, but can cause exactly the same issue to happen.
Elouin has joined #crystal-lang
sorcus has joined #crystal-lang
<FromGitter> <watzon> So with `-Dpreview_mt`, using `spawn` causes the fiber to execute in any of the available threads right? Unless you use `same_thread: true`?
<raz> that's how i understood it (only from reading the docs tho)
<FromGitter> <Nicolab> I'm not sure about the order of the return values of a method. Since I often ask myself this question, I wonder if there is a convention in Crystal (a habit maybe). ⏎ ⏎ ```value, ok = check(raw_value)``` [https://gitter.im/crystal-lang/crystal?at=5ee8e8ff49260560aa64791a]
<FromGitter> <Blacksmoke16> what does that do?
<FromGitter> <Blacksmoke16> raise an exception, or just return `nil` if the value isnt right
<FromGitter> <watzon> Yeah that's golang thinking right there
<FromGitter> <Nicolab> `ok` is a bool if the check is ok
<FromGitter> <Blacksmoke16> why, this isnt go :P
<FromGitter> <Nicolab> yes in Golang ok is right and Elixir is left
<FromGitter> <Blacksmoke16> in crystal you dont need two variables in the first place
<FromGitter> <watzon> What he's saying is to do this instead. `value = check(raw_value) rescue nil`, and have the `check` method just raise an exception if the check fails.
<FromGitter> <watzon> Or just have it return nil in the first place
<FromGitter> <Nicolab> I prefer to avoid the exception or to play on the nil value because it can be nillable.
<FromGitter> <ilourt> The problem with returning nil is that it doesn't tell if there was an error in the check in the case of the value being nillable
<FromGitter> <watzon> Yeah that's where raising comes in
<FromGitter> <watzon> Instead just rescue and do something if it fails then
<FromGitter> <watzon> That's the crystal convention
<FromGitter> <ilourt> I thought ther was performance impact with exception
<FromGitter> <Blacksmoke16> everything isnt about performance
<FromGitter> <watzon> Small, because of stack unwinding
<FromGitter> <Blacksmoke16> depends on the context of how its being used
<FromGitter> <Blacksmoke16> of which approach is best
<FromGitter> <Blacksmoke16> for*
<FromGitter> <j8r> I think exceptions should only be used for unexpected errors
<FromGitter> <didactic-drunk> Are exceptions frequent? If not don't worry about performance.
<FromGitter> <j8r> not "normal" ones
<FromGitter> <j8r> for example 400 errors
<FromGitter> <j8r> (in a web context)
<FromGitter> <Nicolab> Indeed!
<FromGitter> <Nicolab> @j8r
<FromGitter> <Blacksmoke16> oh boy, not this again :S
<FromGitter> <j8r> It would also easier to DOS if rendering a 400 use exceptions
<FromGitter> <j8r> lol sometimes sites are slower to render 404 than 200 :)
<FromGitter> <ilourt> For me the problem with exception is when you used an external lib you don't always know if it raises exceptions. The can lead to runtime error
<FromGitter> <j8r> that's right
<FromGitter> <Nicolab> or for some libs to have granularity in error recovery.
<FromGitter> <j8r> another option is to `yield`, and handle inside the block
<FromGitter> <Blacksmoke16> would help with that
<FromGitter> <j8r> the stdlib does this for `fetch` https://crystal-lang.org/api/master/Hash.html#fetch(key,&)-instance-method
<FromGitter> <j8r> @ilourt that's very true
<FromGitter> <j8r> So options are using yield for simple cases, like `this method yields if X not found` ⏎ And the other is using Union types, like `SucessValue | SomeError`
<FromGitter> <j8r> note with yield, we can also yield some information too
<FromGitter> <Blacksmoke16> im just not convinced of the union type stuff. that just seems like a lot of work just because "exceptions are slow"
<FromGitter> <Blacksmoke16> when you have an error handling framework essentially built into the language...
<FromGitter> <j8r> not really
<FromGitter> <j8r> They does not hold a lot of information too
<FromGitter> <Nicolab> Every tool for the right task, here an exception it's clear that is not necessary and implies a longer writing, less perf (for nothing, bad choice in my opinion). ⏎ ⏎ It's just to know if the check went well, a variable (bool) is enough
<FromGitter> <Nicolab> In my opinion :)
<FromGitter> <Blacksmoke16> are there cases where using exceptions affects performance? I think yes but for the average user do they need to worry about it? I dont think so
<FromGitter> <j8r> But, is it really an error at the end?
<FromGitter> <j8r> If not, using unions makes perfectly sense
<FromGitter> <naqvis> unions meh.....
<FromGitter> <j8r> @Nicolab what's the use case?
<FromGitter> <j8r> yours I mean
<FromGitter> <naqvis> then on receiving side, you keep doing the case to see what you got :)
<FromGitter> <Blacksmoke16> depends on how you look at it, but yes it is an error given the application cannot continue
<FromGitter> <Nicolab> a bool is better than a class and the mechanics (begin, rescue, ...)
<FromGitter> <naqvis> better go with tuple instead
<FromGitter> <Nicolab> for this case
<FromGitter> <j8r> All of this depends of the very use case, what's yours?
<FromGitter> <Nicolab> @j8r sorry, my use case is to validate data like an user input:
<FromGitter> <Blacksmoke16> in a request context or?
<FromGitter> <Blacksmoke16> like a cli
<FromGitter> <Nicolab> the function `check` cast and check the data validity
<FromGitter> <Nicolab> in an API REST (in the controller), sometime in a CLI why not
<FromGitter> <Nicolab> but in a CLI, indeed an exception is good
<FromGitter> <Blacksmoke16> cli you could prob just `abort "Invalid value ..."`
<FromGitter> <j8r> what happens when the input is correct?
<FromGitter> <j8r> and what happens when not?
<FromGitter> <Nicolab> yes gooe @Blacksmoke16
<FromGitter> <Blacksmoke16> i still like exceptions for the request context tho
<FromGitter> <Nicolab> @j8r if ok, I continue the logic (save in a DB or a file or returns a response)
<FromGitter> <j8r> I think using yield is good, then you can have `abort` inside or a `return` for the Rest API
<FromGitter> <Nicolab> if not ok, I send an error to the user
<FromGitter> <j8r> using yield looks good in this case
<yxhuvud> blacksmoke: Keep exceptions exceptional and performance should not be a problem. But avoid them for common stuff.
<FromGitter> <j8r> simple, efficient :)
<FromGitter> <j8r> exception be exceptional, yxhuvud is 100% right!
<FromGitter> <Blacksmoke16> i have them mapped to HTTP errors
<FromGitter> <Nicolab> ok @j8r I thinking for the yield
<FromGitter> <Blacksmoke16> so you raise once, and request is over
<FromGitter> <Nicolab> @j8r for this case only a variable, is simple, so good
<FromGitter> <Nicolab> so, `ok, value` like Elixir or `value, ok` like Go. But in Go it's because the `ok` is optional
<FromGitter> <ilourt> @Blacksmoke16 I think when the check fail it probably doesn't mean that the request is over. There maybe other stuff to do buffer stoping the request
<FromGitter> <didactic-drunk> Unless you need more than 450k exceptions/second and aren't doing any other work don't worry about performance. ⏎ ⏎ Benchmark: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee8eebfa85de30394190aa0]
<FromGitter> <Nicolab> @didactic-drunk + 1000, thanks
<FromGitter> <Blacksmoke16> @ilourt right, the exception signals an early exit. But before that actually happens it could be rescued, or ignored etc depending on the context
<FromGitter> <Blacksmoke16> all of which is built into the languuage
<FromGitter> <Blacksmoke16> and as @didactic-drunk showed its slower yes, but probably nothing you/the average user needs to worry about
<FromGitter> <j8r> @Nicolab having ⏎ ⏎ ```somecheck do |error_message| ⏎ ... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ee8ef875dcbb760b6f2a722]
<FromGitter> <j8r> performance is not a reason to abuse exceptions
<FromGitter> <Blacksmoke16> i dont think im abusing anything
<FromGitter> <j8r> if other means are convenient, better using them
<FromGitter> <j8r> in this case I think exception is not necessary at all
<FromGitter> <j8r> it is a very simple case
<FromGitter> <Nicolab> @j8r thanks but after the check maybe boring to handle this. It's only for assigned à `bool`
<FromGitter> <Blacksmoke16> yea im not disagreeing with that
<FromGitter> <Nicolab> I think the simple is better
<FromGitter> <j8r> @Nicolab you only need a bool, input correct or not, that's it?
<FromGitter> <eliasjpr> Is it a known bug that Time::Span cannot be serialized to json when `include JSON::Serializable`?
<FromGitter> <eliasjpr> See https://play.crystal-lang.org/#/r/9a4t
<FromGitter> <Nicolab> @j8r the error message is handled otherwhere
<FromGitter> <Blacksmoke16> how would that work @eliasjpr ?
<FromGitter> <eliasjpr> I am why would not work?
<FromGitter> <Blacksmoke16> is there a way to actually represent that in JSON?
<FromGitter> <j8r> then bool is good
<FromGitter> <Blacksmoke16> since its like a range
<FromGitter> <j8r> another option was something like `: SomeType?`
<FromGitter> <Nicolab> @j8r my example was to simplify. In reality, it's more like: check(validation, data)
<FromGitter> <Nicolab> @j8r validation instance contain the error messages
<FromGitter> <eliasjpr> @Blacksmoke16 serializing it is simple a representation right. So `5.minutes` could be represented as `{ interval: 1, unit: "minutes"}`
<FromGitter> <Blacksmoke16> maybe make an issue for it?
<FromGitter> <eliasjpr> Or even better `5.minutes` equals to a json `{minutes: 5}`
<FromGitter> <Blacksmoke16> a more spec compliant solution maybe
<FromGitter> <Blacksmoke16> er the `Duration` section above it
<FromGitter> <eliasjpr> So Time::Span has from_json and to_json but does not support serialization 😕
<FromGitter> <Blacksmoke16> it just has those since it inherits from `Object` afaik
<FromGitter> <Blacksmoke16> doesnt actually mean its implemented
<FromGitter> <Nicolab> @j8r, @Blacksmoke16 Actually, I'm not looking for another option (except with a real benefice), but in this case I need simplicity. But I'm very interested in your opinion on: `ok, value = check` or `value, ok = check`.
<FromGitter> <Blacksmoke16> flip a coin and pick one
<FromGitter> <Blacksmoke16> doesnt really matter
<FromGitter> <Nicolab> ok ....
<FromGitter> <Nicolab> yhnaks
<FromGitter> <Nicolab> thanks
<FromGitter> <eliasjpr> @Blacksmoke16 those methods work, tests exists for those methods
<FromGitter> <eliasjpr> In the context of Time::Span
<FromGitter> <Blacksmoke16> id lean towards `value, ok ...` @Nicolab ^
<FromGitter> <Blacksmoke16> gives you the option of doing `value, _` if you want to ignore the ok value
<FromGitter> <Nicolab> indeed, also _, value ^^
<FromGitter> <Nicolab> so value, ok ⏎ Thanks for your opinion
<FromGitter> <Blacksmoke16> @eliasjpr are you sure?
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9a4u
<FromGitter> <j8r> @Nicolab why value?
<FromGitter> <j8r> is it needed both on ok and error?
<FromGitter> <eliasjpr> I was looking at an old PR from 2017 where tests existed
<FromGitter> <eliasjpr> @Blacksmoke16
<FromGitter> <Blacksmoke16> 👍 gotcha
<FromGitter> <Nicolab> @j8r the value cleaned by the check (e.g: strip on the string)
<FromGitter> <eliasjpr> For reference @Blacksmoke16 https://github.com/crystal-lang/crystal/pull/4446/files
<FromGitter> <Nicolab> @j8r also if email is an union, it's automatically casted to string
<FromGitter> <Blacksmoke16> ah yea, it wasn't merged
<FromGitter> <eliasjpr> @Blacksmoke16 thanks, I will try something else
<FromGitter> <j8r> @Nicolab I think it may better would to have a struct for this, which holds the value, and a `#valid?` method
<FromGitter> <j8r> like `record Input, value : String, valid : Bool`
<FromGitter> <Nicolab> already have that :)
<FromGitter> <j8r> ha ok
<FromGitter> <j8r> all's good then
<FromGitter> <eazee> hey all - sorry if i'm interrupting, just a quick one: ⏎ was just wondering whether this evaluates fine for others or not ⏎ ⏎ ```'2'.digit?``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5ee8f428ef5c1c28f02843d0]
<FromGitter> <Nicolab> @j8r `ok, value` or `value, ok`? :D
<FromGitter> <Blacksmoke16> can you share some code that causes the problem @eazee \
<FromGitter> <Blacksmoke16> you're probably looking at old docs
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/Char.html
<FromGitter> <Blacksmoke16> `'2'.ascii_number?` looks like its that now
<FromGitter> <eazee> ahh that makes a lot of sense
<FromGitter> <eazee> i must have had the wrong docs open haha
<FromGitter> <eazee> thanks so much, my bad
<FromGitter> <j8r> @Nicolab don't know, also why returning the value if invalid?
<FromGitter> <j8r> only the initial value matters
<FromGitter> <Nicolab> value is nil if invalid
<FromGitter> <j8r> I'd just have `check : Value?`: ⏎ ⏎ 1) if ok, returns `Value` ⏎ 2) it not ok, returns `Nil` [https://gitter.im/crystal-lang/crystal?at=5ee8f5257b6da9126a9b6472]
<FromGitter> <Nicolab> in some case the value maybe nil
<FromGitter> <Nicolab> and valid
<FromGitter> <j8r> ha ok
<FromGitter> <Nicolab> example if a name is not provided in a hash
<FromGitter> <j8r> sorry, what was the issue with yield 😅 ?
<FromGitter> <Nicolab> useless
<FromGitter> <j8r> the value is not needed on invalid input, right?
<FromGitter> <Nicolab> yes but the code may continue in some case and in more long to write
<FromGitter> <j8r> ok, so tuple make sense
<FromGitter> <j8r> I'd use the order when I first need the variable
<FromGitter> <Nicolab> ```ok, value = somecheck``` [https://gitter.im/crystal-lang/crystal?at=5ee8f6045dcbb760b6f2b8ef]
<FromGitter> <j8r> right
<FromGitter> <Blacksmoke16> assuming you need the `ok` value later tho?
<FromGitter> <j8r> he needs it, because `Nil` can be valid
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Nicolab> yes
<FromGitter> <naqvis> @Nicolab go with go style `value, ok = somecheck`, and if you don't care for `ok` just use `_` to silent that :P
<FromGitter> <Nicolab> Thanks Ali!
<FromGitter> <naqvis> 👍
<FromGitter> <ImAHopelessDev_gitlab> good morning
<FromGitter> <naqvis> good late mid-night Girng :P
<FromGitter> <ImAHopelessDev_gitlab> :D
<FromGitter> <ImAHopelessDev_gitlab> today is my last day off
<FromGitter> <ImAHopelessDev_gitlab> more crystal time to code, then work week :/
<FromGitter> <ImAHopelessDev_gitlab> i can code on the work week, but it's harder bcz i'm a bit more tired
<FromGitter> <naqvis> then you should make full-use of your free-time to code more and more Crystal
<raz> one shard a day keeps the doctor away!
<raz> (or the boredom at least, but i think those are related)
<FromGitter> <ImAHopelessDev_gitlab> oh yeah. one thing that helps a lot is a task list. i usually just randomly write code based on features that pop in an out of my head, but i feel like if i have a task on what to do, i can stay more focused and not drift away
<raz> there you go! next shard: a todo-list app :D
<FromGitter> <naqvis> raz lol
<FromGitter> <ImAHopelessDev_gitlab> hahahah
<FromGitter> <naqvis> so Girng, i enroll myself as a beta tester for your todo-list app :D
<FromGitter> <ImAHopelessDev_gitlab> could be a quest system, where each task you complete rewards you with exp, progress bar animates and glitters. could have a "Dev Lvl". might incentivize developers to click on "task complete" for a rich little ui experience, but i doubt it. i just write "DONE" in my notepad file
<FromGitter> <ImAHopelessDev_gitlab> rofl no idea what im talking about
<FromGitter> <naqvis> that sounds like an interesting thought
<FromGitter> <bararchy> @ImAHopelessDev_gitlab I'm still waiting on that game
<FromGitter> <ImAHopelessDev_gitlab> me too, bar. can't even work on it as much now cuz of my job it sucks
<FromGitter> <ImAHopelessDev_gitlab> but ima still hustle and work harder
<FromGitter> <bararchy> is there already some demo to feel? if i'm keeping track, it's been 3+ years :)
<FromGitter> <ImAHopelessDev_gitlab> yeah but need to setup vps and other stuff. i will shoot you a message to the installer for closed beta
<FromGitter> <ImAHopelessDev_gitlab> actually, if you are on linux, it will just be a .zip with `data.pck` and an `executable` and it will patch itself. thinking of windows :D
<FromGitter> <bararchy> "Windows"... what am I? a peasant?
<FromGitter> <bararchy> ;)
<FromGitter> <bararchy> <--- Arch ~master~ upper race
<FromGitter> <ImAHopelessDev_gitlab> :D :D
<FromGitter> <bararchy> btw is `ElasticSearchBackend` from the docs a real class or example/?
<FromGitter> <bararchy> For logs
<FromGitter> <Blacksmoke16> prob example, i dont see that type in the api docs
<FromGitter> <bararchy> but... I want that
<FromGitter> <bararchy> :(
<FromGitter> <ImAHopelessDev_gitlab> ElasticSearch what's dat
<FromGitter> <bararchy> "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java"
<FromGitter> <ImAHopelessDev_gitlab> you had me at java
<FromGitter> <ImAHopelessDev_gitlab> 😂😂😂😂😂
<FromGitter> <bararchy> Basically a text based datalake that is searchable
<FromGitter> <ImAHopelessDev_gitlab> sounds like something ctrl+f can do
<FromGitter> <bararchy> ahahahah "at scale" is the word here
<FromGitter> <ImAHopelessDev_gitlab> java web scale baby
<FromGitter> <ImAHopelessDev_gitlab> :DDDDDDDD
<FromGitter> <Blacksmoke16> kibana makes it cool tho
<FromGitter> <bararchy> yeha power comes from the whole ELK stack
<mps> fyi, I upgraded today crystal to 0.35.0 for alpine linux, it is edge repositories now, only x86_64. tried again on aarch64 and it builds but compiling any program (simple helo.cr) crashes
<mps> are there any effort for making crystal again to work on aarch64/arm64
renich has joined #crystal-lang
postmodern has joined #crystal-lang
<FromGitter> <j8r> thanks mps :D
<FromGitter> <j8r> jhass is working on a aarch64 CI
<mps> j8r: nice to hear. hope we will have it before 1.0 release :)
<raz> mps: you should avoid 0.35 for another reason, too. (there's a change that will be rolled back in 0.35.1, so best wait for that)
<jhass> mps: if shipping it with patches is a possibility, #9401 and #9430 would be the main ones, #9422 fixes a spec and prevents users from using broken functionality
<DeBot> https://github.com/crystal-lang/crystal/pull/9401 (Disable LLVM Global Isel) | https://github.com/crystal-lang/crystal/pull/9430 (Fix C ABI for AArch64) | https://github.com/crystal-lang/crystal/pull/9422 (Fix VaList and disable va_arg for AArch64)
<mps> raz: np, when it is fixed we will upgrade it again. it will not first time that we upgrade to 0.X.1 to fix 0.X.0
<FromGitter> <wyhaines> Pretty sure that the only elasticsearch libraries are in shards, and not part of the core. I'm hard at work on a product that is being built largely in Crystal that will be using ElasticSearch, and there were only a few existing options that I could find for libraries.
<jhass> with those I get 100% passing specs on aarch64 alpine :)
<jhass> biggest issue is bootstrapping I guess, as you would need to cross compile
<raz> mps: yup, just if you see some obscure message related to "has to return Int64" then don't bother fixing it in your code. that's the breaking change that will be reverted
<jhass> since there's no official aarch64 binaries (yet)
<mps> jhass: I managed to build 0.35.0 with latest static build on alpine aarch64 (0.32.1 iirc)
<mps> we keep previous static builds here https://dev.alpinelinux.org/archive/crystal/
<jhass> oh, you already had, it just broke? :)
<jhass> I'll have to keep that in mind for bootstrapping archlinuxarm then :)
<mps> yes
<mps> build goes fine, but any program compiled with it crashes
<jhass> so yeah, maybe you can just ship the above patches :)
<mps> build of cristal, I mean
<jhass> maybe it's just that some LLVM update turned on global isel by default for aarch64
<mps> jhass: I tend to think that
<jhass> the C ABI one is pretty edge casy, only found it through a spec we have failing on it
<mps> I will try above patches and see
<jhass> the valist one.. idk how that was ever working for you, maybe you don't run specs?
<jhass> great :)
<jhass> keep me posted :)
<mps> yes, running specs it fails, ofc
<jhass> with those patches it should no longer :)
<mps> nice, will try later this night
<jhass> I mean I have a couple more patches to make it work in some docker setups, idk about your build env
<jhass> those were mostly due to PATH and IPv6 issues, nothing aarch64 specific
<mps> I build in lxc container, because our official builder are lxc
<mps> builders*
<jhass> I didn't realize you were already building for aarch64, getting alpine to do it was actually on my todolist after setting up CI :D
<mps> :)
<mps> here is bug report about problem with aarch64, when it stopped to work https://gitlab.alpinelinux.org/alpine/aports/-/issues/11017
<jhass> mmh, yeah that's most likely the global isel bug
<jhass> I actually got it patched in LLVM but it'll take awhile to appear
<jhass> and there doesn't seem any real disadvantge to disable it, it just their new fancy way of doing things they have old and tested ways for already
<jhass> I hope worksonarm approves us for a nice machine so we can run full CI on it (and more ARM architectures in the future)
<jhass> that should get us close to tier1 support for aarch64, it's actually in very good shape already
<mps> good to hear. I have access to (relatively) powerful arm64 and armv7 lxc containers, 128GB RAM and 64 cores
<mps> shared with some other alpine developers, but they are not too busy
<jhass> sounds like the packet/worksonarm stuff?
<mps> packet, our sponsor
<jhass> I tried an a1.xlarge and even that was a bit too slow for a full CI for us, so yeah we probably need one of those on our own
<jhass> yeah, that's worksonarm
<jhass> hah, timing, just got approved <4
<jhass> eh, <3
<mps> ah, I see
<mps> jhass: I hope I will have some results tomorrow with your patches. will inform you here or your mail if you prefer this
<jhass> I don't mind either way, got a bouncer here so will always see it. Thanks for trying! <3
<mps> ok
Stephie has joined #crystal-lang
<FromGitter> <rishavs> i just setup a new wsl instance and am unable to install crystal on it; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee92cf724a3382d5d6ee661]
_ht has quit [Quit: quit!]
<FromGitter> <rishavs> Manually adding the key also doesnt works; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ee92de630401c1f245e9a31]
<FromGitter> <watzon> Try using asdf
<FromGitter> <Daniel-Worrall> crenv is the way to go
<FromGitter> <watzon> That works too
<oprypin> @rishavs: i think people say that GPG servers are temporarily down in such cases
<FromGitter> <rishavs> I think this is the issue https://github.com/microsoft/WSL/issues/5125
<FromGitter> <rishavs> i installed ubuntu 20.04 which is not supported on wsl1
<FromGitter> <rishavs> because i must do stupid things, I have decided to fix this the hard way. I have just joined the windows insider program to get hold of the wsl2 preview. so i can run ubuntu 20.04 and then install crystal 0.35. So I can play with the turbolinks in lucky.
<FromGitter> <paulcsmith> I'm having quite a bit of trouble with getting the new log set up correctly. It seems that when calling `Log.builder.bind` with a source, severity and backend, it actually *appends* a new backend with a new level.
<FromGitter> <paulcsmith> I'm probably just doing something dumb, but I can't figure this out
<FromGitter> <paulcsmith> The basic use case is that I want to define a default: `Log.setup("*", :debug, some_backend)`, but I then want to reconfigure specific loggers: `Log.setup("foo.*", :info, different_backend)`. I can't find a way to do that
<FromGitter> <paulcsmith> Or maybe I'm just using setup wrong 🤔
jetpack_joe has quit [Ping timeout: 256 seconds]
jetpack_joe has joined #crystal-lang
FromGitter has quit [Ping timeout: 256 seconds]
deavmi_ has joined #crystal-lang
deavmi has quit [Ping timeout: 256 seconds]
return0e[m] has quit [*.net *.split]
ryanprior has quit [*.net *.split]
hamoko[m] has quit [*.net *.split]
jhass has quit [*.net *.split]
FromGitter has joined #crystal-lang
yxhuvud has quit [Ping timeout: 256 seconds]
yxhuvud has joined #crystal-lang
jhass has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
ryanprior has joined #crystal-lang
return0e[m] has joined #crystal-lang
hamoko[m] has joined #crystal-lang
return0e[m] has quit [*.net *.split]
ryanprior has quit [*.net *.split]
hamoko[m] has quit [*.net *.split]
jhass has quit [*.net *.split]
<FromGitter> <watzon> I had the same thing happen @paulcsmith, I think there's a bug
<FromGitter> <paulcsmith> Ok I'm glad its not just me. I've been going crazy for a few hours trying to figure out how to configure logging. I think the new API is also a bit confusing. I think we need an API that sets the severity and backend for the given source and nothing more. No appending or doing anything overly fancy. And a separate method for appending backends and doing all the fancy stuff if you want it. Right now it is
<FromGitter> ... really hard to debug and figure out how things will look like
<FromGitter> <paulcsmith> But that's just my opinion so maybe other people love the new changes :D
<FromGitter> <paulcsmith> I do like all the other log changes though ❤️
postmodern has quit [*.net *.split]
FromGitter has quit [*.net *.split]
yxhuvud has quit [*.net *.split]
beepdog has quit [*.net *.split]
badeball has quit [*.net *.split]
olbat[m] has quit [*.net *.split]
baweaver has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
Xeago has quit [*.net *.split]
mps has quit [*.net *.split]
mjblack has quit [*.net *.split]
justinmcp has quit [*.net *.split]
raz has quit [*.net *.split]
coderobe has quit [*.net *.split]
sagax has quit [*.net *.split]
sarmonsiill has quit [*.net *.split]
Elouin has quit [*.net *.split]
issyl0 has quit [*.net *.split]
deavmi_ has quit [*.net *.split]
Vexatos has quit [*.net *.split]
chachasmooth has quit [*.net *.split]
skrzyp has quit [*.net *.split]
MasterdonX has quit [*.net *.split]
csaba has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
Human_G33k has quit [*.net *.split]
twistedpixels has quit [*.net *.split]
asterite has quit [*.net *.split]
maxpowa has quit [*.net *.split]
DTZUZU has quit [*.net *.split]
iwq has quit [*.net *.split]
Nekka has quit [*.net *.split]
daemonwrangler has quit [*.net *.split]
Stephie has quit [*.net *.split]
repo has quit [*.net *.split]
Liothen has quit [*.net *.split]
melthelesbian has quit [*.net *.split]
livcd has quit [*.net *.split]
olbat has quit [*.net *.split]
wmoxam has quit [*.net *.split]
rocx has quit [*.net *.split]
oz has quit [*.net *.split]
bougyman has quit [*.net *.split]
snapcase has quit [*.net *.split]
go|dfish has quit [*.net *.split]
early has quit [*.net *.split]
dom96 has quit [*.net *.split]
robacarp has quit [*.net *.split]
davic has quit [*.net *.split]
jetpack_joe has quit [*.net *.split]
gangstacat has quit [*.net *.split]
DeBot has quit [*.net *.split]
lunarkitty has quit [*.net *.split]
Seich has quit [*.net *.split]
antoszka has quit [*.net *.split]
fifr has quit [*.net *.split]
renich has quit [*.net *.split]
Flipez has quit [*.net *.split]
f1refly has quit [*.net *.split]
bazaar has quit [*.net *.split]
commavir has quit [*.net *.split]
ua_ has quit [*.net *.split]
OvermindDL1 has quit [Ping timeout: 253 seconds]
sz0 has quit [Ping timeout: 260 seconds]
antoszka has joined #crystal-lang
davic has joined #crystal-lang
yxhuvud has joined #crystal-lang
badeball has joined #crystal-lang
FromGitter has joined #crystal-lang
dom96 has joined #crystal-lang
robacarp has joined #crystal-lang
early has joined #crystal-lang
go|dfish has joined #crystal-lang
sarmonsiill has joined #crystal-lang
issyl0 has joined #crystal-lang
sagax has joined #crystal-lang
coderobe has joined #crystal-lang
olbat[m] has joined #crystal-lang
Elouin has joined #crystal-lang
Human_G33k has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
chachasmooth has joined #crystal-lang
skrzyp has joined #crystal-lang
Vexatos has joined #crystal-lang
fifr has joined #crystal-lang
daemonwrangler has joined #crystal-lang
Nekka has joined #crystal-lang
iwq has joined #crystal-lang
deavmi_ has joined #crystal-lang
DTZUZU has joined #crystal-lang
asterite has joined #crystal-lang
MasterdonX has joined #crystal-lang
twistedpixels has joined #crystal-lang
maxpowa has joined #crystal-lang
lunarkitty has joined #crystal-lang
postmodern has joined #crystal-lang
raz has joined #crystal-lang
csaba has joined #crystal-lang
DeBot has joined #crystal-lang
Seich has joined #crystal-lang
gangstacat has joined #crystal-lang
justinmcp has joined #crystal-lang
ua_ has joined #crystal-lang
Xeago has joined #crystal-lang
mjblack has joined #crystal-lang
mps has joined #crystal-lang
baweaver has joined #crystal-lang
_whitelogger has joined #crystal-lang
sz0 has joined #crystal-lang
<FromGitter> <watzon> I tend to agree. I think it's headed in the right direction, but it would be nice to be able to just say *here's a source, here's a severity, now work*
commavir has joined #crystal-lang
* FromGitter * Blacksmoke16 misses the logging off by default thing
<FromGitter> <paulcsmith> Yeah that's a nice way to put it. No side effects
<FromGitter> <watzon> After updating to 0.35.0 I was seeing duplicate logs in one of my projects because I had two sources that overlapped.
<FromGitter> <paulcsmith> I'm seeing dups too and I don't know why. I think it is because of multiple backends but it is so hard to tell. Because each log has an `initial_level` and a `level` and each backend has a `level` too. So figuring out which one is the "real" one or how to remove backends or override them is quite challenging
dostoyevsky has joined #crystal-lang
dostoyevsky has quit [Client Quit]
dostoyevsky has joined #crystal-lang
ryanprior has joined #crystal-lang
return0e[m] has joined #crystal-lang
hamoko[m] has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#c41640f (master - Revert IO#write changes in 0.35.0 and let it return Nil (#9469)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/699106587
<DeBot> https://github.com/crystal-lang/crystal/pull/9469 (Revert IO#write changes in 0.35.0 and let it return Nil)
<FromGitter> <paulcsmith> So here's a big part of the problem. Calling setup clears all config for all loggers: https://github.com/crystal-lang/crystal/blob/3c48f311f98e95964d425abe23d2b353b7da07d1/src/log/setup.cr#L4
<FromGitter> <paulcsmith> This was unexpected, but at least helps me make sense of why the configuration was working strangely
<FromGitter> <paulcsmith> I might just monkey patch the log builder to allow it to set a backend (not append). Not sure how else to do it 🤷‍♂️
<FromGitter> <paulcsmith> If anyone is interested this is what I ended up doing: https://github.com/luckyframework/dexter/pull/35/files
<FromGitter> <paulcsmith> Monkey patches Log::Builder with a method that clears binding for just one given source. That way you can clear the bindings for the source, and add new bindings. Basically a roundabout way to set severity and backend without appending backends and/or clearing sources for other logs
<FromGitter> <paulcsmith> Will open up an issue with a new proposal for configuration since it seems I'm not the only one having a tough time with it 🚀
<FromGitter> <didactic-drunk> I'd like a way to change the severity at runtime and leave the backend alone.
<FromGitter> <paulcsmith> Yeah that’d be great. I have a hacky way to do that in dexter. You can see it in the PR above.
<FromGitter> <paulcsmith> But I think it’d be nice to have it built in to crystal :D