<FromGitter>
<jwaldrip> I debated that for some time...
<FromGitter>
<jwaldrip> I could look at case
<FromGitter>
<jwaldrip> `"users#show"` would be actually be `UsersController#show` and the upper case form would assume its looking for the exact constant.
<FromGitter>
<jwaldrip> would that be a little better?
<RX14>
hmm
<RX14>
that's actually not a bad idea
<FromGitter>
<jwaldrip> Okay readme updated for helpers. Is that better?
<RX14>
"access" is the word that's confusing I think
<RX14>
be specific about what they actually do
<RX14>
"Route helpers provide type-safe methods to generate links to defined routes in your application"
<RX14>
or s/links/URLs/
<FromGitter>
<jwaldrip> done
<FromGitter>
<jwaldrip> Route helpers provide type-safe methods to generate paths & urls to defined routes ⏎ in your application.
snsei has joined #crystal-lang
<RX14>
s/&/and
<FromGitter>
<jwaldrip> I knew you were...
<RX14>
lol
<RX14>
you only get to be on the core team if you're an absolute pedant :)
<RX14>
@jwaldrip The big example just below that paragraph is still more confusing than helpful though I think
<RX14>
because you define helper: "new" and then use new_user_path
<RX14>
and the doc just said it should be called new_path
<RX14>
and then you have the missing UsersController
<RX14>
which i'm assuming MyController should be called usersController in that example
<RX14>
and there's no route for def show
<RX14>
it's just a bit of a mess
<RX14>
anyway I must sleep
<RX14>
night
snsei has quit [Ping timeout: 276 seconds]
<FromGitter>
<jwaldrip> Okay readme fixed again... also string behavior is now what we discussed.
baweaver has quit [Excess Flood]
baweaver has joined #crystal-lang
baweaver has joined #crystal-lang
<FromGitter>
<Dillybob1992> Good afternoon!!!
<FromGitter>
<Dillybob1992> It's Crystal Time!
pfreak has joined #crystal-lang
<FromGitter>
<watzon> Who mods the reddit board for Crystal?
<FromGitter>
<jwaldrip> No idea.
<FromGitter>
<watzon> Someone got banned for a joke comment lol. Almost definitely shouldn't have happened
pfreak has quit [Quit: Page closed]
emilsp has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
<FromGitter>
<j8r> Q
<FromGitter>
<Dillybob1992> Is it possible to limit the max size of a message (or tcp stream of bytes) at the socket level? for example, i'm populating a message that's like 100000 characters long in an array, and sending it to crystal. (example of a malicious user), is there a way to check if a byte stream is greater than > MAX_MESSAGE_SIZE and `close` that connection automatically. or does this need to be implemented in iptables
<FromGitter>
... or something?
<FromGitter>
<Dillybob1992> i had a problem in my nodejs gameserver of crashing the server if a user sent a very large message over the stream
Creatornator has joined #crystal-lang
snsei has joined #crystal-lang
<crystal-gh>
[crystal] MakeNowJust opened pull request #5624: Remove TODO about duplicated named group Regex (master...remove-duplicated-regex-todo) https://git.io/vN2wl
<FromGitter>
<watzon> It was just a joke about the Orion router. I don't feel like it warented a ban
qard has joined #crystal-lang
<jnyw>
hi guys this is a little off-topic but I wanted to add crystal support for spaceship-prompt (https://github.com/denysdovhan/spaceship-prompt). Does anyone know where I can get the crystal lang icon as an emoji or something?
<FromGitter>
<jwaldrip> Lmao. That was my post. I did not think they needed to be banned.
<FromGitter>
<Dillybob1992> i had to double read that post
<FromGitter>
<Dillybob1992> I also implemented a flood_bucket system that detects each cmd sent (if faster than xxxMS), it warns users and removes a token from their bucket. if their bucket gets to 0, they get disconnected. The bucket then gets replenished every 5 seconds. each game cmd has their own flood limit amount (https://i.gyazo.com/f028c5c5c9eaa430f562d9878c0324b7.png). Then, I have another flood control bucket (the main
<FromGitter>
... one) that kicks the user if they exceed the flood limit per xxx seconds
cremes has quit [Quit: cremes]
<FromGitter>
<fridgerator> @watzon the subreddit mods are listed in the right hand column
<FromGitter>
<fridgerator> perhaps the ban was because of the name ?!?
cremes has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter>
<drosehn> If I wanted to print out the name of the current method, how would I do that in crystal. Something with macros, perhaps? Ruby has the magic-constant of `__method__`, but neither that nor `__METHOD__` seem to exist in crystal. Or is this just another case where I've missed something obvious in the API documentation?
<FromGitter>
<watzon> Looks like @asterite and @RX14 are mods
chromis has joined #crystal-lang
cremes has quit [Quit: cremes]
snsei has quit [Remote host closed the connection]
<FromGitter>
<bew> @drosehn there's not sure thing in Crystal for now
aroaminggeek has joined #crystal-lang
snsei has joined #crystal-lang
duane has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
<FromGitter>
<drosehn> Okay, thanks. Nothing urgent for me, I was just wondering.
snsei has quit [Ping timeout: 265 seconds]
rohitpaulk has quit [Ping timeout: 268 seconds]
aroaminggeek has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
qard has quit [Ping timeout: 240 seconds]
flaviodesousa has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Groogy has joined #crystal-lang
<Groogy>
Morning! o/
<FromGitter>
<Dillybob1992> Morning o/
<FromGitter>
<bew> 'night here ;)
mark_66 has joined #crystal-lang
<FromGitter>
<faustinoaq> Morning 😄
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<yxhuvud> Moin!
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
duane has joined #crystal-lang
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 256 seconds]
hightower4 has joined #crystal-lang
<crystal-gh>
[crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vN2hN
<crystal-gh>
crystal/master fd55e8d TSUYUSATO Kitsune: Remove TODO about duplicated named group Regex
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
<RX14>
@watzon did you read his comment history?
<RX14>
A joke comment is fine
<RX14>
Having a Reddit account dedicated to actively confusing people is not
<RX14>
yeah, I wouldn't ban someone for one post...
<FromGitter>
<KevinSjoberg> Hello everyone! Started playing around with Crystal last weekend. Lots of fun. Would you be open in changing the wording for the Spec module? Currently it says `should` and `should_not`. I'd argue that `must` and `must_not` reads better. Tests are assertive. Either it is true or it's not. There's no room for debate. Coming from Ruby we've seen both Minitest and RSpec adapting this wording. In RSpec you
<FromGitter>
... expect things to be true. `expect(user.valid?).to be true`. In Minitest you expect like so, `user.valid?.must_equal true`. I'd be happy to submit a PR if you feel things change is welcome.
<RX14>
I don't think people would be open to changing it
<RX14>
it would be a 20k+ line diff and for what gain?
<RX14>
I dislike both syntaxes
<RX14>
we should use `assert user.valid?` but nobody uses that either
<RX14>
s/uses/likes
<Groogy>
Contracts are way better anyway 😉
<RX14>
no, they're orthogonal
<RX14>
contracts define what must be true, but you have to have tests to make sure that the edge cases are actually run, and prove that they pass the contract
<FromGitter>
<Dillybob1992> what kind of characters are forbidden to be used inside strings for hash key/values?
<RX14>
contracts don't provide a "spec suite" with all your previous regressions defined to amke sure you don't regress again
<FromGitter>
<KevinSjoberg> <RX14>: The change necessary would be super small. Since it's basically two methods that we extend `Object` with. The gain would be more accurate semantics and better formed tests. For instance, in RSpec, tests could be read as documentation as well.
<RX14>
@Dillybob1992 none
<FromGitter>
<KevinSjoberg> <RX14> Contracts does not replace tests. They're used in conjunction with each other.
<RX14>
I know
<RX14>
thats what I said
<FromGitter>
<Dillybob1992> oh relly, ok awesome. ty
<RX14>
@KevinSjoberg it would be a small change in the stdlib but a huge change in the spec suite
dragonkh has joined #crystal-lang
<RX14>
because you have to sed -i 's/should/must/g' spec/**/*.cr
<RX14>
which is going to be a 20k+ line diff
<RX14>
I don't think the wording matters much if at all
<FromGitter>
<KevinSjoberg> <RX14> yep, it would. But I don't think that's reason enough to stay away from it. In any case, we would have to deprecate the old syntax.
<RX14>
at the end of the day it's just terminology
<RX14>
and I don't think people are going to merge that PR
<FromGitter>
<asterite> There's absolutely no reason to change spec. No real gain. Just different names. We could continue tweaking names forever....
<RX14>
if you PR it it'll just become a load of bikeshedding about naming
<dragonkh>
I really think I'm going crazy - I can't understand why it does not work in Crystal
<FromGitter>
<xfbs> Oh yeah, that's because types in Crystal work a little different than how they work in ruby.
<RX14>
because we have fixed sized integers dragonkh
<RX14>
that's an integer overflow
<FromGitter>
<xfbs> So your base variable in ruby is of type `Fixnum` (I believe) and it gets promoted to bignum
<FromGitter>
<KevinSjoberg> I'd disagree. Sure, technically speaking it's just a name change. On the other hand, terminology matters. Since Crystal already targets Rubyists there could be plenty of reason to use something more familiar.
<RX14>
then that keeps shifting 8 bits to the left
<FromGitter>
<asterite> BigNum -> BigInt
<RX14>
until the bit falls off the end
<RX14>
and you're back to zero
<RX14>
and multiplication by zero is always 0
snsei has joined #crystal-lang
<RX14>
as everyone else suggested, if you need an infinitely big integer, require "big" and use BigInt
<RX14>
in the future we'll probably raise on overflow
<dragonkh>
I see - thanks :) - I'm still a newbie lol !
sz0 has joined #crystal-lang
<RX14>
@KevinSjoberg this would be a discussion to have when we were first implementing spec
<RX14>
what I'm saying is "it's too late to change"
<RX14>
if you consider the benefit of changing (minor) with the pain of changing (high) it doesn't make sense
<RX14>
if the change was less painful, sure change naming
<RX14>
if the change was major, sure change naming
<RX14>
but it's neither
<RX14>
it's simply a judgement call of the cost/benefit
<FromGitter>
<KevinSjoberg> <RX14> But you cant define "pain" as a lot of files has to change. The change itself could be automated and the old methods would still have to be sunsetted.
<RX14>
we don't have any tool for automatic breaking changes
<RX14>
so we'd need to develop a process for that
<RX14>
or tell everyone to use sed
<RX14>
and how would we distribute that info to everyone?
<RX14>
this is a big community, changes like this would need to be planned
<RX14>
and that takes time away from doing more useful work
<FromGitter>
<KevinSjoberg> <RX14> There are plenty of ways to do this. Introduce the `must` and `must_not` methods side-by-side with the old ones. Move the logic into the new ones and let `should` and `should_not` be aliases. The formal deprecation of the old syntax could then be discussed.
<FromGitter>
<asterite> but what do you win?
<FromGitter>
<asterite> will specs run faster? will people write better tests?
<RX14>
well we'd need to make the change eventually
snsei has quit [Ping timeout: 276 seconds]
<FromGitter>
<asterite> will people be happier?
<FromGitter>
<asterite> there's absolutely no benefit other than going through that... and then someone will suggest using `expect(obj).to` (like it happened in the past)
<FromGitter>
<asterite> If you want to use `must` and `must_not`, simply write an alternate spec framework and have people use that instead
<RX14>
or suggest `assert` :)
<RX14>
which I still think is far far better - apart from the unfortunate performance problems
<RX14>
you can make `assert` have equal introspectability as `expect` with macros but then it's just slow
<FromGitter>
<KevinSjoberg> @asterite you're missing the point. Ruby has a established community. A community that spend the last decades improving a lot of things, like tests, wording, and so on. Crystal targets Rubyists as a better alternative. Using more accurate syntax would make it more familiar. It's also more correct from a TDD point of view.
<FromGitter>
<KevinSjoberg> Using something like `expect` is a different story. I'd argue it's not worth supporting at all.
<RX14>
@KevinSjoberg as I said that would be an argument to make when implementing the spec module
<FromGitter>
<KevinSjoberg> But since Crystal have decided to keep `Spec` in the standard library, we could make sure it speaks the lingo people are expecting.
<RX14>
the time has passed
<FromGitter>
<KevinSjoberg> Using `should` and `should_not` are setting the tone for what you'd expect of a test.
<RX14>
nobody's going to write better or worse tests because of the naming
<RX14>
the answer is "no"
<RX14>
and we've explained why
<FromGitter>
<KevinSjoberg> <RX14> what argument is that? Surely, a change should be welcome if enough people think it's worth doing? Right? I'm not saying this needs to get fixed. I'm merely proposing the change.
<FromGitter>
<KevinSjoberg> <RX14> I'd argue people to tend to write better code when given proper wording.
<FromGitter>
<KevinSjoberg> It's also about how it's read by you as a developer.
<RX14>
You've proposed the change and we've said no lol
<FromGitter>
<KevinSjoberg> <RX14> You've said no. Are you representing the Crystal community as a whole?
<RX14>
I'm representing the core team
<Groogy>
He is part of the dev team last time I checked
<RX14>
And my opinion has been backed up by ary
<RX14>
Who literally created crystal
<RX14>
So I'd say that's a no
<FromGitter>
<KevinSjoberg> I'm not entirely sure why we can't keep things civil. I understand that this might not be worth doing. I'd just want to discuss pros and cons before just dismissing it.
<crystal-gh>
[crystal] asterite opened pull request #5626: HTTP::Client: execute `before_request`callbacks right before writing the request (master...refactor/http-client-before-request) https://git.io/vNash
<FromGitter>
<Dillybob1992> i never even coded one line of ruby before tbh, i just found crystal interesting cuz the websocket benchmarks. i think more people who don't even code in ruby will come to crystal in the future especially after windows release (mostly bcz people are lazy and don't want to bash on windows XD)
<RX14>
I am being civil, we just discussed the pros and cons
<FromGitter>
<KevinSjoberg> <RX14> I know you're part of the core team. I'm not trying to be rude here. Really. :)
<FromGitter>
<asterite> `should` is correct
<FromGitter>
<asterite> this thing should do this
<FromGitter>
<asterite> but it might not because of a bug or incorrect implementation
<FromGitter>
<asterite> or, well, it's just a minor nuance compared with `must`
<FromGitter>
<KevinSjoberg> @asterite correct in the sense of grammar, yes. But tests are assertive. Either it does, or does not.
<FromGitter>
<asterite> I don't think we should break everyone's code because of this, or have them migrate existing code (plus migrating our whole test suite)
<Groogy>
Also I find it, Crystal diverged bigtime from Ruby long time ago. Some libraries changing to some other semantic is not really a reason why Crystals standard library should follow suit
<FromGitter>
<asterite> look, we should be discussing how to solve issues in the language like generics, compilation times or parallelism
<Groogy>
though Asterite if you are going to break everyone's code, it should be done before 1.0 :P
<FromGitter>
<asterite> not whether to use `should` or `must` in tests
<FromGitter>
<asterite> these are trivial things
<Groogy>
or weird crashes that I get from time to time ^^
<FromGitter>
<asterite> right
<Groogy>
still haven't found a minimal case on the weird memory access, :/
<FromGitter>
<KevinSjoberg> @asterite I agree. There's definitely plenty of more important things to focus on and I was not expecting people to drop everything and focus on this. I thought it might be a welcomed changed, maybe not replacing should but perhaps as an alias. If it's not, cool.
<FromGitter>
<KevinSjoberg> s/changed/change
<FromGitter>
<asterite> well, we don't have aliases in Crystal (or just a very few that should probably be removed)
<RX14>
With an alias everyone just has to learn both names
<RX14>
So we try to avoid them wherever possible
<Groogy>
Well technically the tests aren't assertive, they explain expectations of the code run right?
<RX14>
There should be one way to do things that everyone knows
<FromGitter>
<KevinSjoberg> <RX14> true. It might actually make it more confusing rather than helping.
<Groogy>
i.e "It *should* behave like this"
<FromGitter>
<asterite> As an alternative, you could open an issue in GitHub and we can see what people think. If many think it's a good change, I guess we could do it
<FromGitter>
<KevinSjoberg> Groogy: Consider who's writing the test. You are, the developer. You know what you expect from the test you write. It either fulfills the assertions or it does not.
<Groogy>
asserts that give hard failure in runtime are assertive if you ask me. Code can perfectly run even if specs fail (if your company is horrible and deadliens are near....)
mamantoha has joined #crystal-lang
<Groogy>
Specs are by nature a specification which can go out of date, can not be relevant anymore. Hence the terminology of "should" fits very well if you ask me
<Groogy>
"When I originally wrote this, this code *should* act like this"
<FromGitter>
<KevinSjoberg> @asterite good point. :)
<Groogy>
I mean isn't there even so you can mark some parts of the specs to not be run since they are known to fail?
<Groogy>
and it marks them with a different symbol
<FromGitter>
<KevinSjoberg> Groogy, there are. I guess it comes down to preference. I was just a bit surprised since a lot of expectation libraries have adapted the expect/to, must/must not semantics.
<Groogy>
¯\(°_o)/¯ I don't keep track of that, don't think I've ever used specs in my entire life professionaly, our production cycles are about 1-2 months
<Groogy>
So I can't say anything about it more than "It's just semantics, as long as the message is clear who cares"
<FromGitter>
<yxhuvud> tbh, if there are changes in tests to be done, I'd much rather have other changes that make my life easier. Like making it possible to do scoped inline methods that is local to the test like it is possible to do in rspec (but that would require some major refactorings). Those would be *very* helpful
snsei has joined #crystal-lang
<FromGitter>
<KevinSjoberg> @yxhuvud that would indeed be very useful. I tend to use helpers in RSpec all the time in favor of `let`s.
snsei has quit [Ping timeout: 246 seconds]
<Papierkorb>
you could use lambdas for really short helper functions
<Groogy>
helper = ->() { do_stuff }?
<Papierkorb>
Groogy: The biggest thing (to me) of using `expect(x).to` over `x.should` is that the expect syntax doesn't clutter Object
<Papierkorb>
Yes, as variables are iirc local in scope in context/describe blocks
<dragonkh>
is there an equivalent for pack and unpack in Crystal? e.g. in ruby - bytes.pack("C*") or data.unpack("H*").
<Groogy>
I do too many invasive stuff on objects when I do my libraries >.<
<Groogy>
at least I try to confine it to mixin modules
<Groogy>
Trashman is probably the word
<Groogy>
worst*
<Papierkorb>
Without having looked at trashmans code, it messing with Object was one of the more reasonable use-cases I could come up with. You are literally inspecting the memory model, surely you need access to it on the level it does its thing
<Papierkorb>
Reminds me that I still have to dive into boehmgc for bindgen/qt. uargh.
rohitpaulk has quit [Ping timeout: 240 seconds]
<Groogy>
Well yeah, I would have liked though a bit more standard hooks in the GC module
<Groogy>
But I couldn't find anything without breaking the GC coompletly
<Papierkorb>
Groogy: Curios about a trivia though, you use C++ @ work right? If you use namespaces, do you have a `namespace X { }` surrounding your implementation, or do you prefix all methods with X:: ?
<Groogy>
we mostly use anonoymous namespaces
<Groogy>
everything else is pdx_mesh, pdx_net, etc
<Groogy>
since our library is C-compliant "in case we anytime in the future want to bind it to other languages"
<Papierkorb>
Huh couldn't that be generated?
<dragonkh>
PapierKorb - to use IO#read_bytes - do I need to create my own class that extends IO and implement #read and #write?
<Groogy>
¯\(°_o)/¯ I mean probably, doesn't matter because we're never doign that. It was just a random decision taken 10 years ago when the first version of the engine was written. We pretty much ignore it now but keep the naming scheme
<Groogy>
Keep in mind we have code in the codebase that is older than some of our newest coders
<Papierkorb>
dragonkh: You want to de/serialize a structure? I'd add a self.from_io(io : IO) and #to_io(io : IO), in which you then call #read/write_bytes (and friends) on the *io*
<Papierkorb>
dragonkh: What's your use case? Are you implementing an existing protocol, or do you need something-RPC?
<dragonkh>
Papierkorb - well I really just want to have the equivalent of Array.pack and Array.unpack from ruby
<Papierkorb>
Those don't find the nature of Crystal
<dragonkh>
hmm
<dragonkh>
Papierkorb - how would I transform this [72_u8, 101_u8, 108_u8, 108_u8, 111_u8] into "Hello"
<dragonkh>
String.new takes a slice - but I have Array(UInt8) there - maybe I can transform Array(UInt8) to Slice(UInt8) and then use String.new
<dragonkh>
ok this works but not sure if it's the best way to do it: a = "Hello".bytes ; slice = Slice.new(a.to_unsafe, a.size) ; p String.new(slice)
<Papierkorb>
Where did you get that array from?
<dragonkh>
it was "Hello".bytes
rohitpaulk has joined #crystal-lang
<dragonkh>
I'm working on base58 encoding and decoding for my bitcoin crypto lib - which is why I'm encountering this byte stuff
<FromGitter>
<yxhuvud> Where do you get your string from? Can you read that as a slice instead, perhaps?
<dragonkh>
perhaps
<Papierkorb>
See how Base64 is implemented
<Papierkorb>
Although I chose to use a naive implementation for Base58
<Papierkorb>
Considering that only addresses use that format, so short strings, its sufficient
<Groogy>
the Base64 encoding at one point was the bottleneck for our save file transfers between clients
<Groogy>
Blob.GetBase64().GetSize() in a loop 👌
Raffy has joined #crystal-lang
<Raffy>
Hi everyone
<Raffy>
Anyone having this on High sierra ?
<Raffy>
No package 'libcrypto' found
<Raffy>
ld: library not found for -lssl
<Raffy>
ld: library not found for -lssl
<FromGitter>
<KevinSjoberg> Raffy: Yes, it can be solved my adding OpenSSL to your pkg-config path.
<FromGitter>
<KevinSjoberg> I have OpenSSL installed via Homebrew (`brew install openssl`). In my `.bashrc` I have the following: `export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig"`.
<Raffy>
yes this is what im trying to do ^^
<Raffy>
$PKG_CONFIG_PATH appears to be empty
<FromGitter>
<KevinSjoberg> Raffy: Then export the above and you're good to go. Given that you have openSSL installed at that path.
mverzilli has joined #crystal-lang
<Raffy>
homebrew says that openssl is already installed, no upgrade possible
<Raffy>
trying exporting...
<Raffy>
ok it seems to work and now I can see my amber web page thank you ;)
rohitpaulk has quit [Ping timeout: 268 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
bijan_ has joined #crystal-lang
<FromGitter>
<asterite> nope
<FromGitter>
<asterite> you need to `xcode-select --install` on the command line
<FromGitter>
<asterite> also install XCode again
<FromGitter>
<asterite> I just upgraded to High Sierra and I had to do that
<Raffy>
you had the openssl issue too ?
<FromGitter>
<asterite> missing `libssl
<RX14>
Macos is a broken build environment
<FromGitter>
<asterite> computers in general are broken
<Raffy>
I saw that on crystal-lang doc but it was for el capitan so I didn't tried
<Raffy>
*try
<Raffy>
gonna do that
<RX14>
@asterite at least you can build things on Linux :)
zaiste has quit [Ping timeout: 256 seconds]
<Raffy>
never had an issue with mac before, with homebrew everything is so easy
<RX14>
Someone needs to make a chroot build environment for macos that just works and doesn't depend on anything apple provides
mverzilli has quit [Quit: Page closed]
<Raffy>
asterite did you need to reboot or something after doing that ?
duane has quit [Ping timeout: 256 seconds]
jokke has quit [Quit: WeeChat 2.0.1]
<FromGitter>
<KevinSjoberg> Raffy: I just did this yesterday. Given that you have command line tools installed, `openssl` and `pkg-config` installed via Homebrew, adding `export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig` to your `.bashrc`, `.zshrc` will solve the problem.
<FromGitter>
<KevinSjoberg> Remember to restart your terminal or `source` the shell file after adding the export.
<FromGitter>
<KevinSjoberg> You can confirm things are setup correctly by running `echo $PKG_CONFIG_PATH` and ensure the given path is present in the output.
<greenbigfrog>
I've been wondering since I started with crystal what the crystal: 93.22.2 in a shard.yml does. anybody able to tell me?
<Papierkorb>
The min version of crystal. dunno if that's actually respected at all
<greenbigfrog>
hm. ok
duane has joined #crystal-lang
<FromGitter>
<xfbs> How do I know what the type of a closure is? The manual just tells me to `Box<>` the closure up, but that's not what I'm trying to do here. What do I have to change? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a6602310ad3e04b1b53b27e]
<Raffy>
just adding the pkg config path was enough for me
rohitpaulk has joined #crystal-lang
<greenbigfrog>
I keep getting confused bywether a exception was raised by myself, or is a other exception. Anyone got any tricks on how to avoid confusing myself?
<FromGitter>
<KevinSjoberg> Raffy: Glad it worked out. 😄
<Raffy>
Ty ;)
snsei has joined #crystal-lang
<Raffy>
this is fast :o
LastWhisper____ has joined #crystal-lang
kp666[m] has quit [*.net *.split]
logen[m] has quit [*.net *.split]
manveru has quit [*.net *.split]
hmans has quit [*.net *.split]
brycek has quit [*.net *.split]
dom96 has quit [*.net *.split]
brycek has joined #crystal-lang
hmans has joined #crystal-lang
manveru has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
<Papierkorb>
greenbigfrog: mh? Compiler errors have a completely different structure than run-time errors, so that's easy to spot. For run-time errors, check the last few lines of the backtrace. If it starts with lib/, it's at least not thrown from inside your code (src/), but from some shard.
<Papierkorb>
and if it's neither lib/ nor src/ at the start, it's in the stdlib
<greenbigfrog>
makes sense... Somehow I just don't look closly enough most of the time...
<greenbigfrog>
I guess I'll just have to git gud
dom96 has joined #crystal-lang
dom96 has quit [Changing host]
dom96 has joined #crystal-lang
logen[m] has joined #crystal-lang
kp666[m] has joined #crystal-lang
<greenbigfrog>
which should I preferably use: `@db.query_one("SELECT sth", &.read(Float64))` or `@db.query_one("SELECT sth", as: Float64)`?
<FromGitter>
<straight-shoota> @Sija All the little formatting comments in #5615 are a little bit distracting from the real design issues... I guess it would probably better to hold back on those minor issues.
<Papierkorb>
greenbigfrog: If both are possible, then either are fine. I'd prefer the latter, as that's less logic on my part, so less that I can mess up.
<Papierkorb>
greenbigfrog: And if it does break, it's more likely I can shift blame on that code :P
<greenbigfrog>
good strategy :)
<greenbigfrog>
is there any performance/memory difference between the two?
<Papierkorb>
I don't know the code, but I could imagine that the second version just calls into the first version providing a block with the `as` argument. That'd make them equivalent-
<greenbigfrog>
makes sense
<greenbigfrog>
thansk!
mark_66 has quit [Remote host closed the connection]
bijan_ is now known as bijan_awaaaay
duane has quit [Ping timeout: 256 seconds]
bijan_awaaaay has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
bijan_ has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
bijan_ is now known as bijan_awaaaay
<FromGitter>
<watzon> What would be the easiest way to fix a library that was using IO as a module before it was switched to a class in 0.24?
bijan_awaaaay has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<oprypin>
watzon, uhhh change `include` to `<`
<FromGitter>
<watzon> Yeah I just figured that out lool
<FromGitter>
<watzon> Now I have an issue where they had a class that was already inheriting from another class an was importing the IO module. Multiple inheritance isn't a thing in Crystal right?
<oprypin>
right. thats bad.
<FromGitter>
<watzon> Crap
<FromGitter>
<watzon> So much for easy lol
<oprypin>
it should not have been done even when it was possible
<FromGitter>
<watzon> Multiple inheritance? Oh yeah I know that's a bad idea. I just don't know yet how I'm going to get around this
<greenbigfrog>
mind sharing the code?
<oprypin>
watzon, change inheritance to compopsition
<oprypin>
still inherit io but have that base class as a member instead
<oprypin>
watzon, just change `abstract class` Node to `module` ¯\_(ツ)_/¯
<greenbigfrog>
that's a coool shards. now I've got sth to test :)
<FromGitter>
<watzon> That sounds like an idea @oprypin
<oprypin>
btw i dont like that IO changes to class
qard has joined #crystal-lang
<FromGitter>
<watzon> Why did it?
<FromGitter>
<watzon> I feel like it was an unnecessary breaking change
<oprypin>
im sure they had their reasons and i'm sure that they're well explained in the PR
<RX14>
because performance
<RX14>
with IO you can reason a lot more about the data layout
<RX14>
with include you're essentially dealing with a ginormous union of every simple implementing type
<RX14>
but with a class you can have one method shared on the base class and type only that
<RX14>
at least thats what Ir ecall from memory
<FromGitter>
<watzon> Ahh that makes sense
<FromGitter>
<watzon> Well I have a PR in for that repo. Seems as though everything works, but their specs aren't really portable so I guess that's my next task
<RX14>
just use the distro 0.24.1 compiler with the new stdlib
<RX14>
just check out the repo, run make deps, and then you can just use the new stdlib without the new compiler
<RX14>
and linking libgc works fine
<greenbigfrog>
plz explain a bit more. you lost me at -3
<RX14>
follow the instructions
<RX14>
like
<RX14>
what I just said?
<RX14>
just don't build a new crystal compiler and you don't have to care about libgc
<RX14>
you only need to use a backported stdlib
<RX14>
not a compiler
<RX14>
so don't bother
<greenbigfrog>
`make deps` was producing `nothing to be done` so that's what was confusing me
<greenbigfrog>
until I cloned the repo again
<RX14>
yeah i'm assuming you are working from a clean repo
<RX14>
you could have just done make clean deps
<greenbigfrog>
thanks :)
<RX14>
or git clean -fdx
<RX14>
and then make deps
<greenbigfrog>
thanks :)
qard has joined #crystal-lang
<FromGitter>
<j8r> How to add a new target triple to Crystal? Is there a way to generate bindings?
<RX14>
yeah, there's a way to create bindings but nobody uses it
<RX14>
just copy an existing folder
<RX14>
and tweak it when it breaks
<RX14>
it's shit advice
<FromGitter>
<j8r> So I copy one, and run the specs to see if there are breakages?
<RX14>
well cross-compile the specs
<RX14>
but sure
<RX14>
actually
<RX14>
cross-compile the compiler
<RX14>
then compile the compiler with the compiler
<RX14>
then run specs
<RX14>
make no sense?
<FromGitter>
<j8r> To sumup, I create the new target, I cross compile the compiler with the new triple as a target. I see if OK or not, else I fix. Finally, I go to my target itself to run the newly created compiler. Am I correct?
<RX14>
mostly
<RX14>
copy the new lib_c folder
<FromGitter>
<j8r> I can copy all the repo
<FromGitter>
<j8r> but not the bin
<RX14>
when you cross-compile you'll get a .o file for the new architecture
<FromGitter>
<j8r> yes, an I link it, right?
<RX14>
you check out the crystal repo on the new target
<RX14>
you run `make deps`
<RX14>
and then you edit the linker command to fix any paths to point to the different path of your new crystal checkout
<RX14>
and then you run it
<RX14>
because there'll be a path to libcrystal.a which changes because the path to your repo checkout isn't the same on the host and target
<FromGitter>
<j8r> The big part is how to fix the target before even compiling :|
<FromGitter>
<j8r> In the wort case i can pust `libcrystal.a` to `/usr/lib`
<RX14>
well @j8r what targets are you going for?
<crystal-gh>
[crystal] straight-shoota opened pull request #5628: Add error handling for invalid redirect path in StaticFileHandler (master...jm/fix/5611) https://git.io/vNVZZ
<FromGitter>
<asterite> that's where all the `lib_c` stuff comes from
<RX14>
it's terribly out of date @asterite
<RX14>
which is why I say "the bindings are not generated"
<RX14>
because the generator is not *useful* for generating new bindings
<RX14>
because all the descriptor files for what's in the bindings are out of date
<FromGitter>
<asterite> Ah, right
<RX14>
because everyone's added stuff manually
<RX14>
it's impossible to sanely advise people for lib_c until we completely make sure that the generated bindings match up to a descriptor which is checked into the main repo
<FromGitter>
<asterite> problem is, if you get the size of a struct wrong, it might work, but later silently fail or corrupt memory
<RX14>
indeed
<RX14>
which is why it needs to be autogenerated
<RX14>
i'm just here to tell everyone the insanity
<FromGitter>
<j8r> @RX14 the aimed targets are `arm-linux-musleabihf` and `aarch64-linux-musl`
<RX14>
hmm
<RX14>
what's the diff between the arm and x86 musl targets anyway
<FromGitter>
<j8r> There is none? I haven't yet done a diff between them, propbaly I should
hightower4 has joined #crystal-lang
<RX14>
find the diff between x86 and 32bit arm on the gnu target
<RX14>
and find the diff between musl and gnu on the x86 target
<RX14>
find out the work required
<FromGitter>
<j8r> yep!
<FromGitter>
<j8r> I was talking about this to open the way of having armhf, arm64, and x86_64 statically linked compilers builded on Alpine :)
<FromGitter>
<j8r> I will work on it this following days
<crystal-gh>
[crystal] chris-huxtable opened pull request #5629: Adds `Array.prepend` and `Array.append`. (master...append-prepend) https://git.io/vNV8P
bijan_ is now known as bijan_awaaaay
bijan_awaaaay has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<dragonkh>
hey - If I have some Json I can do: Block.from_json my_json - and this works fine
<dragonkh>
but is there a way to do the same if I have an Array of Block - rather than just a single Block ?
<FromGitter>
<j8r> You can probably use a macro for this
<dragonkh>
j8r could you elaborate a bit further?
<dragonkh>
j8r actually this worked: Array(Block).from_json chain.to_json
<FromGitter>
<j8r> Nice. What is Block?
<dragonkh>
its a class with a JSON Mapping
<FromGitter>
<j8r> I thought it was a real block, like { some_methods }
<dragonkh>
no no - it's a blockchain block
<FromGitter>
<j8r> more exactly, `&block`
<FromGitter>
<j8r> Ok! On what are you working on, a blockchain in Crystal?!
<crystal-gh>
[crystal] straight-shoota opened pull request #5630: Add handling for invalid responses to Response.from_io (master...jm/fix/response-from-io) https://git.io/vNVRw
<dragonkh>
j8r - yep a small blockchain project in Crystal
<dragonkh>
j8r - currently I have a blockchain server and I can add transactions to blocks, mine blocks and register multiple nodes
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
Raffy has quit [Ping timeout: 256 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
DeBot has quit [Ping timeout: 256 seconds]
manveru has quit [Read error: Connection reset by peer]
aemadrid has quit [Read error: Connection reset by peer]
manveru has joined #crystal-lang
aemadrid has joined #crystal-lang
davic has quit [Ping timeout: 256 seconds]
davic has joined #crystal-lang
moei has quit [Quit: Leaving...]
<FromGitter>
<drosehn> not a good day for me. I thought I'd try to trim down large program of mine to have a minimal example of an error I tripped across, and while doing that I tripped over a completely unrelated error.