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
<FromGitter> <didactic-drunk> @watzon https://carc.in/#/r/9cab
<FromGitter> <watzon> @didactic-drunk that is better indeed haha
_whitelogger has joined #crystal-lang
oddp has quit [Ping timeout: 258 seconds]
alexherbo2 has joined #crystal-lang
alexherbo26 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo26 is now known as alexherbo2
sorcus has quit [Quit: WeeChat 2.8]
sorcus has joined #crystal-lang
flaviodesousa has joined #crystal-lang
flaviodesousa has quit [Remote host closed the connection]
oddp has joined #crystal-lang
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
<sorcus> Hi :-)
<sorcus> void mpz_set(mpztrop, const mpztop) - this function is missed in LibGMP - should it be added?
<yxhuvud> What does it do?
<sorcus> yxhuvud: https://gmplib.org/gmp-man-6.2.0.pdf - 5.2 Assignment Functions, These functions assign new values to already initialized integers.
<yxhuvud> Those functions mainly exist to create bindings for bigint. Probably noone has seen the need to let them be mutable.
<raz> didactic-drunk: since github doesn't let me comment atm... i'd be +1 for just changing the behavior of #hexdigest (rather than introducing hexfinal)
<raz> that saves 99% of users from having to change their code, double-calls should be easy enough to spot, and hexfinal just feels kludgy to me as a name
<raz> if we want to be super nice perhaps #hexdigest could memoize the value (so repeat calls still work) and print a warning on such calls for a few crystal versions...
deavmi has quit [Ping timeout: 265 seconds]
<FromGitter> <Daniel-Worrall> Do crystal release builds contain any meta data about where the file came from?
hamoko[m] has joined #crystal-lang
flaviodesousa has joined #crystal-lang
flaviodesousa has quit [Remote host closed the connection]
<FromGitter> <wyhaines> Are there any Crystal oriented (virtual) meetups happening anywhere in the world?
<FromGitter> <dscottboggs> @wyhaines https://chicagocrystal.org
<FromGitter> <wyhaines> 🙇 👀
return0e[m] has quit [Quit: killed]
ryanprior has quit [Quit: killed]
hamoko[m] has quit [Quit: killed]
<FromGitter> <phykos> Since Crystal is written in Crystal and it emits machine code, can I write my own language with a native compiler?
<jhass> yes
psydroid has joined #crystal-lang
<repo> hey guys
<repo> how do you publish crystal docs
<repo> *shards
<FromGitter> <Blacksmoke16> gets triggered on any push to master
<repo> nice!
<repo> thanks
<repo> Blacksmoke16: do i have to set the token manually or is it automatically added to the pipeline?
<FromGitter> <Blacksmoke16> its built into actions
<repo> cool
<FromGitter> <Blacksmoke16> basically a minimal permission token created for you
<repo> Blacksmoke16: hm doesn't seem to work. I set the branch for gh pages to gh-pages
<repo> anything else i need to do?
<FromGitter> <Blacksmoke16> did you actually do a deploy?
<FromGitter> <j8r> no need for token repo
<repo> not after setting the branch
<repo> maybe i just rerun the jobs
<FromGitter> <j8r> the CI has to be run once
<FromGitter> <j8r> then go to settings to see if the page is properly set
<repo> hah rerunning after setting the branch did the trick
<repo> thanks <3
ryanprior has joined #crystal-lang
return0e[m] has joined #crystal-lang
hamoko[m] has joined #crystal-lang
<FromGitter> <j8r> 👍
<FromGitter> <Blacksmoke16> nice one
<FromGitter> <kingsleyh> @oprypin are you here?
<FromGitter> <kingsleyh> @oprypin what is the best way to make a cursor in crsfml - let's say I have an image I want to use - can it be done with the SF::Cursor or you have to disable the cursor and code up a sprite that moves where the cursor goes?
<repo> hmm do you think this is a bug in crystal or on my end: https://repomaa.github.io/pdns.cr/Pdns/API/Endpoints/Zones.html#edit_rrsets(id,&block:Array(RRset)-%3E):Nil-instance-method
<repo> ah
<repo> nevermind
<repo> it's a typo
<wmoxam_> OpenBSD users: here's a patch for the Crystal port for v0.35.1: https://gist.github.com/wmoxam/ee1862ecef7d1fdc8a975e15a7bce568
wmoxam_ is now known as wmoxam
wmoxam has joined #crystal-lang
wmoxam has quit [Changing host]
<oprypin> @kingsleyh: i don't know the caveats.
<FromGitter> <kingsleyh> @oprypin I'm making a game: https://www.dropbox.com/s/5qay1q6rxmglm95/basic_mechanics.mp4?dl=0
<FromGitter> <kingsleyh> crsfml is pretty good - I'm investigating OpenGL and shaders at the moment
<repo> what's the recommended way to set variables (instances of classes that are tested) in crystal specs?
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <Blacksmoke16> got an example?
<repo> well in rspec i would do `let :foo { MyClass.new }`
<FromGitter> <Blacksmoke16> ah, i just do `MyClass.new` in each `it` block
<FromGitter> <Blacksmoke16> or define some private method if there is a lot of boilerplate
<repo> oh hm
<repo> right
<repo> or a private macro maybe
<FromGitter> <Blacksmoke16> sure, depends on the context id say
<repo> are private methods not available outside the file? (if defined in global scope)?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <lbarasti> thanks!
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo20 is now known as alexherbo2
<FromGitter> <wontruefree> I just released an episode with Lorenzo Barasti. I had a lot of fun with this one I hope some people here might enjoy it. http://podcast.chicagocrystal.org/1030945/4364261-lorenzo-barasti-building-crystal-community
<FromGitter> <bararchy> @wontruefree awesome job!
<FromGitter> <wontruefree> thanks !!
<FromGitter> <wontruefree> I really hope you enjoy these I feel like we are hitting a good stride
<FromGitter> <wontruefree> This is @lbarasti for those in the channel who do not know
<FromGitter> <RespiteSage> I need to catch up on the most recent few of those. I really enjoyed the episode with Ari, but I've not listened to any of the others yet...
sagax has quit [Ping timeout: 260 seconds]
<FromGitter> <wontruefree> well I think they are good but I am bias
<FromGitter> <wontruefree> @paulcsmith is in episode 2
<FromGitter> <RespiteSage> :P I think my only nitpick with the first episode is that I forgot your name by the end of the episode, and I didn't see it listed anywhere, and then I had to piece together what your handle was based on context.
<FromGitter> <RespiteSage> That is, I wanted to connect the host to the handle that I'd seen in the community and was having trouble doing so.
<FromGitter> <wontruefree> that is some great feedback. We have a few episodes already recorded but I will fix that for the next recording
<FromGitter> <ImAHopelessDev_gitlab> it's nice i've bneen listening to it
alexherbo28 has joined #crystal-lang
rocx has quit [Remote host closed the connection]
rocx has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo28 is now known as alexherbo2
deavmi has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <RespiteSage> Is there a concise way of doing this? https://carc.in/#/r/9ckh
<FromGitter> <Blacksmoke16> https://carc.in/#/r/9ckp, slightly better
<FromGitter> <RespiteSage> Huh. I didn't see a blockless `#each_cons` in the docs. That's perfect, though.
<FromGitter> <Blacksmoke16> part of the `Iterable` module
<FromGitter> <RespiteSage> Ah... I was looking at `Enumerable`...
<FromGitter> <RespiteSage> Well, thank you.
<FromGitter> <j8r> In your opinion, what's best way to close WebSocket connections?
<FromGitter> <j8r> Before stopping a server
<FromGitter> <j8r> ogc there is `HTTP::Server#close`, but I would like something more custom
duane has joined #crystal-lang
<FromGitter> <j8r> hum, I could use a hash maybe
<FromGitter> <Blacksmoke16> cant just call `.close` on the connection?
<FromGitter> <Blacksmoke16> or define some `before_close` callback
<FromGitter> <j8r> If I do the close inside the websocket handler logic, it has to know when it is going to happen
<FromGitter> <j8r> how would you do the callback?
<FromGitter> <Blacksmoke16> run the callback before calling close?
<FromGitter> <j8r> I mean, how can i target WS connections?
<FromGitter> <j8r> (which are inside other fibers)
<FromGitter> <Blacksmoke16> actually, doesnt `HTTP::Server#close` wait for all connections to disconnect?
<FromGitter> <Blacksmoke16> but i might be missing what you're trying to do..
<FromGitter> <Blacksmoke16> > Gracefully terminates the server. It will process currently accepted requests, but it won't accept new connections.
<FromGitter> <j8r> indeed
alexherbo21 has joined #crystal-lang
<FromGitter> <j8r> I would like to customize the close message of websockets, but the default may be fine for now
<FromGitter> <Blacksmoke16> like when someone does ctrl+c?
<FromGitter> <Blacksmoke16> or on a per connection basis
alexherbo2 has quit [Ping timeout: 246 seconds]
<FromGitter> <j8r> Yes
alexherbo21 is now known as alexherbo2
<FromGitter> <j8r> I would like to the clients, in the browser, know what is happening
<FromGitter> <j8r> I think I will use Hash, I will need one anyway for sessions/authentication
<FromGitter> <j8r> then, I'll just iterate over it :)
<FromGitter> <Blacksmoke16> okey dokey
<FromGitter> <Blacksmoke16> i mean you *could* just redefine that method
<FromGitter> <j8r> sorry, the above one
<FromGitter> <j8r> ho
<FromGitter> <j8r> I *think*, it may hang infinitely - have to try
alexherbo22 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 258 seconds]
<FromGitter> <j8r> hum, I don't quite understand how all this works...
<FromGitter> <j8r> I thought the purpose of a web socket connection is to keep it open
alexherbo2 has joined #crystal-lang
<FromGitter> <j8r> according to `#close`
<FromGitter> <j8r> > Gracefully terminates the server. It will process currently accepted requests, but it won't accept new connections.
<FromGitter> <j8r> This means it should not close existing WS connections, right?
alexherbo22 has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> well do remember WS connections are handled via the handler
<FromGitter> <j8r> yep
<FromGitter> <Blacksmoke16> so not sure how that fits into the actual implementation
<FromGitter> <j8r> ha ok I see, it is on the tcp level.
<FromGitter> <j8r> So if no packets is being processed, it closes
<FromGitter> <j8r> Ha ok I fully understand now, sorry
<FromGitter> <j8r> So for each connection, whats inside the `HTTP::WebSocketHandler.new` block is called. Then, depending on event, the procs defined inside are called
<FromGitter> <Blacksmoke16> ye
<FromGitter> <scriptmaster> Hi Crystal Community, I am new to crystal and very excited about this.. (only a couple of hours I stumbled upon crystal-lang) https://github.com/crystal-lang/crystal/issues/9477
<FromGitter> <scriptmaster> crystal server.cr works fine on ubuntu but not on my mac: throws openssl error. I tried all the recommendations on site/doc. See the link above for more details. What are your suggestions? Should I try a previous version? if so brew install crystal@what-version ?
<FromGitter> <dscottboggs_gitlab> there are a lot of issues with running OpenSSL dependent libs designed for linux on macos, regardless of whether it's in Crystal or another language (even C++). My recommendation would be to build statically in the official alpine docker image.
<FromGitter> <scriptmaster> In lib/kemal/src/kemal/helpers/helpers.cr:151:7 ⏎ ⏎ 151 | Flate::Writer.open(env.response) do |deflate| ⏎ ⏎ ``` ^``` ... [https://gitter.im/crystal-lang/crystal?at=5efa6ea5c223cc536a4306ea]
<FromGitter> <scriptmaster> crystal --version ⏎ Crystal 0.35.1 [5999ae29b] (2020-06-19)
<FromGitter> <scriptmaster> this is on ubuntu
<FromGitter> <dscottboggs_gitlab> oh dear
<FromGitter> <dscottboggs_gitlab> that looks like a bug in Kemal, is there an issue for that?
<FromGitter> <scriptmaster> After adding require "gzip seeing error with Flat::Writer
<FromGitter> <scriptmaster> checking kemal issues
<FromGitter> <dscottboggs_gitlab> There were many breaking changes from 0.34 to 0.35, this is probably one of those
<FromGitter> <dscottboggs_gitlab> Crystal is rapidly trying to establish source-level stability and move to 1.0
<FromGitter> <scriptmaster> ok, thanks for acknowledging. seems fair, in the meantime, I am about to try brew install crystal@0.34 (just asking if brew can install 0.34) ?
<FromGitter> <dscottboggs_gitlab> I'm not sure, i'm sorry. I'm not familiar with Brew and it has been some time since I've used macos. There are probably others here who could answer your question better in time.
<FromGitter> <scriptmaster> or apt-get install - I would give your suggestion of alpine docker if it didn't work
<FromGitter> <scriptmaster> a try
<FromGitter> <dscottboggs_gitlab> I would give asdf a try if you're trying to jump versions of crystal
<raz> scriptmaster: fwiw, would suggest 'asdf' to manage crystal versions locally (it can also manage ruby, js and everything else under the sun - saves a lot of headache)
<FromGitter> <dscottboggs_gitlab> https://asdf-vm.com/#/
<raz> the main advantage (apart from convenience) is that you can have a different version for each directory, rather than a single global one
<FromGitter> <scriptmaster> Great Scott, will try asdf now
<FromGitter> <scriptmaster> asdf --help ⏎ ⏎ "Late but latest" ⏎ -- Rajinikanth ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5efa728f3a0d3931fac073f9]
<FromGitter> <scriptmaster> (similar to Tom Cruise) made many successful movies. Sorry for off-topic, here is one: https://www.youtube.com/watch?v=vWHfZnJzEuI
<FromGitter> <scriptmaster> asdf install crystal 0.34∗ Downloading and installing Crystal... ⏎ Fail: Could not download Crystal 0.34 ⏎ Fail: An error occurred ⏎ :( [https://gitter.im/crystal-lang/crystal?at=5efa7589d65a3b0292ba3102]
<FromGitter> <scriptmaster> asdf plugin-add crystal https://github.com/asdf-community/asdf-crystal.git
<FromGitter> <scriptmaster> sry, I tried asdf like this: ⏎ asdf install crystal 0.34.0 ⏎ ∗ Downloading and installing Crystal... ⏎ The installation was successful! [https://gitter.im/crystal-lang/crystal?at=5efa7734b8152d3484700ec9]
<FromGitter> <scriptmaster> :duh: I was re-watching the 2.0 video and forgot about semver - irony
postmodern has joined #crystal-lang
<FromGitter> <scriptmaster> crystal 0.34.0 works with no errors on ubuntu, tried on mac too - works. 0.35.1 is not good, imho.