<FromGitter>
<Blacksmoke16> Try on 0.35.0 and report it if it still happens
<FromGitter>
<wyhaines> OK. I was concerned about 0.35.0 breaking a bunch of other stuff in the app. :) I guess I'll go find out how bad the carnage is.
<FromGitter>
<wyhaines> If appears to have been very limited carnage.
<FromGitter>
<wyhaines> Just a moment while the compile finishes.
<FromGitter>
<wyhaines> It still occurs.
<FromGitter>
<watzon> Is it normal for compilation to choke out at 1.5GB of RAM usage?
<FromGitter>
<watzon> Oh nvm, didn't happen this time. Just took like 20x as long to build in release mode.
<FromGitter>
<wyhaines> I caused the bug while I was trying to debug a functional problem in my app by adding a line to specifically enqueue a fiber that was waiting on a channel. I think, having dug through the crystal code a bit, that I grok how that was goofing things up.
<FromGitter>
<watzon> Is there anything built in to Crystal to check if a String contains invalid utf8 byte sequences?
<FromGitter>
<watzon> Aha! `String#scrub`
<FromGitter>
<Daniel-Worrall> Are there any crystal codegen shards? Or maybe I can use something from the compiler
<FromGitter>
<Daniel-Worrall> I want to generate crystal code
<FromGitter>
<jwaldrip> What is the use case?
<FromGitter>
<jwaldrip> Do structs get garbage collected?
<FromGitter>
<rishavs> You woke an eldritch horror
<FromGitter>
<wyhaines> @jwaldrip A struct is allocated on the stack, and not on the heap. So they automatically get cleaned up when stack context unwinds. That's why they get passed by value instead of by reference into other methods. If structA is passed into a method and stashed into some variable where it's going to hang around, that variable can't be pointing to some chunk of memory on the stack for the original content,
<FromGitter>
... because when the context in which the original struct was created goes away, that piece of memory will, too. ⏎ ⏎ So, structs don't get garbage collected the way heap memory does, but they do go away. ⏎ ⏎ You should be able to allocate as many as you want. Just be aware that because they are passed by value, they don't work th ... [https://gitter.im/crystal-lang/crystal?at=5eeafc3fa813c72dcff58b93]
<FromGitter>
<wyhaines> @rishavs After digging into the code a bit, it's clear enough to me how I woke that horror. I need to think about what *should* happen there, instead of the "Bug" message, but I get why it happened.
rocx has quit [Ping timeout: 260 seconds]
rocx has joined #crystal-lang
<jhass>
mps: hah, very weird. How did you figure that out even? :D
<FromGitter>
<rishavs> btw, can one embed/ call one ECR from within another? For example, one ECR has the full HTML. Another has a button. Can I embed the 2nd in the 1st?
<mps>
jhass: if I pretend to be smart I would say by intuition, but it was trial end error
<jhass>
best way :)
<mps>
though some intuition is used, I feel :)
<mps>
few trials with errors (failed build), and then looking at you patch
<sorcus>
Why i get this `Unhandled exception: Arithmetic overflow (OverflowError)`?
<sorcus>
Size of buffer (IO::Memory) less than 512MiB, but if whole program (without buffer, buffer still usage less than 512MiB) use more than 2GiB, it's failed... %-)
deavmi has quit [Quit: Eish! Load shedding.]
<FromGitter>
<naqvis> \o
<FromGitter>
<naqvis> Crystal checks the Arithmetic overflow/underflow and raises when it find, primitive operation going to overflow/underflow
deavmi has joined #crystal-lang
<FromGitter>
<naqvis> you can use `&` infront of artimetic operator to take care of this
<sorcus>
Hmmm...
<FromGitter>
<naqvis> `crystal eval 'Int32::MAX + 1'` will raise exception
<FromGitter>
<naqvis> remember `-2147483648` is `Int32::MIN`
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
<FromGitter>
<rishavs> Does crystal-pg have support for asynchronous connections?
deavmi has quit [Quit: Eish! Load shedding.]
postmodern has quit [Quit: Leaving]
deavmi has joined #crystal-lang
<sorcus>
naqvis: Maybe you know, why IO::Memory limited to Int32?
<FromGitter>
<naqvis> sorcus, I don't know the actual reason behind this, but I guess this decision might got its influence from other mainstream languages, where sizes are mostly restricted to Int32 (2G) or so.
<FromGitter>
<naqvis> sorcus: can you please explain your use-case and how you getting impacted by this restriction? community here might be able to help you provide some thoughts
<sorcus>
naqvis: This restriction is not a critical. Only affected for large buffers (1GiB+).
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<wyhaines> @sorcus, if you really need buffers bigger than 2G, it isn't hard to grab the source for IO::Memory, and make it use Int64 instead of Int32 for all of the size/capacity relevant bits. You can monkeypatch IO::Memory or just use that to create an IO::Memory64 or something.
<frojnd>
What should I do? I parse a page which uses šč symbols and when I puts it I get: `\x9A`
oddp has quit [Read error: Connection reset by peer]
oddp has joined #crystal-lang
<frojnd>
Does crystal have force_encoding similar to ruby's method?
<frojnd>
That I can manipulate string
<FromGitter>
<wyhaines> @sorcus Yeah, I did it as a quick test before commenting. It took 10 minutes to take a pass through the code, switch to Int64, and deal with the compiler warnings. My really really simple test program worked, so....seemed viable, at least in the shorter term.
<frojnd>
Ok it has encode
oddp has quit [Read error: Connection reset by peer]
<sorcus>
wyhainesЖ Ok, thanks you again, you are cool :-)
<frojnd>
Yeah no not helping
<frojnd>
Don't know how to replace `\x9A` with `š`
<ryanprior>
It took me a few hours of fiddling and killed momentum on one of my projects for a day when I couldn't static compile after adding readline dependency, so the troubleshooting docs are important to prevent the next person from having to deal with that =D
<ryanprior>
I assume everybody's very busy on Crystal 1.0 and of course that should be the priority! My PR is 22 lines in one file, no code changes, just relevant docs, so it will hopefully be a little snack-sized review for you. Thanks! 💖
<jhass>
best is if you place the binary into a clone of crystal at .build/crystal, then run make to rebuild crystal, then add the bin/crystal wrapper to PATH
<FromGitter>
<phykos> lemme try
<jhass>
wait, were you the manjaro one from yesterday?
<jhass>
I mean where would it get the bootstrap compiler from?
<FromGitter>
<Blacksmoke16> currently only `amd64` builds, since crystal isnt available on snap for the other architectures
<mps>
later I will push x86_64 version also, building it on my local x86 box take more time than on arm64
<jhass>
Manas has the hands over the release process, so they will need to engineer a release build for aarch64
<jhass>
then everything else can bootstrap from that
<FromGitter>
<Blacksmoke16> 👍
<jhass>
I can only push to Arch because stuff is more liberal there
<jhass>
like anybody can put anything in the AUR and if it's cared for enough some trusted user might put it to the community repo
<jhass>
and once there you have better standing in downstream stuff like ALARM
<jhass>
same for alpine, it's only there because mps cared enough to apply my patches and cross compile
<mps>
jhass: you can also do that for alpine, just create merge request on gitlab.alpinelinux.org and some will merge it sooner or later, if it works ofc
<mps>
someone*
<jhass>
:)
<jhass>
Basically I'm done with CI setup and just need to convince Manas to give me admin access to the repo in order to automate worker setup
<jhass>
then they can use that CI to engineer a release process for aarch64, if they care
<jhass>
but more importantly that should make sure we notice if we would break downstream bootstrapping such as the one in alpine and hopefully ALARM soon
<mps>
jhass: we have CI for 6 arches on gitlab.alpinelinux.org, whenever merge request created or updated CI build is triggered
<jhass>
yeah, we just really need something running on every PR, because tbh nobody tests their stuff on non-x86 atm ;)
<jhass>
and also I have -gnu builds on our own
<mps>
uhm, every PR would be considered as abuse on our CI, probably
<jhass>
definitely
<jhass>
don't worry, I got resources from packet, automated the setup in ansible, everythings ready
<jhass>
just lacking credentials
<jhass>
after this I might poke a bit at armhf, see if the packet server can emulate it fast enough for starters
<jhass>
then hopefully it's just patching up LFS support
<mps>
our armhf/armv7 builders on packet are fast
<mps>
I have impression that my armv7 lxc is fastest of all our builders
<jhass>
mmh, interesting
<jhass>
do you know what the machines are, is it c2.large.arm/Ampere EMags too?
<mps>
One is Ampere but for second I'm not sure what is it
<jhass>
mmh, but I guess the host os is using the corresponding arch too and you're not running lxc in qemu
<mps>
though I never looked what they are, for me is enough that they are fast and have plenty of RAM
<mps>
no, they are alpine on bare metal, and lxc and qemu on it
<jhass>
but alpine armv7 for the armv7 builders I guess
<jhass>
rather than emulating armv7 on aarch64
<mps>
iirc, Ampere can run arm32 fine
<mps>
both are 64bit, but I think we use one as 32bit
<mps>
I can ask details for you later when our 'arm master' appears online
<jhass>
well I'll see. I probably won't ask packet for a second machine for that anyways, so either emulation will be fast enough or it won't
<jhass>
trade off could be running just nightlies for the slow stuff
<FromGitter>
<phykos> command `patch` not found in crystal-git/PKGBUILD (line 40)
<FromGitter>
<phykos> guess I have to install it with pacman
<jhass>
ah yeah, you don't list base-devel stuff in makedepends :)
<jhass>
so pacman -S base-devel :)
<FromGitter>
<phykos> saw
oddp has joined #crystal-lang
rocx has joined #crystal-lang
HumanG33k has quit [Ping timeout: 258 seconds]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Max SendQ exceeded]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 258 seconds]
<frojnd>
I'm trying to replace all the `\n2`, `\n22`,... from the string. So I tried with my_string.sub("\n/\d/", "") but it only removes "\n"
<jhass>
Why the /?
<jhass>
also sub replaces only the first occurence
<jhass>
finall for regex, you need to surround in // not ""
<jhass>
*finally
<jhass>
oh and \d matches 2 but 22
<jhass>
if it were a regex that is
<frojnd>
jhass: Jeah I'm trying to match \n5
<frojnd>
With regex somehow
<jhass>
so .gsub(/\n\d+/, "")
<frojnd>
Thank you
<jhass>
yw
<frojnd>
So I forgot to escape \n and totaly wrong digit part
<frojnd>
No not espace but tell it that its' regex with /
<jhass>
yeah
<jhass>
and possibly .sub vs gsub
HumanG33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
<olbat>
Hello everyone. I'm working on a fix for one of my project that does not compile anymore with Crystal 0.35. I've checked the changelog but I can't see any breaking change in the release that can explain why it breaks. I've created a minimal snippet that reproduces the issue: https://carc.in/#/r/9al2 and here the same code with Crystal 0.34: https://carc.in/#/r/9al3 . Does anyone have an idea about where it might be coming from?
<FromGitter>
<dscottboggs_gitlab> You're still here!? Shit I thought you dipped out like a year ago. It's good to see you man. What are you working on these days?
<FromGitter>
<ImAHopelessDev_gitlab> @dscottboggs_gitlab nm just casually on my gameserver stuff when i get free time from working
<FromGitter>
<ImAHopelessDev_gitlab> good to see u as well
<FromGitter>
<dscottboggs_gitlab> well that's cool, how's that going?
<FromGitter>
<ImAHopelessDev_gitlab> i just am so accustomed to this OS, don't want to switch. i bet if i grew up on a linux os, i'd be like wtf is this windows crap. ⏎ ⏎ I JUST HATE change
<FromGitter>
<dscottboggs_gitlab> yeah. it took me a while to do the transition, and I can't imagine trying to do it now with the amount of time I have available for that sort of thing. But as a developer it's so much better of an experience now that I'm on the other side.
<FromGitter>
<ImAHopelessDev_gitlab> @dscottboggs_gitlab what OS do you use?
<FromGitter>
<ImAHopelessDev_gitlab> er, i mean distro
<FromGitter>
<dscottboggs_gitlab> Manjaro KDE on personal stuff, Ubuntu LTS at work
<FromGitter>
<ImAHopelessDev_gitlab> nice, i used linux mint on my crappy laptop before to fiddle around. never used linux on my main computer yet
<FromGitter>
<dscottboggs_gitlab> (sorry for linux-fanboy-posting, I'll stop now)
<FromGitter>
<dscottboggs_gitlab> > never used linux on my main computer yet ⏎ Yeah I'm not a fan of the dual-boot thing. VMs or translation layers (WINE/WSL) are the way to go for sure
<FromGitter>
<ImAHopelessDev_gitlab> interesting
<FromGitter>
<ImAHopelessDev_gitlab> do you know c quite well, @dscottboggs_gitlab ?
<FromGitter>
<dscottboggs_gitlab> yes
<FromGitter>
<dscottboggs_gitlab> I actually picked it up through Crystal
<FromGitter>
<ImAHopelessDev_gitlab> nice, i like c but definitely not as knowledgeable as i wish i could be
<FromGitter>
<ImAHopelessDev_gitlab> all i know is, c++ makes my head explode even more
<FromGitter>
<dscottboggs_gitlab> the syntax is not the friendliest but I found that by writing Crystal as though it were C and then translate from there I was able to get past that and learn a lot about it. ⏎ ⏎ C++ is insanely complicated, but also pretty nice. Idk my jury is still out on it haha
<FromGitter>
<ImAHopelessDev_gitlab> i've been watching this (https://www.youtube.com/watch?v=Ps8jOj7diA0) playlist, and it's the best lectures i've seen about c. it makes me want to say f it all and code my game and server in c, but i know that would be a total waste of time and just too late (future projects I do, that might be a thing though)
<FromGitter>
<Blacksmoke16> I feel like that would be a bad idea
<FromGitter>
<Blacksmoke16> There is no safety net like there is in crystal to save you
<FromGitter>
<ImAHopelessDev_gitlab> yeah for my current project and the scale, i'm not. but if i do a new project i think it's a good learning experience
<FromGitter>
<PercussiveElbow> I have an object with a bunch of properties and I'm supplying those as parameters when creating an ORM model object. The properties have the same names as the underlying model columns. Is there an easy way to insert all those properties without having to be very verbose with ModelName.create(a: object.a, b: object.b, c: object.c etc?
<FromGitter>
<PercussiveElbow> I'm thinking this might be possible through a macro but my brain is fried and I'm not sure if there's a less messy way of doing it.
<FromGitter>
<Blacksmoke16> Example?
<FromGitter>
<Blacksmoke16> Could create an overload of create