ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.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
<travis-ci> crystal-lang/crystal#61b4505 (master - Merge pull request #8988 from crystal-lang/ci/update): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/669934223
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8988 (CI: Update distribution-scripts)
<FromGitter> <smalls12> does that mean 0.34.0 ?
<FromGitter> <stronny> wat ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e8536708bb4966bc49d74b2]
<FromGitter> <Blacksmoke16> makes sense
<FromGitter> <Blacksmoke16> would need to define another that doesnt take a splat
<FromGitter> <stronny> why
<FromGitter> <stronny> because we can't have an empty tuple? We can by the way
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
nowhereFast has joined #crystal-lang
nowhereFast has left #crystal-lang [#crystal-lang]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <naturalmechanics> hi
<FromGitter> <naturalmechanics> numercial computaion experts wants to fork crystal, and interface it with julia and mess with its type system.
<FromGitter> <naturalmechanics> what is he legally allowed to do, and what not?
<FromGitter> <stronny> I suggest he should seek advice from a lawyer, not from chat experts =)
<FromGitter> <tenebrousedge> theoretically I think apache and MIT are more-or-less compatible licenses, and Julia I guess is also a LLVM language, so it's not totally crazy, but it sounds like a bear. I would hope that type system improvements were contributed upstream
<FromGitter> <stronny> remains to see if the result is universally useful
chachasmooth has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <naturalmechanics> > remains to see if the result is universally useful ⏎ ⏎ most likely its not. just decided to [expletive deleted] around due to corona and stuff
<FromGitter> <stronny> that's cool
chachasmooth has joined #crystal-lang
<FromGitter> <naturalmechanics> > I personally don't like the `class A(T = B)` syntax, though. ⏎ ⏎ Taking inspiration for D, I will make it `class A with T B, T1 B1 .....`
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <stronny> Crystal already has its idiomatic syntax
<FromGitter> <naturalmechanics> i know, i still really want to mess around
<FromGitter> <stronny> the idea is to extend it, hopefully reusing existing concepts
<FromGitter> <naturalmechanics> ok
<FromGitter> <naturalmechanics> what are some possible ideas of extension on the table?
<FromGitter> <stronny> I think the syntax is a lesser problem
<FromGitter> <stronny> I think I saw these: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e854ff4d1e1b562c008b914]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <muraray> Got a very novice question
<FromGitter> <grkek> What are your thoughts about adding a "hidden" switch to the JSON mappings macro parser? ⏎ ⏎ It will simply just hide the value which is marked with `hidden: true`. There will be two function definitions needed for it to work, `to_unsafe` and `to_safe` which will generate JSON data respectively via checking the hidden tag and letting the value stored in memory pass through or not.
<FromGitter> <muraray> how do I show a default file while serving the static file handler? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e8566e454f5db55502853d7]
<FromGitter> <muraray> ./path may contain index.html or default.html
<FromGitter> <grkek> @muraray You want a index page whenever someone visits the `/` right?
<FromGitter> <muraray> yeah, just going to the doc possible to do via Static file handler "/"
<FromGitter> <grkek> You could always use a custom handler to filter out the route and respond if it matches the `/`.
<FromGitter> <muraray> ok, let me try
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e856a39ce52b730ac23e8c1]
<FromGitter> <grkek> @muraray you could try something like that
<FromGitter> <grkek> also I found a bug in the carc.in online compiler, it apparently renders HTML directly to the DOM, and it doesn't mind rendering the javascript as well so here is an XSS quickie https://carc.in/#/r/8tf7
<FromGitter> <grkek> the very same works on the crystals web playground https://play.crystal-lang.org/#/r/8tf8
<FromGitter> <muraray> thanks for the detailed example, though the one am looking at is when you serve the static files via default handler, the default page is not getting server
<FromGitter> <muraray> example, if the public path has an "index.html" or "default.html" like how apache or iis servers look for default files to serve when user browse "/" instead of typing "index.html" along with the host url
<FromGitter> <grkek> You might want to edit the StaticFileHandler directly or just inherit from it and add a check if the requested resource is `/`
<FromGitter> <muraray> yes that's what i'm doing now let me try few other options
<FromGitter> <grkek> I can edit the StaticFileHandler, Ill try something
sz0 has quit [Quit: Connection closed for inactivity]
snosk8r has quit [Quit: Leaving]
darkstardev13 has joined #crystal-lang
<FromGitter> <grkek> @muraray https://carc.in/#/r/8tf9 here is an example, I extended the StaticFileHandler call function the extension starts at line 27 and ends at line 40.
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <muraray> wow, thanks to a ton I was on the IO.copy(file, context.response) part.
<FromGitter> <muraray> this is very detailed thanks
<FromGitter> <muraray> MIME.from_filename is default crystal function is it?
<FromGitter> <grkek> No problem, make sure to check out Grip :) https://github.com/grip-framework/grip
<FromGitter> <muraray> oh, great will take a look at it
<FromGitter> <grkek> that is yeah a crystal default function I think
<FromGitter> <grkek> keep in mind that you are still able to browse the /index.html
<FromGitter> <grkek> since it is a file it allows you to browse it
<FromGitter> <grkek> messing around with the online compiler is just too much fun
teardown has joined #crystal-lang
_ht has joined #crystal-lang
sz0 has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
erdnaxeli has quit [Quit: killed]
juanfra_ has quit [Quit: killed]
beepdog has quit [Quit: killed]
watzon has quit [Quit: killed]
olbat[m] has quit [Quit: killed]
<FromGitter> <Afront> While skimming through Rosetta's Code to see if there's a more efficient way to do mergesort, I found this Elixir code snippet ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I was wondering if there's an equivalent way to do it in Crystal (what I had in mind was making a child class of Array) since I immediately thought that there are probably some use cases for overloading methods based on the size of the array
<FromGitter> ... or any other enumerable when I found the snippet. [https://gitter.im/crystal-lang/crystal?at=5e8594af247bfd6edb984d2d]
<livcd> Does Crystal have something like cargo check?
<FromGitter> <Afront> `shards check`?
<FromGitter> <Afront> or I guess `shards install` and `shards update` work as well
erdnaxeli has joined #crystal-lang
ur5us has joined #crystal-lang
beepdog has joined #crystal-lang
juanfra_ has joined #crystal-lang
olbat[m] has joined #crystal-lang
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 265 seconds]
_ht has quit [Remote host closed the connection]
sz0 has quit []
sz0 has joined #crystal-lang
_ht has joined #crystal-lang
sagax has quit [Read error: Connection reset by peer]
<FromGitter> <grkek> you can just do `shards` and it does everything you want it to do
<FromGitter> <grkek> @Afront here is a quick example https://play.crystal-lang.org/#/r/8tg0
_ht has quit [Remote host closed the connection]
zorp has joined #crystal-lang
_ht has joined #crystal-lang
ur5us has quit [Ping timeout: 252 seconds]
ht_ has joined #crystal-lang
_ht has quit [Ping timeout: 265 seconds]
ht_ is now known as _ht
<FromGitter> <ImAHopelessDev_gitlab> aww method overloading
<FromGitter> <wout> Is there a way to sort a hash by its keys?
<FromGitter> <ImAHopelessDev_gitlab> "let's have methods do different things, even though they have the same name!"
<oprypin> @wout: `.to_a.sort.to_h` i think
<FromGitter> <wout> @oprypin Does the trick. Thanks!
<FromGitter> <grkek> > .to_a.sort.to_h ⏎ that looks horrible
<oprypin> oh consider .sort! instead
<FromGitter> <lbarasti> Question on `Iterator`: is there a way to get the `next` element in an Iterator *without* consuming it?
<FromGitter> <wout> @grkek I agree. Is it something that stell needs to be implemented?
<FromGitter> <lbarasti> something like a `peek`
<oprypin> lbarasti: generally no
<FromGitter> <grkek> It is still considered as consumption
<FromGitter> <grkek> you can lie to yourself by creating a peek function which displays the next element and say that you peeked
<FromGitter> <lbarasti> BTW @wout ⏎ ⏎ > Is there a way to sort a hash by its keys? ⏎ ⏎ Hashes are unsorted, in general. Even `to_a.sort.to_h` doesn't guarantee ordering [https://gitter.im/crystal-lang/crystal?at=5e85bccefc996c4a3b8acd62]
<oprypin> lbarasti: no, hash is guaranteed insertion order
<FromGitter> <lbarasti> Thanks @grkek!
<FromGitter> <lbarasti> oprypin, do you say that because it appears in the documentation? Or because it happens to be the case that `Hash#keys` returns the keys in the order they were inserted?
<oprypin> it's in docs too
<oprypin> > Enumeration follows the order that the corresponding keys were inserted.
<FromGitter> <wout> @lbarasti Yes, I noticed by comparing `{"order" => "title", "page" => "1"} == {"page" => "1", "order" => "title"} # => true`:
<FromGitter> <lbarasti> Ah! I just learned something, thanks oprypin
<FromGitter> <wout> But then serializing them to query params for example, the result is not the same.
<FromGitter> <grkek> What do you guys think of this? https://github.com/jhass/carc.in/issues/17
<FromGitter> <lbarasti> that is not the default behaviour in other languages. I would not rely on that fact, in general. If the underlying implementation of Hash changes, then everything built on that assumption breaks
<oprypin> @grkek: i think "oof"
<FromGitter> <lbarasti> I'd rather have a SortedHash class
<oprypin> @lbarasti: it is that way in Ruby and Python
<FromGitter> <lbarasti> but it is implementation dependent, isn't it?
<oprypin> c++ had a weird map that relied on order even without using actual hashes
<oprypin> @lbarasti: guaranteed in Python. im guessing in Ruby too but not sure
<FromGitter> <lbarasti> 👍
<FromGitter> <grkek> I don't like sorted hashes, it makes me very angry to look at them all sorted out.
<oprypin> they say that this implementation has no downside compared to not preserving the order
<FromGitter> <lbarasti> > But then serializing them to query params for example, the result is not the same. ⏎ ⏎ Yes, that's why I don't think it's safe to rely on that
<FromGitter> <wout> @lbarasti OK, thanks for the insights. So converting to an array will be the safest bet anyway.
<FromGitter> <lbarasti> I think so @wout, also mind that `Hash#map` returns an `Array`, so if you're transforming the content of the Hash to stringify, for example, you won't need the extra `.to_a` call
<FromGitter> <wout> Much better. :) `hash.map(&.join('=')).sort!`
postmodern has quit [Quit: Leaving]
<oprypin> mmm there are probably edge cases where that produces a different order
sagax has joined #crystal-lang
<oprypin> "a5" < "a55" but "a5=1" > "a55=1"
<oprypin> do not recommend.
<FromGitter> <wout> @oprypin The purpose is to test a series of given params against the current query params in the request. The only thing we need to know if they are exactly the same.
<FromGitter> <wout> So the actual sort order doesn't matter.
<FromGitter> <wout> Another question. Why is `hash.map(&.join("=")).sort!` 2x faster than `hash.map(&.join('=')).sort!`?
<FromGitter> <wout> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e85c2afcce9e155f43f778c]
<FromGitter> <wout> Is it because char needs to be converted to string?
<FromGitter> <grkek> Wow that's interesting, it depends what you use for the hash key type doesn't it?
<oprypin> @wout: i don't understand the aversion towards Hash#== then
<oprypin> that is conceptually *the* operation that you want
<FromGitter> <wout> @oprypin It's part of a larger method. We need to test the whole uri, including params. The come in as strings but the query params can have different orders. So they need to be normalized first.
<FromGitter> <grkek> In case of the hash-map key value being string ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e85c51d01c85847b2cec5d3]
<FromGitter> <wout> @grkek 👍
<FromGitter> <grkek> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ht has quit [Quit: _ht]
_ht has joined #crystal-lang
darkstardevx has quit [Quit: Leaving]
sorcus has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Quit: bye fags]
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
sorcus has joined #crystal-lang
deavmi has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
deavmi has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#317d916 (master - Add missing `Regex#hash` and `Regex::MatchData#hash` (#8986)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/670196183
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8986 (Add missing `Regex#hash` and `Regex::MatchData#hash`)
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> why this bot keep posting build results
<FromGitter> <Blacksmoke16> its when stuff gets merged
<FromGitter> <ImAHopelessDev_gitlab> i know but why
<FromGitter> <ImAHopelessDev_gitlab> it hasn't done this for 2 years
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <straight-shoota> Maybe someone fixed it =) ?
<FromGitter> <kinxer> I *would* be nice if the bot that gives links to issues didn't always trigger after the travis-ci bot, but that may be a disproportionate effort to the benefit.
rohitpaulk has joined #crystal-lang
ht_ has joined #crystal-lang
_ht has quit [Ping timeout: 265 seconds]
ht_ is now known as _ht
postmodern has joined #crystal-lang
<FromGitter> <sam0x17> so I have a HTTP::Response that has a `set-cookie` header in it, but when I call `response.cookies` I get no cookies :/
<FromGitter> <sam0x17> I've tried printing the header and I could just manually parse it and construct a cookie, but that feels wrong
<FromGitter> <sam0x17> ```code paste, see link``` ⏎ ⏎ And when I call `HTTP::Cookies.from_headers(headers)` on that I get a blank cookie set [https://gitter.im/crystal-lang/crystal?at=5e8639a4c05284385ae83761]
<FromGitter> <Blacksmoke16> are you manually setting the header/
<FromGitter> <sam0x17> no this is from a real server
<FromGitter> <sam0x17> from an `HTTP::Client.post`
<FromGitter> <Blacksmoke16> looks like thats what it should be doing
<FromGitter> <sam0x17> yeah and I've tried that manually as well
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/blob/317d91619700cfb91b9734d75fa5c38df9ab62c7/src/http/cookie.cr#L172 unless this doesnt handle lowercase `set-cookie`/
<FromGitter> <sam0x17> was just thinking that
<FromGitter> <sam0x17> I tried setting `headers["Set-Cookie"] = headers["set-cookie"]` to try to fix that
<FromGitter> <sam0x17> but apparently it just ignored that
<FromGitter> <sam0x17> so yeah this is probably a bug where there should be some downcasing
<FromGitter> <sam0x17> I'll make a PR if you guys agree `set-cookie` should be handled like `Set-Cookie`
<FromGitter> <Blacksmoke16> id confirm thats the issue, but yeah headers are case insensitive
<FromGitter> <sam0x17> yeah my guess is `headers.get?` is being case sensitive
sagax has quit [Read error: Connection reset by peer]
ht_ has joined #crystal-lang
_ht has quit [Ping timeout: 256 seconds]
ht_ is now known as _ht
_ht has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
sagax has joined #crystal-lang
ur5us has joined #crystal-lang
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#aaa1851 (master - Let `SemanticVersion::Prerelease` include `Comparable` (#8991)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/670300869
<DeBot> https://github.com/crystal-lang/crystal/pull/8991 (Make `SemanticVersion::Prerelease` comparable)
<travis-ci> crystal-lang/crystal#ab8b044 (master - Use enum instead of module for HTTP::WebSocket::CloseCodes (#8981)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/670301670
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
DTZUZU2 is now known as DTZUZU
_ht has quit [Quit: _ht]
darkstardev13 has quit [Quit: Leaving]
<FromGitter> <jwoertink> Anyone else come across this?
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e86632026dafb36651d969e]
<FromGitter> <jwoertink> running `shards update` during my deployment now throws this
<FromGitter> <stronny> probably stack overflow
<FromGitter> <stronny> much recursion
<FromGitter> <Blacksmoke16> Using new shards version?
<FromGitter> <stronny> what was that about a new resolver?
<FromGitter> <jwoertink> No. I don't think so
deavmi has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <stronny> just a guess
<FromGitter> <jwoertink> > FROM crystallang/crystal:0.33.0
<FromGitter> <jwoertink> yeah, just using that in Docker
<FromGitter> <jwoertink> unless that pulls in the latest one now?
<FromGitter> <stronny> aren't shards separate?
<FromGitter> <jwoertink> I didn't think they were
deavmi has joined #crystal-lang
<FromGitter> <stronny> ```Last pushed ⏎ 2 months ago by bcardiff``` [https://gitter.im/crystal-lang/crystal?at=5e8664098985c20da2e40283]
<FromGitter> <jwoertink> Is there a way to run `shards update` and ignore the `development_dependencies`?
<FromGitter> <Blacksmoke16> --production maybe
<FromGitter> <jwoertink> checking
<FromGitter> <stronny> ```code paste, see link``` ⏎ ⏎ hey look at that, shards has a man page! [https://gitter.im/crystal-lang/crystal?at=5e8665b698959a4d483d8c03]
<FromGitter> <stronny> there's also `--verbose`
<FromGitter> <jwoertink> yeah, looks like that worked. Thanks!
darkstardevx has joined #crystal-lang
<travis-ci> crystal-lang/crystal#768c1ee (master - add Location to HTTP::Request common header names (#8992)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/670337002
travis-ci has joined #crystal-lang
<DeBot> https://github.com/crystal-lang/crystal/pull/8992 (add Location to HTTP::Request common header names)
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#a691846 (master - Fix several typos throughout the codebase (#8971)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/670337851
<DeBot> https://github.com/crystal-lang/crystal/pull/8971 (Fix several typos throughout the codebase)
<sagax> hi all!
<sagax> how to puts without new line?
<FromGitter> <Blacksmoke16> print
<sagax> thanks
watzon has joined #crystal-lang
bazaar has quit [Ping timeout: 268 seconds]
<FromGitter> <wilian1808> ```cr```
bazaar has joined #crystal-lang