ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 265 seconds]
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 268 seconds]
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 240 seconds]
DeBot has quit [*.net *.split]
entel has quit [*.net *.split]
entel has joined #crystal-lang
chachasmooth has quit [Ping timeout: 265 seconds]
f1reflyylmao has joined #crystal-lang
chachasmooth has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
f1reflyylmao is now known as f1refly
chachasmooth has quit [Ping timeout: 245 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Ping timeout: 265 seconds]
chachasmooth has joined #crystal-lang
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 252 seconds]
DTZUZU has joined #crystal-lang
<FromGitter> <nickbclifford> Hmm, having some weird issues with C libraries again (I just can't escape -.-), getting segfaults when trying to dereference an array pointer in Crystal/turn it into a `Slice`, but no such issues when doing the same directly in C
DTZUZU_ has quit [Ping timeout: 260 seconds]
<FromGitter> <nickbclifford> Okay I think I see the issue, it's to do with struct flexible array members, seems like something worth opening a compiler issue about
<FromGitter> <Blacksmoke16> can you share the error/code?
<FromGitter> <nickbclifford> Well, essentially, there seems to be no way to bind to a struct similar to ⏎ ⏎ ```struct list { ⏎ unsigned length;``` [https://gitter.im/crystal-lang/crystal?at=606947be3153ce63a3ba4f53]
<FromGitter> <nickbclifford> Treating it as a `Pointer(LibC::Int)` in a `lib` declaration causes segfaults, and I can't see a way to get `StaticArray` to play nice with it either
<FromGitter> <Blacksmoke16> hm
<FromGitter> <Blacksmoke16> could try and autogen the bindings with https://github.com/crystal-lang/crystal_lib
<FromGitter> <Blacksmoke16> did you try like `data : Array(LibC::Int)`?
<FromGitter> <Blacksmoke16> granted my C knowledge is limited but :shrug:
<FromGitter> <Blacksmoke16> nvm
hendursaga has joined #crystal-lang
hendursa1 has quit [Ping timeout: 240 seconds]
_ht has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
_ht has quit [Remote host closed the connection]
deavmi has quit [Ping timeout: 240 seconds]
<FromGitter> <oprypin:matrix.org> i don't understand, how do I percent-encode stuff??
<FromGitter> <oprypin:matrix.org> Python: `urllib.parse.quote("#") == "%23"`
<FromGitter> <oprypin:matrix.org> Crystal: `URI.encode("# a") == "#%20a"`
<FromGitter> <oprypin:matrix.org> Crystal: `URI.encode_www_form("# a") == "%23+a"`
<FromGitter> <oprypin:matrix.org> `String.build { |io| URI.encode("# a", io, &->URI.unreserved?(UInt8)) } == "%23%20a"`
<FromGitter> <oprypin:matrix.org> is that really what i'm supposed to write every time?
<FromGitter> <oprypin:matrix.org> what is the default `URI.encode` even supposed to do if it doesnt do anything with `#`
<FromGitter> <Daniel-Worrall> `URI.encode_www_form("# a", space_to_plus: false)`
<FromGitter> <Daniel-Worrall> default encodes space to `+`
<FromGitter> <Daniel-Worrall> > By default, the space character (0x20) is encoded as + and + is encoded as %2B. If space_to_plus is false, space character is encoded as %20 and '+' is encoded literally.
<FromGitter> <oprypin:matrix.org> wtf this was the correct implementation, did it get deleted? https://github.com/crystal-lang/crystal/blob/18e76172444c7bd07f58bf360bc21981b667668d/src/uri.cr#L256
deavmi has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> @Daniel-Worrall: note that I'm not encoding a http form
<FromGitter> <Daniel-Worrall> `URI.encode` doesn't escape reserved characters
<FromGitter> <oprypin:matrix.org> @Daniel-Worrall: i can see that, yes
<FromGitter> <Daniel-Worrall> So, is there still confusion on how to percent-code?
<FromGitter> <oprypin:matrix.org> yes in crystals stdlib
<FromGitter> <oprypin:matrix.org> i am making a URL that's referring to an item named "foo#20"
<FromGitter> <Daniel-Worrall> `URI.encode_www_form("foo#20", space_to_plus: false)` is the correct way
<FromGitter> <oprypin:matrix.org> question: how do I make a URL `/items/#{name}` that can be opened
<FromGitter> <oprypin:matrix.org> @Daniel-Worrall: again, I'm not encoding a www form
<FromGitter> <Daniel-Worrall> but since you don't have spaces, you can leave out space_to_plus
<FromGitter> <Daniel-Worrall> I get that, but that's how it's named in the stdlib
<FromGitter> <oprypin:matrix.org> no, it's just a method for a different purpose
<FromGitter> <oprypin:matrix.org> that somehow happens to match what people want in non-form-encoding context
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
<FromGitter> <ryanstout> One quick thing that I'm worried might affect people besides myself. (And sorry to be "that guy") When I went to https://crystal-lang.org/ and hit learn, I didn't see the "Next" links or any navigation elements to tell me that I'm in a full guide/tutorial, since the "Next" stuff only shows up once you get to the bottom of the page. I must have looked at that page 5 times thinking "where is the tutorial stuff"
<FromGitter> ... (Which I remember from that past)
<FromGitter> <ryanstout> Having the full tutorial tree on the left would be one solution (so you could jump past the install stuff if you already have it installed for example)
<FromGitter> <oprypin:matrix.org> @ryanstout: i dunno, like, the navigation split was an explicit decision to change. didn't you see the navigation tabs at the top? ⏎ the obvious small takeaway i have is this though: https://github.com/crystal-lang/crystal-website/pull/129
<FromGitter> <asterite> It's strange that Learn doesn't take you to the reference. I agree it's pretty confusing
DTZUZO has joined #crystal-lang
DTZUZO has quit [Client Quit]
DTZUZO has joined #crystal-lang
_ht has joined #crystal-lang
ua has quit [Ping timeout: 265 seconds]
ua has joined #crystal-lang
deavmi has quit [Quit: No Ping reply in 180 seconds.]
deavmi has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter> <oprypin:matrix.org> i recapped my thoughts on `URI.escape` and commented here: https://github.com/crystal-lang/crystal/pull/7997#issuecomment-813096783 cc @Daniel-Worrall
postmodern has quit [Quit: Leaving]
<FromGitter> <ryanstout> @oprypin:matrix.org the top nav disappears once you scroll, at least on my screen size. Totally understand there is some variance in opinion here, but I think the value in having a full hierarchy of "learn X language" sections visible is so you can quickly figure out what parts you need to read to learn something. Seems to be a common paradigm also: https://doc.rust-lang.org/book/
<FromGitter> ... https://docs.python.org/3/tutorial/index.html https://nim-lang.org/docs/tut1.html Anyway, just wanted to convey my experience. Thanks everyone for the hard work on Crystal!
<FromGitter> <Blacksmoke16> you can make it so the tabs are sticky, might be worth it?