ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <zsxawerdu> this language is fast as Golang
<FromGitter> <zsxawerdu> eventually parallelism will get it to near the top of web frameworks
Groogy has quit [Ping timeout: 265 seconds]
gangstacat has quit [Quit: Ĝis!]
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
gangstacat has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
chemist69 has quit [Ping timeout: 276 seconds]
chemist69 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<livcd> zsxawerdu: compile times is a big of a problem
<FromGitter> <Blacksmoke16> i mean not *that* big of a deal
<livcd> To some it is not
<livcd> To some it is
DTZUZO has quit [Ping timeout: 265 seconds]
<FromGitter> <kaukas_gitlab> @j8r `do_setup { it "does something" ... }` does not run specs within that block but gathers them and runs everything at the end. Worse, ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5d91ab54462ada51232201ad]
rohitpaulk has quit [Ping timeout: 245 seconds]
tdc has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <kaukas_gitlab> I guess spectator (https://gitlab.com/arctic-fox/spectator) might be an option.
<repo> umm
<repo> wtf...
<repo> why on earth would you change integer operators to produce float values
<repo> ok at least there's a floor division operator
<FromGitter> <j8r> @kaukas_gitlab I mean https://carc.in/#/r/7o17
<FromGitter> <j8r> @kaukas_gitlab or you can defined custom its https://carc.in/#/r/7o19
<FromGitter> <kaukas_gitlab> @j8r, your first example does something strange. `before_1` is outside the specs but other befores are inside. Here's an example where all the befores are outside specs (https://carc.in/#/r/7o1a). As you can see all befores still run before all specs.
<FromGitter> <j8r> yes, that's normal, I does it to show that it is also possible
<FromGitter> <j8r> I noticed this too :/
<FromGitter> <kaukas_gitlab> I understand that it's possible to call my `before` methods from within the `it` specs. But the whole point of before/after is to extract the repeating logic out of them.
<FromGitter> <j8r> i think the best would be the second example I give
<FromGitter> <j8r> defining custom methods with `it` inside
<FromGitter> <kaukas_gitlab> Thank you for the suggestion! It looks very much DIY…
<FromGitter> <j8r> also used in the Crystal stdlib specs: https://github.com/crystal-lang/crystal/blob/master/spec/std/json/lexer_spec.cr#L4
<FromGitter> <j8r> you're welcome
<FromGitter> <kaukas_gitlab> The lexer example emulates `shared_examples` from RSpec, and it makes sense. What I can't find is `before :all` and even `before :each`. You can achieve that by wrapping `it`s but it's susprisingly unintuitive, especially since `before_each` is present.
<FromGitter> <j8r> `Spec.before_each` is global
<FromGitter> <j8r> It is designed to run something before all specs
rohitpaulk has quit [Ping timeout: 276 seconds]
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <asterite> I'll implement before_each and before_all eventually, though I think they aren't very useful in spec. What exactly you want to do with them?
DTZUZO has joined #crystal-lang
<FromGitter> <yxhuvud> There is a lot of stuff that they are used for in specs that wouldn't really work in crystal, like setting up shared instance variables between tests
<FromGitter> <yxhuvud> stuff like transactional db handling would be pretty sweet, though perhaps it is better to push the community away from rails style model testing that actually write to and use the db
<FromGitter> <kaukas_gitlab> Re-set up the DB state around each test?
<FromGitter> <Val> Or cleanup some temporary files/directories, see : https://github.com/Val/crun/commit/e4a28e646118c5a1de5970db8488d0d14d379bae
olbat has quit [Ping timeout: 245 seconds]
<repo> hey
<repo> i'm updating shards on a project and when i do i get the warning: GC Warning: Repeated allocation of very large block (appr. size 805310464):
<repo> it then gobbles up more and more ram until it exits with OOM
<repo> is it possible to narrow down which shard is causing this?
<repo> i'm guessing it's a post-install hook
<repo> hmm no maybe not
<FromGitter> <j8r> repo: you have https://github.com/crystal-lang/shards/issues/282
<repo> hmm
<repo> dang
<repo> j8r: i removed any and all version constraints from shard.yml and removed shard.lock but still get the error
<repo> of course the shards themselves might have version constraints
<repo> in their deps
<repo> so should i try downgrading shards to 0.8.1?
<repo> mh now my libevent is too high
<repo> hm ok it seems i should be constraining versions
<repo> is there a tool to find out the latest version of a given shard?
<FromGitter> <j8r> repo: this error is because of too many clauses, yes
<FromGitter> <j8r> I think not, FYI I'm working on an experimental, alternative package manager that will solve this kind of issues
<FromGitter> <j8r> still WIP https://github.com/j8r/sherd :)
<repo> how does shards figure out versions of shards? by going through releases? or tags?
<FromGitter> <j8r> yes, `git tags`
<repo> alright
<repo> thaks
<repo> *thanks
<FromGitter> <j8r> from a locally cloned cache, usually `~/.cache/shards`
<repo> right
rohitpaulk has quit [Remote host closed the connection]
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
<FromGitter> <didactic-drunk> How would I do one overflowing integer operation without raising or disabling overflow protection?
<FromGitter> <Blacksmoke16> i think there is like `&+`
return0e has quit []
alex`` has quit [Ping timeout: 240 seconds]
<repo> does someone have trouble with postinstall of latest ameba with latest crystal?
<repo> i get: Error target ameba failed to compile:
<repo> In src/ameba/inline_comments.cr:97:7
<repo> 97 | commented? = false
<repo> ^
<repo> Error: unexpected token: =
<FromGitter> <Blacksmoke16> what version are you using?
<repo> 0.10.1
<FromGitter> <Blacksmoke16> and what crystal version
<repo> 0.31.0
<FromGitter> <Blacksmoke16> and what version is in the lock?
<repo> i removed the lock
<repo> so basically clean install
<repo> lib is also empty
<FromGitter> <Blacksmoke16> try clearing your cache `rm -rf ~/.cache/shards`
alex`` has joined #crystal-lang
<repo> will do
<repo> hm no
<repo> still same error
<FromGitter> <didactic-drunk> `cr eval 'p 2**31 &+ 2'` ⏎ ⏎ ```Unhandled exception: Arithmetic overflow (OverflowError)``` [https://gitter.im/crystal-lang/crystal?at=5d920da17fe6a605d158de7d]
<FromGitter> <Blacksmoke16> `&**`
<FromGitter> <didactic-drunk> Oh, oops
<FromGitter> <tenebrousedge> good to know, @Blacksmoke16 👍
<FromGitter> <Blacksmoke16> repo hmm
<repo> hmm indeed :)
<FromGitter> <Blacksmoke16> try clearing crystal cache too? `rm -rf ~/.cache/crystal`
<FromGitter> <Blacksmoke16> something has to be cached somewhere as that error was fixed like months ago
<FromGitter> <Blacksmoke16> if someone wants to make a PR to add it to https://crystal-lang.org/reference/syntax_and_semantics/operators.html would probably be helpful 😉
<FromGitter> <Blacksmoke16> repo i dont suppose you have another dependency that has ameba locked to a lower version?
ht_ has joined #crystal-lang
<repo> hmm
<repo> are development dependencies for dependencies considered as well?
<repo> because i can't imagine any shard would list ameba as a (not development) dependency
<FromGitter> <Blacksmoke16> try doing `shards install --production`
<FromGitter> <Blacksmoke16> which would skip dev deps
<FromGitter> <Blacksmoke16> which should work since it shouldnt try to install your ameba
<repo> yeah, let's see
<repo> yup, done
<FromGitter> <Blacksmoke16> what shards version are you using?
hightower2 has joined #crystal-lang
<repo> 0.9.0
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> im out of ideas
<FromGitter> <wontruefree> there is a make command `make clean_cache` if you want
sorcus has quit [Ping timeout: 276 seconds]
sorcus has joined #crystal-lang
<repo> is it possible to discard the body of a http request?
<repo> i'm not talking about skip_to_end
<repo> i don't want any data flowing from the server to the client
<repo> just need the headers
<FromGitter> <Blacksmoke16> just do a HEAD request then?
<repo> doesn't the server need to support this?
return0e has joined #crystal-lang
<FromGitter> <Blacksmoke16> probably
<FromGitter> <Blacksmoke16> id maybe try it, tried it on an API endpoint i made and worked fine using curl
<FromGitter> <tenebrousedge> but not supporting it would be foolish
<FromGitter> <Blacksmoke16> that is using kemal
<FromGitter> <tenebrousedge> since you can get the same information using GET then disabling HEAD is just increasing traffic
<FromGitter> <Blacksmoke16> yea looks like kemal handles it natively
<FromGitter> <Blacksmoke16> adds a corresponding HEAD request for each GET request
<FromGitter> <stronny> if you want to avoid transmitting the body over network you have to close the socket
bcardiff has joined #crystal-lang
ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
bcardiff has quit [Client Quit]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <rmarronnier> Ok I'm stuck with this :
<FromGitter> <rmarronnier> https://carc.in/#/r/7o61
<FromGitter> <rmarronnier> Why can't I change the value of an object variable in an array ?
<FromGitter> <Blacksmoke16> you're using structs would be my guess
<FromGitter> <rmarronnier> Yes !
<FromGitter> <Blacksmoke16> so its changing the value in a copy of the obj
<FromGitter> <rmarronnier> So... I'd have to use class instead of struct to get what I want ?
<FromGitter> <Blacksmoke16> at least for Person
<FromGitter> <Blacksmoke16> since its mutable
<FromGitter> <rmarronnier> mm, understood.
<FromGitter> <rmarronnier> Thanks
rohitpaulk has joined #crystal-lang
devil_tux has joined #crystal-lang
<devil_tux> what is the type of `encoding` on File* API? or better yet, how to set it properly
<FromGitter> <bew> it's a String iirc
<devil_tux> i cant figure out how to set it based on remote file
<devil_tux> File.write("#{DATA_STORAGE}/#{remote_filename}", response.body_io, encoding: response.body_io.encoding)
<devil_tux> this doesnt seems to set it properly as:
<devil_tux> file remote_file.txt yields: : Non-ISO extended-ASCII text, with CRLF line terminators
<devil_tux> > response.body_io.encoding yields "utf8"
<FromGitter> <Blacksmoke16> should be `utf-8`
<FromGitter> <Blacksmoke16> would be my guess
<devil_tux> still Non-ISO
<FromGitter> <bbaragar> Is there a ways to pass an instance method to C like so https://gist.github.com/bbaragar/d539dee062d741314bba94ac0b161236 ⏎ I get the error: can't set closure as C struct member (closured vars: self)
rohitpaulk has quit [Remote host closed the connection]
ht_ has quit [Quit: ht_]
user3 has joined #crystal-lang
<FromGitter> <Blacksmoke16> maybe something useful in there @bbaragar ?
HumanGeek has quit [Quit: Leaving]
duane has quit [Ping timeout: 240 seconds]
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
hightower2 has quit [Ping timeout: 268 seconds]