ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | 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
alexherbo20 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <ImAHopelessDev_gitlab> plural i'm pretty sure, cause the (s)
<FromGitter> <ImAHopelessDev_gitlab> but i bet a linguistic can craft a sentence to make it sound singular...
go|dfish has quit [Ping timeout: 240 seconds]
dwdv has joined #crystal-lang
<dwdv> Should `.reduce(Set{{0,0}})` be allowed syntax-wise? Currently I have to do `.reduce(Set{ {0,0} })`.
<FromGitter> <Blacksmoke16> Probably is conflicting with the macro syntax
<dwdv> Almost like the good old `> >` in pre-C++11 land, eh? :)
<FromGitter> <tenebrousedge> `reduce(Set.new({0,0}))` seems like a thing there
<dwdv> Negative, gives me a `Set{0}`.
<dwdv> `Error: no overload matches 'Set(Int32)#<<' with type Tuple(Int32, Int32)`
<dwdv> Anyway, thanks again for your time, heading to bed. Have a good one.
dwdv has quit [Ping timeout: 240 seconds]
<FromGitter> <Daniel-Worrall> Alexherbo20, singular is difference. Plural is difference if it is uncountable or differences if countable. I thought the link was clear
baweaver has quit [Excess Flood]
baweaver has joined #crystal-lang
<FromGitter> <AmberSaber> When I upgrade crystal, I usually have to upgrade llvm. But the upgrade of llvm has been going on for two days, and it's not over
<FromGitter> <Blacksmoke16> Oh?
<FromGitter> <Blacksmoke16> How did you install crystal?
<FromGitter> <sdogruyol> I'll try my best to translate the talk and add captions...also open to present in another conferences :)
<FromGitter> <sdogruyol> Now to announce my new project
<FromGitter> <sdogruyol> Friends of Crystal is here! https://twitter.com/sdogruyol/status/1185386255120556033
<FromGitter> <sdogruyol> Please share and let's spread the Crystal love ❤️ Thanks everyone
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
<FromGitter> <confact> Looking for partners who want to help maintain and contribute on a stripe crystal library: https://github.com/confact/stripe.cr
chemist69 has quit [Ping timeout: 245 seconds]
chemist69 has joined #crystal-lang
_whitelogger has joined #crystal-lang
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
sagax has quit [Read error: Connection reset by peer]
sagax has joined #crystal-lang
<FromGitter> <zenithlight> I want to generate API request classes using definitions from a YAML file. Is there an established pattern for this?
ht_ has joined #crystal-lang
go|dfish has joined #crystal-lang
dwdv has joined #crystal-lang
blassin6 has quit [Quit: The Lounge - https://thelounge.chat]
go|dfish has quit [Ping timeout: 240 seconds]
<FromGitter> <absolutejam_twitter> Swagger?
<FromGitter> <bajro17> @sdogruyol also please your yt SEO if I type crystal lang it dont show me just in tags add crystal lang
<FromGitter> <bajro17> also it will be good on crystal lang website put like remainder for people who create yt videos to use crystal lang tag
alexherbo2 has joined #crystal-lang
<FromGitter> <sam0x17> we should just go back in time and erase crystal reports and the "healing crystals" movement
<FromGitter> <kefahi> Hello, I'm done with maintaining a very basic JSON schema validation library based on a 4-years old code. In case any one is interested to further mature. Thanks!
<FromGitter> <zenithlight> @absolutejam_twitter wondering if there is already a package for crystal code generation fro swagger
<FromGitter> <kefahi> On another front, I'm searching for a library that can do PGP. To my knowledge neither sodium or ssl could do that. Generating keys, signing, verifying ...etc.
_whitelogger has joined #crystal-lang
<FromGitter> <sdogruyol> @bajro17 good one! Thanks!
<FromGitter> <sdogruyol> @kefahi amazing! Great job on reviving the project :)
xyproto has left #crystal-lang ["WeeChat 2.6"]
alexherbo26 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 265 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
alexherbo26 has quit [Ping timeout: 265 seconds]
alexherbo26 has joined #crystal-lang
<FromGitter> <eliasjpr> Int.months and int.year should be returning Time::Span not Time::MonthSpan
<FromGitter> <eliasjpr> It makes the api inconsistent
apg has joined #crystal-lang
<FromGitter> <sam0x17> @asterite what was your plan for dealing with unions with marshaling? I'm at that point where that's all I have to deal with now. I'm in a place where if I know the particular type of the object that was stored in the union, I'm good, but I'm probably going to have to modify things so I store the actual type along with the object data (just in the case of unions).
<FromGitter> <sam0x17> e.g. out of the box, I get this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dab5dffea0d6159fd9368e1]
<FromGitter> <sam0x17> my goal is to support `JSON::Any` without writing any special handling particular to `JSON::Any`
<FromGitter> <sam0x17> the lazy way out obviously is just storing via `.to_json` and loading via `JSON.parse`
<FromGitter> <ilanpillemer> `Unhandled exception: Arithmetic overflow (OverflowError)`
<FromGitter> <ilanpillemer> is there in anyway of not getting such a thing?
<FromGitter> <tenebrousedge> a couple ways. Probably the best option is using a type big enough for your result
<FromGitter> <ilanpillemer> It happens when I concat two string
<FromGitter> <tenebrousedge> wat
<FromGitter> <tenebrousedge> um...example?
<FromGitter> <ilanpillemer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dab6005fa637359fcaa3359]
<FromGitter> <ilanpillemer> and here is the input
absolutejam2 has joined #crystal-lang
<FromGitter> <tenebrousedge> jfc
<FromGitter> <tenebrousedge> what's your code look like though?
<FromGitter> <ilanpillemer> here is my icky non idiomatic code
<FromGitter> <ilanpillemer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dab6072ea0d6159fd937c6f]
<FromGitter> <Blacksmoke16> whats causing the error?
<FromGitter> <ilanpillemer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dab608e0fdc4b65071959db]
<FromGitter> <ilanpillemer> so I am guessig the string is becoming too big
<FromGitter> <tenebrousedge> s/string/array
<FromGitter> <Blacksmoke16> you can do like `&*`
<FromGitter> <Blacksmoke16> which would wrap on overflow vs error
<FromGitter> <Blacksmoke16> but obs still wouldnt fix your issue
<FromGitter> <ilanpillemer> how big can a string get?
<FromGitter> <tenebrousedge> and overriding array#concat is also a bad idea
<FromGitter> <tenebrousedge> this is a problem with `Array`, not `String`
<FromGitter> <ilanpillemer> how big can an array get?
<FromGitter> <tenebrousedge> not sure, but try initializing it with a size larger than Int32
<FromGitter> <Blacksmoke16> capacity is typed as Int32
<FromGitter> <tenebrousedge> says `Int` in the initializer
<FromGitter> <Blacksmoke16> `@capacity = initial_capacity.to_i`
<FromGitter> <Blacksmoke16> `@capacity` is `Int32`
<FromGitter> <ilanpillemer> the initializer is the `[] of Char`?
<FromGitter> <tenebrousedge> well then that would seem to be a hard limit
<FromGitter> <Blacksmoke16> dont suppose you could just do like
<FromGitter> <Blacksmoke16> ```class Array ⏎ @capacity : UInt64 ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5dab61e00fdc4b650719644d]
<FromGitter> <ilanpillemer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dab6208714b8b0538219162]
<FromGitter> <ilanpillemer> thats an interesting error
<FromGitter> <tenebrousedge> I think the better answer is to not use a char array, especially since this is an intermediate variable anyway
<FromGitter> <tenebrousedge> this code feels like writing C in Crystal
<FromGitter> <ilanpillemer> Yeah.
<FromGitter> <ilanpillemer> Probably because I wrote it
<FromGitter> <ilanpillemer> And `Go` is `C` in disguise.
<FromGitter> <tenebrousedge> one thing that may help: `join` takes a block argument
<FromGitter> <tenebrousedge> you may also want to take a look at `StringBuilder`
<FromGitter> <tenebrousedge> if there's a way to use a lazily-evaluated `Iterator` that would help too
<FromGitter> <ilanpillemer> the array will grow bigger than INt32
<FromGitter> <ilanpillemer> so if its impossible to have an array bigger than Int32.. I need to rethink completely
<FromGitter> <tenebrousedge> what I'm saying is you probably don't need an array
<FromGitter> <tenebrousedge> if you're just doing `join` at the end of all of this, you should be able to use `StringBuilder`, or equivalently put a ton of logic in the `join` block
<FromGitter> <tenebrousedge> but either way you can go straight to a string without needing the array
<FromGitter> <ilanpillemer> can join deal with bigger than in32?
<FromGitter> <ilanpillemer> I thought the error was the concat
<FromGitter> <tenebrousedge> what you're iterating over will need to be smaller than `Int32`
<FromGitter> <tenebrousedge> but that could be like `each_line` or something
<FromGitter> <ilanpillemer> I just snuck a look at aserite’s solution
<FromGitter> <tenebrousedge> your input isn't more than 2**32 characters
<FromGitter> <ilanpillemer> it is eventually
<FromGitter> <ilanpillemer> as it decompresses
<FromGitter> <tenebrousedge> so the final string will be that large, but not necessarily what you're iterating over
<FromGitter> <ilanpillemer> the inital string is not that large
<FromGitter> <ilanpillemer> so you need to be able to count without decompressing
<FromGitter> <ilanpillemer> which is what asterite did
<FromGitter> <ilanpillemer> but its an interesting limitatino
<FromGitter> <tenebrousedge> I think it's sane. That seems like the point where a different approach is called for, other than the stdlib array
<FromGitter> <tenebrousedge> probably the input size is calculated to force you to avoid brute-force solutions
<FromGitter> <ilanpillemer> well, it was definitely put there to make one pause and rethink.
<FromGitter> <ilanpillemer> I think it broke my brain. I will completely rewrite tomorrow night because my brain normally regenerates over 24 hours.
<FromGitter> <tenebrousedge> gin helps :)
<FromGitter> <sam0x17> lol
<FromGitter> <ilanpillemer> I may have to go for the liquorice
<FromGitter> <ilanpillemer> as a last resort
<FromGitter> <ilanpillemer> essentially I have to recursively count the lengths and maintain a running total
<FromGitter> <sam0x17> so jumping in late, but is this a "array larger than int32" situation?
<FromGitter> <ilanpillemer> yes
<FromGitter> <sam0x17> does it have to all be in memory at once?
<FromGitter> <ilanpillemer> I think an array in Uint64 territory
<FromGitter> <ilanpillemer> is there a way having an array bigger than int32?
<FromGitter> <sam0x17> if you have the RAM for it, you could just allocate an arbitrary block of memory with a C malloc call, and then use pointers to work with it
<FromGitter> <sam0x17> actually everything in `Pointer` would probably be enough
<FromGitter> <sam0x17> then just use Int64 or UInt64 for everything
<FromGitter> <sam0x17> but this is almost always unnecessary -- it's one thing if you are loading massive maps for a game or something and they *have* to be in ram, but if you are doing some kind of analysis, you could probably get away with just streaming through the data in which case it doesnt all have to be in ram
<FromGitter> <ilanpillemer> There is definitely a way to get the answer through streaming.
<FromGitter> <sam0x17> yeah I would do that then
<FromGitter> <ilanpillemer> However, learning how to do it with ram would be interesting
<FromGitter> <sam0x17> another interesting solution would be to do an array of arrays and then write methods on that class to pass `[]` to the proper array
<FromGitter> <sam0x17> that's the only "safe" solution other than streaming
<FromGitter> <ilanpillemer> I am doing this to purely to experiment with the language
<FromGitter> <sam0x17> it's something like `Pointer([array type]).malloc(size)`
<FromGitter> <ilanpillemer> so interesting trumps best
<FromGitter> <sam0x17> slices also very applicable
<FromGitter> <sam0x17> `Slice` etc
<FromGitter> <sam0x17> but yeah if it was me I would do some sort of tight loop (streaming) unless this was loading resources for a game
<FromGitter> <tenebrousedge> it's a decompression algo
<FromGitter> <sam0x17> you can parallelize also depending on what you doin
<FromGitter> <sam0x17> ah
<FromGitter> <ilanpillemer> I can theoretically understand how to do it with streaming. Which means it just matter of picking my brain up first from the floor. And waiting for it to respawn. But this pointer stuff is interesting.
<FromGitter> <sam0x17> this is always a pain point with compression
<FromGitter> <sam0x17> if you working with gzip, the built in stuff does allow for streaming but you have to take a look at how the zlib libraries work in the crystal std lib
<FromGitter> <ilanpillemer> in theory with decompression you really might want to decompress and not just know the size
<FromGitter> <tenebrousedge> oh, you just have to know the size here/
<FromGitter> <sam0x17> right but you should be able to do it to disk
<FromGitter> <sam0x17> you can also dump off into an `IO::Memory` and not know the size
<FromGitter> <ilanpillemer> to get the “star” you just need to know the size. Streaming is sufficient. But I am interested in the thing itself.
alexherbo26 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
teardown has quit [Quit: leaving]
teardown has joined #crystal-lang
teardown has quit [Client Quit]
teardown has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 240 seconds]
blassin has joined #crystal-lang
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 240 seconds]
<FromGitter> <sam0x17> anyone know how I can get a pointer to the beginning of crystal's heap?
<FromGitter> <sam0x17> I'm poking around in the gc files -- will update if I find a way
apg has quit [Quit: Til we meet again, my friends]
<FromGitter> <zenithlight> which api makes the most sense? https://gist.github.com/zenithlight/5170d5621648f0b04a7aac5e3992a556
<FromGitter> <tenebrousedge> the first one, but maybe call it `each_event`
<FromGitter> <zenithlight> refactor time 🙏
teardown has quit [Quit: leaving]
dwdv has quit [Ping timeout: 265 seconds]
<jhass> I'd actually go for 2 but yielding the entire subscription instead
<jhass> 1 & 3 I wonder if I miss events between calling client.call and setting the handler callback
<FromGitter> <zenithlight> interesting
<FromGitter> <zenithlight> with the yielded subscription do you expect to use another block to recieve messages (like option 1)?