ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.36.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
<oprypin> they could very easily enforce immutable tags for published actions, but no
sagax has quit [Ping timeout: 256 seconds]
<FromGitter> <oprypin:matrix.org> @mattrberry: so do you like my pull request with gh-actions? you can just push something to a branch and see if it works well there. right now it exposes the error on mac that previously @ watzon had to tell you about (and you said is already fixed)
<raz> yeh actions are pretty half-baked still.
<FromGitter> <asterite> Dan Simpson: if the subclass doesn't implement the method the compiler will tell you when you try to call that method. You can say in the docs which methods needs to be defined and how
<FromGitter> <mattrberry> @oprypin Yeah thanks for submitting that! Only had a chance to skim it so far, but looks helpful! I haven’t pushed the changes to fix the Mac issue yet since I was going to push all of the Mac fixes together when I can figure out why the shaders still aren’t compiling. Thanks for the PR!
postmodern_ has joined #crystal-lang
postmodern has quit [Remote host closed the connection]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
<FromGitter> <jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): in a way GHA is like shards: we can install & use third party modules, and change the tags freely
<FromGitter> <jrei:matrix.org> Another solution is to have GitHub warn us of the commit change
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
teardown has quit [Ping timeout: 268 seconds]
f1reflyylmao is now known as f1refly
entel has quit [Ping timeout: 256 seconds]
entel has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> oh yes it is like shards, you reminded me that i always used to say that it's a security hole too
<FromGitter> <oprypin:matrix.org> doesn't even bother putting a commit hash in shard.lock
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org)
teardown has joined #crystal-lang
_ht has joined #crystal-lang
<FromGitter> <mattrberry> @oprypin:matrix.org I just spent $25 to rent a mac mini for the month :p Here's what I'm seeing when trying to compile my shaders now.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6012704984e66b7f7eb64f9b]
<FromGitter> <mattrberry> Do you have any idea how to debug this? I know very little about OpenGL in general, let alone dealing with the finicky mac behavior..
<FromGitter> <mattrberry> Ooh, got it to build on my rented mac..
<FromGitter> <mattrberry> Now to see if it builds on my friend's machine..
<FromGitter> <mattrberry> *Speed* https://i.imgur.com/Qn9pV7S.png
<FromGitter> <mattrberry> CI is working great, thanks @oprypin:matrix.org :) https://github.com/mattrberry/crab/actions/runs/517387459
DTZUZU has quit [Ping timeout: 264 seconds]
DTZUZU has joined #crystal-lang
postmodern_ has quit [Quit: Leaving]
<FromGitter> <Dan-Do> Can someone explain what is wrong here https://carc.in/#/r/abo9
<FromGitter> <erdnaxeli:cervoi.se> nothing?
<FromGitter> <erdnaxeli:cervoi.se> what do you think is wrong?
<FromGitter> <erdnaxeli:cervoi.se> oh, the .0
<FromGitter> <erdnaxeli:cervoi.se> it works with a Float64
<FromGitter> <Daniel-Worrall> It doesnt have enough bits for the amount of accuracy
<FromGitter> <Dan-Do> Wow, just know that :)
<FromGitter> <asterite> Looks fine to me
<yxhuvud> And that is why you shouldn't use floats to represent currency.
<FromGitter> <Dan-Do> Then we should use double, right?
<FromGitter> <watzon> No, use standard integers for currency always
<straight-shoota> or bigdecimal
<FromGitter> <watzon> That would work as well
<FromGitter> <watzon> As a general rule of thumb though, it's easy to represent a monetary value like `$10.00` as `1000`
<straight-shoota> yeah. Unless you need to represent values smaller than the smallest nominal currency value
<FromGitter> <Dan-Do> Uhm, that needs more effort. Fair enough :)
<FromGitter> <watzon> Right. In which case you can always adjust things. You could potentially represent $10.00 as 100000 which would give you two extra places for fractions of a cent. The important thing is that you choose a method and stick to it.
<straight-shoota> It's probably not relevant here, but I don't think it's good advice. Either you have simple requirements and can just use integers with the number 1 representing the smallest nominal value (like 1 cent)
<straight-shoota> or you should really use bigdecimal because that gives you unlimited precision. Who knows if 100000 is good enough when at some point you need to represent smaller fractions?
<straight-shoota> But again, that's not a typical use case.
<FromGitter> <Dan-Do> The thing is there is not only crystal, I also have the UI part which uses javascript, and the database part...
<FromGitter> <erdnaxeli:cervoi.se> all need to correctly handles the precision you want
<raz> pass monetary values as strings to the clients. never perform math on them in there.
<raz> anything else will inevitably bite you, esp. when you deal with multiple currencies
<FromGitter> <Dan-Do> sounds complicated, huh :)
<straight-shoota> For represenation you may get away with 64-bits floating point if the values are in a small range.
<straight-shoota> But currency calculation with floating point arithmetics is a no-go
<straight-shoota> But, using string for representation is probably better. It especially prevents using the value in math operations.
<straight-shoota> Well, I guess not in JavaScript...
oddp has joined #crystal-lang
lanodan has quit [Quit: WeeChat 2.9]
<FromGitter> <watzon> Yeah if you're dealing with JavaScript definitely use integers, provided you don't need fractions of a cent
<FromGitter> <watzon> Floats will always, always bite you in the ass
<straight-shoota> but that's not restricted to JS ^
<FromGitter> <watzon> No, but JavaScript doesn't have arbitrary precision integers like Crystal so Integers would be their best bet
richbridger has joined #crystal-lang
<FromGitter> <watzon> I should say arbitrary precision decimals, like BigDecimal
<FromGitter> <watzon> Though there's probably a library somewhere out there
<FromGitter> <watzon> Go figure https://github.com/MikeMcl/decimal.js/
<FromGitter> <Dan-Do> 👍
<raz> watzon: javascript does not have integers
<FromGitter> <watzon> Well "numbers". The idea is to keep decimals out of it.
<raz> yea well, that's the problem. the moment you do anything with the values, js screws them up. how critical that is ofc depends on the use-case, but most people don't like rounding errors and precision lapses when money is involved ;)
<FromGitter> <watzon> Yeah for sure. Losing a cent here and overcharging a cent there can really add up in the end.
<raz> yup, you generally also don't want two different decimal libraries to interpret the values. https://github.com/rails/rails/issues/24235
<raz> it is doable ofc, but plenty footguns that are not immediately obvious
sagax has joined #crystal-lang
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
alexherbo2 has joined #crystal-lang
oddp has quit [Remote host closed the connection]
oddp has joined #crystal-lang
<FromGitter> <Blacksmoke16> WIP draft of the new config docs/setup if you have any thoughts
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 264 seconds]
deavmi has joined #crystal-lang
avane has quit [Ping timeout: 264 seconds]
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
avane has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 265 seconds]
avane has quit [Ping timeout: 240 seconds]
avane_ has joined #crystal-lang
avane_ is now known as avane
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 265 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<raz> blacksmoke: the custom annotation looks useful, for the rest i'll probably just stick to reading directly from env :)
<raz> (but looks like the rest can also be useful when someone wants to build an athena-plugin/extension)
postmodern has joined #crystal-lang
<FromGitter> <Blacksmoke16> raz: if you only have like 1 or 2 things its prob not that big of a deal to use them. But IMO parameters do provide quite a few benefits
<FromGitter> <Blacksmoke16> type saftey, reusability, centralized location, and custom methods/logic to name a few
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
hpyc9 has quit [Quit: 420]
hpyc9 has joined #crystal-lang
<sorcus> https://gist.github.com/MrSorcus/d9c8c81dda27abb885523dac4afc415b - why i get this `1110` and not this `0111`?
<sorcus> I guess it depends on big/little endian, but all articles says to use `N ^= (1 << k)`...
<sorcus> And no one word about endiannes...
_ht has quit [Remote host closed the connection]
<FromGitter> <gunn> Hey I've written a little server:
<FromGitter> <gunn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=601328049d5c644f66367061]
<FromGitter> <gunn> And it works great except it only handles requests sequentially, and those two system calls might take 15s to run
<FromGitter> <Blacksmoke16> pretty sure http requests are handed in their own fibers, so it should be switch to other fibers while waiting
<FromGitter> <gunn> Is there a way to serve multiple requests at once?
<FromGitter> <Blacksmoke16> fwiw doing something like this would be better
<FromGitter> <Blacksmoke16> ```File.open(text_path) do |file| ⏎ IO.copy context.response, file ⏎ end``` ⏎ ⏎ this way you're not loading the whole file into memory (if its big) [https://gitter.im/crystal-lang/crystal?at=601328b31ed88c58d806af42]
<FromGitter> <Blacksmoke16> er sorry, `IO.copy file, context.response`
<FromGitter> <gunn> Okay, I'll do that
<FromGitter> <gunn> I don't think that's my main bottleneck though, I think that will be a fraction of a second vs. 10-20s for those system calls
<FromGitter> <gunn> I'm very new to crystal btw
<FromGitter> <gunn> Is there a way to write the system calls so that crystal knows it's a good time to switch fibers?
<FromGitter> <Blacksmoke16> i guess do they need to be system calls?
<FromGitter> <Blacksmoke16> could prob do the curl request via an `HTTP::Client`
r0bby has quit [Ping timeout: 264 seconds]
<FromGitter> <gunn> Yes, I could definitely replace that
r0bby has joined #crystal-lang
HumanG33k has quit [Quit: Leaving]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <Blacksmoke16> id try to rule out that its actually the `system` call thats doing it. I.e. add sleeps
<FromGitter> <gunn> Yes
<FromGitter> <Blacksmoke16> iirc this came up before and it was something related to what chrome was doing (assuming you were calling the endpoint from 2 tabs)
<FromGitter> <gunn> Okay, I'll test with curl then
<FromGitter> <Blacksmoke16> if one fiber blocks then it should continue to process other requests
<FromGitter> <Blacksmoke16> i know that for sure
sagax has quit [Remote host closed the connection]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang