jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
sagax has quit [Quit: Konversation terminated!]
oddp has quit [Ping timeout: 240 seconds]
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #crystal-lang
baweaver has quit [Ping timeout: 272 seconds]
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 272 seconds]
alexherbo20 is now known as alexherbo2
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
yxhuvud has quit [Remote host closed the connection]
oddp has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.8]
sorcus has joined #crystal-lang
yxhuvud has joined #crystal-lang
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<f1refly> Can I get a statically linked crystal compiler somewhere or do I have to compile it myself? I'd like to submit a solution to a task at university in crystal, but I'd have to include the compiler myself, so a statically linked one would be very handy
duane has joined #crystal-lang
<jhass> f1refly: does crystal-0.35.1-1-linux-x86_64.tar.gz from https://github.com/crystal-lang/crystal/releases work for you?
<jhass> it's not statically linked but might work anyways
<f1refly> It doesn't work unfortunaltely, as the target system is not a dev system and is missing some linking utils
<jhass> well, a static build won't solve that
<f1refly> Hmmm
<jhass> can you instruct running a docker container perhaps?
<jhass> or installing a snap?
<f1refly> No, I've no control over that system
<f1refly> I might just do it in ruby
<jhass> yeah, sorry :(
<jhass> the compiler just shells out for the linking part
<f1refly> Can't have everything in this world I suppose
<f1refly> It's very sad that crystal isn't in the debian and ubuntu repos yet
<jhass> maybe you could submit a statically compiled binary of your program alongside the source code
<f1refly> I might've been able to tell the prof to install it with apt, but I doubt he'll do any custom repos or whatever you have to do to install with snap
<f1refly> the program has to be compiled on the testing machine to get any points, so no, that won't work
<FromGitter> <Blacksmoke16> isnt snap already included on ubuntu?
<jhass> yeah, it is
<FromGitter> <Blacksmoke16> `snap install crystal`
<FromGitter> <Blacksmoke16> er `sudo snap install crystal --classic`
<jhass> so for ubuntu that's that
<f1refly> It's a debian 4.9 machine
<jhass> the last crazy option I see is to ship an entire chroot :D
<FromGitter> <j8r> lol
<FromGitter> <Blacksmoke16> 😬
<f1refly> ayy
<FromGitter> <j8r> omg, that's not even a production machine
<jhass> or see if you can get https://github.com/intoli/exodus to package everything needed :D
<f1refly> "so just mount this disk image to some folder and chroot into it lol"
<f1refly> don't see anything wrong with that
<jhass> erm..
<jhass> "run it in this container by ..."
<jhass> mention container and it sounds cool and reasonable
<FromGitter> <Blacksmoke16> give him a usb with alpine on it and tell him to boot into it 😆
<jhass> but yeah, we are well into "easier to rewrite in Ruby" territory :D
<FromGitter> <j8r> in ruby 0.1-alpha
<FromGitter> <j8r> Or whatever old version in Debian 4.9 :3
<f1refly> exodus is hella cool
<f1refly> damn
<f1refly> gonna try that regardless of its usefulness
<jhass> mmh, I guess Ruby and debian actually have sorta the same age
<FromGitter> <ondreian> Hey there, recently something changed and I keep getting this error message in vscode's error message hud whenever I'm working on a crystal lang project: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I tried out `scry` as was suggested in that repo, but unfortunately that generates a lot more errors [https://gitter.im/crystal-lang/crystal?at=5f033c976c06cd1bf47803cf]
<FromGitter> <bararchy> What does that means? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I know I'm not actually OOM as I still have 13/32Gb free [https://gitter.im/crystal-lang/crystal?at=5f033d7dfa0c9221fc8163f9]
<FromGitter> <j8r> there is a max memory limit IIRC
<FromGitter> <j8r> how many the program did use in memory?
<yxhuvud> There is not a max memory limit, but the GC complains if you allocate too much at once
<FromGitter> <bararchy> well, it does say OOM and then crashes XD
<FromGitter> <bararchy> @j8r the program used around 3Gb
<FromGitter> <yxhuvud> out of memory can happen if you try to allocate a large contigous chunk too, though.
<jhass> @ondreian: What's your OS? How did you install Crystal? This error means Crystal cannot find its standard library in CRYSTAL_PATH. Does it work on a shell outside vscode? What's crystal env showing there?
<FromGitter> <ondreian> I'm on Debian, I installed using `apt`, crystal works outside of vscode: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f034135fa0c9221fc81709e]
<FromGitter> <RespiteSage> To add additional credence to @ondreian, this happens to me on the laptop I'm not currently on (similar setup, except Ubuntu).
<FromGitter> <RespiteSage> Maybe it's a bug with `/home/benjamin/`. :P
<FromGitter> <ondreian> here is package info: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0341ae6c06cd1bf478132a]
<FromGitter> <ondreian> Maybe started sometime within the past couple of weeks, at least for me.
<FromGitter> <ondreian> I don't touch this project every day, but it was fine the last time I touched one of my crystal projects
<FromGitter> <ondreian> a bug with `/home/benjamin` would be kind of funny 😂
<FromGitter> <jwaldrip> raz: you may want to try https://crystalshards.org instead.
<FromGitter> <jwaldrip> Or https://shardbox.org
<FromGitter> <jwaldrip> Or https://shards.info
<FromGitter> <jwaldrip> The legacy crystal shards is a very basic search layer on top of github. You will find the newer sites provide much more info.
alexherbo2 has quit [Ping timeout: 258 seconds]
<raz> yea i saw them and all they do is put more clicks between me and github
<jhass> ondrein: RespiteSage: So we changed a couple of things around CRYSTAL_PATH in 0.35/0.35.1, it might very well be related to that, probably changed some detail the vscode extension relied on, though I don't quite see why it would. Unfortunately I cannot debug as I have no such setup myself
<FromGitter> <RespiteSage> A'ight. I'll have to look at it soon on my other laptop to see if I can shed any light on it.
<FromGitter> <bararchy> ahh seems I'm making too many Fibers `Cannot allocate new fiber stack: Cannot allocate memory (RuntimeError)`
<FromGitter> <ondreian> Thanks for the idea on where to debug, greatly appreciate you narrowing the space there
FromGitter has quit [Ping timeout: 240 seconds]
oprypin has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
oprypin has joined #crystal-lang
FromGitter has quit [Read error: Connection reset by peer]
oprypin_ has joined #crystal-lang
oprypin has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
<oprypin_> f1refly, even without exodus it's quite easy to yank all the libs. and well, if you end up needing to compile the libs yourself, this is the most complete reference on that https://github.com/oprypin/crystal/blob/gh-ci/.github/workflows/win.yml :D
<oprypin_> you *might* literally need just libpcre, as libgc is bundled
<oprypin_> ah dang forgot about libevent
<FromGitter> <Blacksmoke16> is there a reason he cant just mount crystal into an alpine image and build a static binary that way?
<oprypin_> fair point
<FromGitter> <Blacksmoke16> then just include the output of that with his program
<oprypin_> is there some one-liner to do all of that and sppit out a file?
<FromGitter> <Blacksmoke16> `docker run --rm -it -v $PWD:/workspace -w /workspace crystallang/crystal:0.35.1-alpine crystal build hello-world.cr --static`
<oprypin_> noice
oprypin_ is now known as oprypin
<FromGitter> <Blacksmoke16> thats for a normal program, compiler might be a bit diff :shrug:
<oprypin> first time i find docker personally useful to me
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> ofc would want to add your other flags, like `--release`
alexherbo2 has joined #crystal-lang
<f1refly> oprypin: way too lazy for that. I'll just hand in the ruby version
<f1refly> Which doesn't mean that I won't create it in crystal for fun
<f1refly> which brings me to my new problem: How do I initialize an array with a bunch of sub-arrays? When I do Array(Array(String)).new(n, Array(String.new)) the reference to the array is always the same in all positions
<f1refly> How can I tell crystal that I want a new array every time?
<FromGitter> <Blacksmoke16> use the block version
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Array.html#new(size:Int,&block:Int32-%3ET)-class-method
<f1refly> Alright
<f1refly> Just wondered if theres a more compact way
<f1refly> But as long as it does the job its fine
<FromGitter> <Blacksmoke16> `Array.new(3) { [] of String }` prob best you going to get
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> `Array.new(3) { Array(String).new }`
<f1refly> Yeah it's perfectly fine
f1refly has quit [Quit: bye fags]
f1refly has joined #crystal-lang
f1refly has quit [Read error: Connection reset by peer]
f1refly has joined #crystal-lang
rocx has quit [Ping timeout: 260 seconds]
<FromGitter> <wyhaines> Riddle me this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ That works. `bar` can be a proc, or something else, and it works so long as `#call` is defined. ... [https://gitter.im/crystal-lang/crystal?at=5f03926cec4a341bee104829]
<FromGitter> <Blacksmoke16> ivars are a bit more strict
<FromGitter> <Blacksmoke16> a generic here would prob be the way to go
<FromGitter> <Blacksmoke16> `record SomeType(T), action : T`
<FromGitter> <Blacksmoke16> then like `SomeType.new bizz`
rocx has joined #crystal-lang
<FromGitter> <asterite> do you know the return type of that call? you can capture the given object behind a proc
<FromGitter> <wyhaines> The return type is itself actually not important. It is itself just going to invoke another method with the object that's passed into it. ⏎ ⏎ The mechanism is just so that a client library can expose a hook to it's user. The client library doesn't care what's done with the data that it's passing via the `#call`. It's responsibility ends when it does that. ⏎ ⏎ I think I see what you mean about
<FromGitter> ... capturing via a Proc. *goes off to tinker for a few minutes* [https://gitter.im/crystal-lang/crystal?at=5f03964854d7862dc4d012e5]
<f1refly> Whats the easiest way to tell crystal to pass an array by reference when put into a method call? Wrapping it into a class?
postmodern has joined #crystal-lang
<FromGitter> <Blacksmoke16> Arrays are passed by reference by default
<f1refly> Uhm
<FromGitter> <Blacksmoke16> So should just work
<f1refly> Then my code is beyond broken
<f1refly> nvm then
<FromGitter> <wyhaines> Wrapping in a proc works. Thanks for that insight @asterite !
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <asterite> Cool! I actually thought about it right now :-) ⏎ I think in other languages you would use an interface... a proc is not that nice because it captures the object in a closure, and that allocates memory... but I guess it's not that bad either
sz0 has joined #crystal-lang
sagax has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 272 seconds]
<FromGitter> <scriptmaster> Hi, (I am new to Crystal), I am trying to create a redis module: dylib/.so file. how do I import a C-header file and write some functions. Better yet, here is the 600+ lines of pure C code, I am trying to port to crystal: https://github.com/filipecosta90/list_extend
oddp has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> heres a concurrency question
<FromGitter> <Blacksmoke16> i need to make n requests to get data for each ID
<FromGitter> <Blacksmoke16> then iterate over that data, and make n more requests
<FromGitter> <Blacksmoke16> however the data will most likely be duplicated , so i wont need to do a request for *every* data object
<FromGitter> <Blacksmoke16> actually nvm, i can just create an array of ids to lookup, call `.uniq` on it and then spawn fibers to actually do the requests, versus doing the deup logic in the fiber
alexherbo2 has quit [Ping timeout: 258 seconds]