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
MasterdonX has quit [Remote host closed the connection]
aquijoule_ has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
aquijoule__ has quit [Ping timeout: 272 seconds]
hightower2 has joined #crystal-lang
V[excess] is now known as ^
fifr_ has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
fifr has quit [Ping timeout: 256 seconds]
deavmi has quit [Ping timeout: 264 seconds]
hightower3 has joined #crystal-lang
aquijoule__ has joined #crystal-lang
aquijoule_ has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> @asterite ⏎ ⏎ ``` def to_s ⏎ colorize texts[1].downcase ⏎ end``` ⏎ ⏎ did you mean to define a non io overload? [https://gitter.im/crystal-lang/crystal?at=60078fd1410c2214400debab]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
aquijoule_ has joined #crystal-lang
aquijoule__ has quit [Ping timeout: 264 seconds]
avane has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
ua has quit [Max SendQ exceeded]
<FromGitter> <Blacksmoke16> repo raz @jrei:matrix.org https://github.com/athena-framework/config/issues/9 if you guys have any specific thoughts/suggestions/feedback based on that convo we had a while ago, and/or your experiences/opinions
<FromGitter> <Blacksmoke16> (scroll to the last section if you want the tl;dr on what I'm leaning towards)
_ht has joined #crystal-lang
mertyildiran has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
<raz> yup the described approach looks good to me. just a singleton (or something i can access from everywhere) that can be populated from YAML, env, etc.
<raz> in practice i think most people prefer env for everything anyway (i certainly do). config files are just always a headache when dealing with multiple envs/devs, preventing stuff from leaking into git, multi-file deploys etc.
<repo> hey web people! do you know if it's possible to tell a client with some response headers not to send specific headers to the url specified in the location header in a temporary redirect response?
<repo> i want to prevent leaking of authorization headers
deavmi has quit [Ping timeout: 265 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
<raz> hmmm
<raz> i'm surprised it sends the header at all. shouldn't that normally we stripped when following a redirect?
<raz> maybe, if it's the same domain, browsers are more lax about it. i don't think there's really a response-header to control it. (possibly it could be done indirectly with CORS, but... don't think i'd want to rely on such)
deavmi has joined #crystal-lang
avane has quit [Ping timeout: 240 seconds]
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
avane has joined #crystal-lang
<repo> raz: hm yeah it's the same domain
<repo> (localhost even)
<repo> i wouldn't care because both services are owned by me but sending the header results in an invalid request from minio's perspective
<repo> seems like it actually checks the host
<FromGitter> <asterite> @Blacksmoke16 I program in Ruby during the day so sometimes I mix things, hehe :-)
<FromGitter> <Blacksmoke16> 😉
ua has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
<hightower3> is there an off the shelf class I can use for a circular buffer? Like if I want it to contain 200 elements, replacing oldest ones as new ones come in?
<hightower3> but I would have to remove excess elements, right?
<FromGitter> <Blacksmoke16> ```# Remove old ⏎ d.pop ⏎ ⏎ # Add new ⏎ d << new_value``` [https://gitter.im/crystal-lang/crystal?at=600838c36b20cf7730c7b6dd]
<hightower3> I'm not clear from the description if it is just a basis for implementing a circ buffer or it actually behaves as one
<FromGitter> <Blacksmoke16> its deff not going to auto remove items over some max capacity
<FromGitter> <Blacksmoke16> but thats easy enough to do
<hightower3> yes, yes, just asking, ok great thanks
riffraff169 has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
<hightower3> I am writing to an IO::Memory and at some point I need to check if the last thing written was ';'. Is there a nicer way to do it than seeking -1, peeking, and then leaving it at that or again seeking by +1 if it wasn't ';'?
<hightower3> actually found a way to solve it by comparing size rather than checking the char, but still interested in the answer in general
<repo> Blacksmoke16: "A description may also be included to describe what the query param is used for. In the future this may be used for generating OpenAPI documentation for the related parameter."
<repo> holy shit!
<repo> that would be a dream come true!
<FromGitter> <Blacksmoke16> 😆 yea, we're at a point where doing something like that would be possible as you can access all the defined routes and the data associated with them
<FromGitter> <asterite> hightower3: you can call `to_slice` on it and check that
hightower3 has quit [Read error: Connection reset by peer]
hightower2 has joined #crystal-lang
duane has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
<repo> Blacksmoke16: hm not sure if i found a bug or if it's my own stupidity again, but should be easy to reproduce either way: I'm missing a VirtualProperty from the serialized json. I use groups and have defined them on the method as well (also set ASRA::Expose)
<repo> i'll set up a minimal example, one sec
<FromGitter> <Blacksmoke16> i think its a bug
<FromGitter> <Blacksmoke16> doesnt look like im including groups on virtual properties
<FromGitter> <Blacksmoke16> not including*
<repo> ah ok
<repo> also not since_version and until_version
<repo> is it just a matter of adding them here?
<FromGitter> <Blacksmoke16> pretty much, i can grab it in a few
<repo> <3
<FromGitter> <Blacksmoke16> serializer component is my least favorite 😆
<repo> Blacksmoke16: how come?
<repo> it's super useful :)
<repo> fwiw i like it a lot :)
<FromGitter> <Blacksmoke16> lets just say it could use another pass, not a fan of the implementation and some stuff i did 🙈
<repo> hm
<FromGitter> <Blacksmoke16> always feel like its going to explode ha
<repo> do you already know what you would do differently now?
<FromGitter> <Blacksmoke16> but seems to be doing fairly well for you, so thats a good sign
<repo> yeah it's a joy to use :)
<FromGitter> <Blacksmoke16> i'm not sure, just feel like there is a better implementation come be achieved
<FromGitter> <Blacksmoke16> could be*
<repo> mhm
<repo> i think the visitor pattern works quite well here
<FromGitter> <Blacksmoke16> main 2 things i'm not a fan of are like 1) How easy it is to get into a state where your obj just returns `null` just because something couldnt be serialized
<FromGitter> <Blacksmoke16> and 2) how i implemented discriminator maps for deserialization
<FromGitter> <Blacksmoke16> ill save it for `0.3.0` :P
<repo> yeah ok
f1reflyylmao is now known as f1refly
<repo> Blacksmoke16: sweet \o/
<repo> hm i'm struggling with https://tools.ietf.org/html/rfc5987 a bit.. is this basically just an URI.encode(...) for the UTF-8 extension?
mertyildiran has joined #crystal-lang
<FromGitter> <watzon> Is there anyone that would be happy to see a Couchbase SDK library in Crystal?
<FromGitter> <watzon> Because I'm working on one, but it's hard and I need motivation lol
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> is that the same thing as couchdb?
<FromGitter> <phillvancejr> Hello, will Crystal garbage collect everything at program exit? Specifically I'd like to know if finalize methods are called. I'm wrapping a C++ class in a Crystal class and I clean up the C++ with a Crystal finalize method. The C++ destructor is called if I set the Crystal object to nil then call GC.collect, however if I don't do this I don't see my destructor message. Is this memory leaking? Do I have
<FromGitter> ... to call the garbage collector manually to clean this up?
<FromGitter> <RespiteSage> If you're allocating something in program memory, the OS should clean it up when the program ends, regardless of whether it was leaking within the program while it was running.
<straight-shoota> When the program exits, there's no need for garbage collection because all memory is freed regardless
<FromGitter> <phillvancejr> thank you @RespiteSage @FromIRC !
<FromGitter> <phillvancejr> thanks @straight-shoota !
<FromGitter> <RespiteSage> I'm curious, though: how are you wrapping a C++ class?
<FromGitter> <phillvancejr> I'm writing a C wrapper first
<FromGitter> <phillvancejr> So I suppose I should have said binding to a C wrapper for a C++ class
<FromGitter> <RespiteSage> Okay, gotcha. I think it's fine you didn't say that, but I was just wondering if you were trying to bind directly to C++ somehow.
<FromGitter> <phillvancejr> is it possible to get the name of the current method in Crystal? In ruby I can do this: ⏎ ⏎ ```def func ⏎ name = __method__.to_s ⏎ name ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=600891333855dd07fd694fd5]
<FromGitter> <Blacksmoke16> `{{@def.name.stringify}}`
<FromGitter> <phillvancejr> Thanks @Blacksmoke16 !!
<FromGitter> <asterite> TIL :-)
<FromGitter> <watzon> @Blacksmoke16 not the same as couchdb, though it is similar in that it's a nosql database.
<FromGitter> <Blacksmoke16> thats not confusing ha
<FromGitter> <watzon> Yeah idk why they chose that name lol
hightower2 has joined #crystal-lang
<hightower2> Hey btw, does crystal work only on systems supporting utf-8?
<FromGitter> <oprypin:matrix.org> hightower2, what does it mean for a system to support utf-8
<hightower2> I mean the String class "represents an immutable sequence of UTF-8 characters". Does doing that depends at all on the OS/environment features?
_ht has quit [Remote host closed the connection]
<FromGitter> <jrei:matrix.org> no
<FromGitter> <jrei:matrix.org> thankfully
<hightower2> great, thanks
<FromGitter> <jrei:matrix.org> and it is not like Python with `# -*- coding: utf-8 -*-`
<hightower2> haha
duane has joined #crystal-lang
hightower2 has quit [Ping timeout: 264 seconds]
sagax has quit [Ping timeout: 272 seconds]
<repo> Blacksmoke16: do you know if composition can somehow work with athena-serializer? As in: define properties/methods in a module, add ASR annotations and include the module in a class?
<FromGitter> <Blacksmoke16> pretty sure that should work
ua has quit [Excess Flood]
<FromGitter> <HertzDevil> til you can use `*_` in type restrictions
<FromGitter> <Blacksmoke16> splat of any type?
ua has joined #crystal-lang
mertyildiran has quit [Quit: WeeChat 2.8]
<FromGitter> <HertzDevil> i really should start formalizing crystal's type system even if nobody else does
<FromGitter> <HertzDevil> this is what i was talking about `NamedTuple`s