<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>
<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>
<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>
<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> 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
<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>
<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> 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>
<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