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
chachasmooth has quit [Ping timeout: 258 seconds]
_whitelogger has joined #crystal-lang
Volk has quit [Quit: See you next time!]
_whitelogger has joined #crystal-lang
_ht has joined #crystal-lang
deimos_ has joined #crystal-lang
<FromGitter> <asterite> a for is just a while with a break. While is the only looping construct in Crystal and with it you can do any other
snapcase_ has quit [Ping timeout: 240 seconds]
snapcase has joined #crystal-lang
hightower2 has quit [Ping timeout: 264 seconds]
hightower2 has joined #crystal-lang
<FromGitter> <naqvis> @oprypin Thanks for Crystal Github Action. On Mac its missing `-lssl`
<oprypin> m?
<FromGitter> <naqvis> crystal doesn't work when installed on darwin, it reports backs missing `-lssl`
<oprypin> works for me
<FromGitter> <naqvis> try to use some part of stdlib which requires ssl
<FromGitter> <naqvis> :P
<oprypin> naqvis, what's some part of stdlib that requires ssl
<FromGitter> <naqvis> start http server?
<oprypin> crystal eval 'require "openssl"' ?
<FromGitter> <naqvis> yeah should work
<hightower2> Is there a nice way to do int & int checks without having to always compare if greater than zero, that is if((x & x) > 0)
<hightower2> or x & y rather...
<hightower2> hm, seems that crystal code has explicit comparisons for 0 or != 0
<oprypin> nothing wrong with tha
<oprypin> i remember that one biting me at least once
<hightower2> yeah, spent half a day debugging this
<oprypin> naqvis, thanks for the report, can confirm 👍 https://github.com/oprypin/install-crystal/runs/1649933278 - can u open an issue please?
<FromGitter> <naqvis> sure thing and thanks oprypin
<FromGitter> <naqvis> done. https://github.com/oprypin/install-crystal/issues/3 ⏎ Thanks again oprypin
<oprypin> nice , /usr/local/opt/openssl/lib/pkgconfig actually exists
<FromGitter> <naqvis> might be due to `LIBRARY_PATH`?
<FromGitter> <naqvis> how about setting `LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/` ?
<FromGitter> <jrei:matrix.org> Yes it is possible the path has changed
<FromGitter> <jrei:matrix.org> I've heard some people having issues regarded to it
Volk has joined #crystal-lang
lanodan has quit [Ping timeout: 272 seconds]
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
lanodan has joined #crystal-lang
xaxisx has joined #crystal-lang
hightower3 has joined #crystal-lang
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
<hightower3> Hey I find one error message confusing... when you do something like:
<hightower3> someobj.someprop()
<hightower3> and that object does not have someprop() visible to the outside (i.e. when it's an ivar and not getter or property)
<hightower3> then the error message misleadingly says:
<hightower3> Error: undefined method 'someprop' for SomeClass
<hightower3> 'self' was used before initializing instance variable 'someobj', rendering it nilable
<FromGitter> <Blacksmoke16> got a playground link? Pretty sure something else is going on
<hightower3> I've seen this a number of times, and it goes away if I change '@someprop' into e.g. 'getter someprop'
<hightower3> let me try
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/a81j
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/a81l fixed
<hightower3> Yes I mean, it doesn't exhibit in most plain examples, but the above effect is what it boils down to, when it does happen... trying to reproduce
<FromGitter> <Blacksmoke16> you're prob passing `self` to another method/constructor within an initializer
<hightower3> yes, all you say may be true
xaxisx has quit [Remote host closed the connection]
xaxisx has joined #crystal-lang
<hightower3> shrug... can't reproduce
<hightower3> (tried it a couple times in the past, but then ended up not reporting since I couldn't reproduce in a simple example)
ua has quit [Ping timeout: 264 seconds]
ua has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
ua is now known as ua_
<hightower3> Hey if subclasses of a class need to accept some initialize arguments specific to them and also all the arguments of the parent's initialize (and there's many of them), what's my best bet repeating all these arguments in 20-30 subclasses?
<hightower3> Can a macro do it, or some better solution?
<hightower3> or I can do initialize(...specific options..., **args); super(**args)
<FromGitter> <naqvis> Happy to share Playwright-cr (https://github.com/naqvis/playwright-cr) Crystal version of the Playwright testing and automation library. 😆
<FromGitter> <Blacksmoke16> cant say i heard of that one. Thought everyone uses Cypress these days
<FromGitter> <naqvis> this one is quite popular among M$ fans :P
xaxisx has quit [Quit: Leaving...]
<hightower3> In this case: https://carc.in/#/r/a823 , how can I make sure that x2 calls the first version of x1 ?
<FromGitter> <Blacksmoke16> https://carc.in/#/r/a824 but why? :p
<hightower3> eh, yes but can't use previous_def... or in fact I could... in any case solved it in a slightly different way
<hightower3> (some subclasses want to override the method from parent class... I guess previous_def would work, yes)
<FromGitter> <Blacksmoke16> yes, just remove the redefinition of the method
<FromGitter> <Blacksmoke16> well in that context it would be `super`
<FromGitter> <Blacksmoke16> assuming you want to call the parent implementation then do something more with the response?
<hightower3> mm right, didn't think of super in this context, thanks
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
Volk has quit [Quit: See you next time!]
<deimos_> in reading about fibers, is it correct that crystal already has file and network i/o in a fiber?
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter> <erdnaxeli:cervoi.se> Hi, in spec, is it possible to run some code before each test and get the result to use it in the test? (in my case I want to open a db connection with in memory sqlite and run the migrations)
<FromGitter> <Blacksmoke16> ```it "some test" do ⏎ with_connection do |conn| ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ff4dbeade6081431564a3fa]
<FromGitter> <Blacksmoke16> can use helper methods within your specs
<FromGitter> <Blacksmoke16> there are also hooks you can use, which you could store the value in some class var or something :shrug:
<FromGitter> <erdnaxeli:cervoi.se> the helper seems good, I didn't think about that, thanks!
<hightower3> is there not a way to cancel/kill a fiber from outside?
<FromGitter> <Blacksmoke16> there is but not via the public API
<FromGitter> <erdnaxeli:cervoi.se> ok now the tricky question, did someone succedeed to use an in memory sqlite db with a database pool? ⏎ I tried `sqlite3://%3Amemory%3A?cache=shared` but it does not seems to work.
<FromGitter> <erdnaxeli:cervoi.se> the tables created withing a transaction are not visible to other transactions.
<FromGitter> <Blacksmoke16> are you trying to run this once per group of specs? or once per `it` block?
<FromGitter> <erdnaxeli:cervoi.se> once per it block. Yeah, that's terribly unefficient :p
<FromGitter> <erdnaxeli:cervoi.se> "For backwards compatibility, shared cache is always disabled for in-memory databases if the unadorned name ":memory:" is used to open the database" I think that's my problem
<FromGitter> <erdnaxeli:cervoi.se> it seems I need to use a URI filename
<FromGitter> <erdnaxeli:cervoi.se> returning from a db.transaction block prevents it to commit?
<FromGitter> <Blacksmoke16> Try using next instead
<FromGitter> <erdnaxeli:cervoi.se> hmm, yes, thanks
<FromGitter> <Daniel-Worrall> Core member care to label #9957 with Platform-Windows?
<DeBot> https://github.com/crystal-lang/crystal/pull/9957 (Implement basic event loop for win32)
<FromGitter> <erdnaxeli:cervoi.se> about my :memory: problem: crystal-sqlite3 does not enable Flag::URI, and does not supports "file:" scheme, so `?cache=shared` will never work. But, as I actually reuse the same connection from my pool, my tests run ok.
<FromGitter> <Blacksmoke16> 👍
Volk has joined #crystal-lang
<raz> halite or crest? hmmm
* raz tries to remember why he preferred crest in the past
<FromGitter> <watzon> I used to love Halite, but it's slow af compared to `HTTP::Client`. No clue how crest compares.
<FromGitter> <Blacksmoke16> cant just use stdlib
<FromGitter> <Blacksmoke16> raz use `Athena::HTTPClient` 😏
<FromGitter> <jrei:matrix.org> yes, Halite has so much features
<FromGitter> <jrei:matrix.org> https://github.com/crystal-community/cossack is simpler
<raz> cossack looks unmaintained tho
<FromGitter> <jrei:matrix.org> maybe, shouldn't be hard to fix it if necessary
<raz> smoke, how many abstract interfaces do i need to implement in that to make a GET request? :P
<FromGitter> <Blacksmoke16> a lot because it doesnt exist 😆
<raz> hrhr
<raz> oh well, will just stick with crest
<FromGitter> <Blacksmoke16> ideally i think stdlib client would just be updated with new features
<FromGitter> <watzon> ++
<FromGitter> <watzon> It's just missing a few things
<FromGitter> <Blacksmoke16> https://docs.guzzlephp.org/en/stable among others could be used as a template
<FromGitter> <jrei:matrix.org> crest looks ok too
<FromGitter> <Blacksmoke16> middleware/handler concept is pretty cool
<FromGitter> <jrei:matrix.org> too bad the state of HTTP::Client is not great
<raz> well the main thing i miss is persistent http connections
<raz> but that's not an easy fix, last i checked
<FromGitter> <jrei:matrix.org> persistent http connections..?
<FromGitter> <jrei:matrix.org> HTTP it is no designed for long lived, persistent connections
<FromGitter> <Blacksmoke16> `Connection: keep-alive`
<FromGitter> <jrei:matrix.org> ha that
<FromGitter> <jrei:matrix.org> I thought something like long poll