ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.34.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
<Stephie> One to add it, release, then you can start using it
<Stephie> Go to bed it's 2am for you
<oprypin> πŸ˜‚
<oprypin> ah heck, i was wondering why my system has been sluggish
<oprypin> i've had two `yes` processes taking up 2x 100% CPU D:
<FromGitter> <neutrinog> Thanks @kinxer
<FromGitter> <neutrinog> @j8r yes. And in the future... once it's pretty well refined.. I'd like to support vulkan as well.
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#62d960c (master - Define PID type as Int64 (#9019)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/673635688
<oprypin> "Fatal error in GC" "Too many heap sections" "OK"
<oprypin> wait, i think thats good
<FromGitter> <ImAHopelessDev_gitlab> did travis-ci just tell me a PR passed from 2013 lol
<oprypin> ImAHopelessDev_gitlab, no thats a wrong highlight by gitter
<FromGitter> <ImAHopelessDev_gitlab> oh i see it now, 62d960c
<FromGitter> <ImAHopelessDev_gitlab> LOL wow
* oprypin increases VM's memory from 3GB to 6GB
<oprypin> didnt help α••( ᐛ )α•—
<FromGitter> <ImAHopelessDev_gitlab> "Do we want Windows users to operate on possibly-negative PIDs which would not represent the truth?"
<FromGitter> <ImAHopelessDev_gitlab> :D :D :D
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
return0e has quit [Client Quit]
<oprypin> no idea what to do with this
<oprypin> the good thing is that I can get to that state with just this example so thats nice https://github.com/crystal-lang/crystal/issues/7340
<oprypin> but compiling the compiler on windows is getting stuck in the same way. with the popup "Fatal error in GC" "Too many heap sections" "OK"
return0e has joined #crystal-lang
<oprypin> nvm, just needed to add `-Denable_large_config=ON` to libgc
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<oprypin> ok bootstrap βœ” - i can sleep now
<FromGitter> <ImAHopelessDev_gitlab> gn
chachasmooth has quit [Ping timeout: 265 seconds]
chachasmooth has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> what is the crystal equivalent of malloc'ing an array of uin8s? i'd assume StaticArray(UInt8), but the docs say StaticArray is allocated on the stack, not the heap.
<postmodern> wait... Pointer.malloc, duh
alexherbo2 has joined #crystal-lang
<woodruffw> postmodern: do you want a managed allocation? if so, Array(UInt8).new(size) is probably the right API
<woodruffw> otherwise yeah, Pointer.malloc can give you an unmanaged heap allocation
<woodruffw> (you can grab the managed pointer's unsafe pointer with `Array#pointer`)
<bougyman> jogmaster: jhhhhhh5~
<bougyman> sorry, dog on keyboard.
Human_G33k has joined #crystal-lang
postmodern has quit [Ping timeout: 264 seconds]
HumanGeek has quit [Ping timeout: 250 seconds]
_ht has joined #crystal-lang
<FromGitter> <anykeyh> Hey guys
<FromGitter> <anykeyh> What happened to this proposal? https://github.com/crystal-lang/crystal/issues/462
<FromGitter> <anykeyh> I just discovered this is not working: ⏎ ⏎ ```arr = [2, 3] ⏎ pp [1, *arr]``` [https://gitter.im/crystal-lang/crystal?at=5e91997fe7ca460b065287ba]
<hightower2> Hey in Kemal, is there a way to write content directly to IO?
<FromGitter> <straight-shoota> `context.response` is an io
<hightower2> ++ thanks
claudiuinberlin has joined #crystal-lang
<claudiuinberlin> hello
<claudiuinberlin> tryin' to donate
<claudiuinberlin> i have this: {"error":"Internal server error."}
<claudiuinberlin> can i do it via github sponsors?
<FromGitter> <j8r> @ImAHopelessDev_gitlab Hi
<FromGitter> <j8r> About Godot, is it possible to make a game completely procedural?
<FromGitter> <j8r> For example, generate random 3D graphics
<FromGitter> <j8r> I guess yes
<hightower2> Hey there's some github project which benchmarks various different ways to do things in crystal (e.g. one of the tests is benchmarking array.first vs. array[0]). Does anyone remember what github repo that was?
sorcus has quit [Quit: WeeChat 2.8]
sorcus has joined #crystal-lang
<repo> hey
<FromGitter> <Blacksmoke16> o/
<repo> was there a builtin method to turn a hexstring into a Bytes?
<FromGitter> <Blacksmoke16> i have a PR for that bug repo, but GH actions is having issues so RIP
<repo> np
<repo> ah sweet
<repo> thx!
<repo> Blacksmoke16: i _really_ wish there was a loose framework for integrating an oauth 2 provider in a webapp xD
<repo> it's such a PITA
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <Blacksmoke16> id imagine the hard part is like the oauth token payload and tieing that to a user in your system
<FromGitter> <Blacksmoke16> `OAuth2` module handles all the requests for getting the data
<repo> no i mean the _provider_
<FromGitter> <Blacksmoke16> ooo
<repo> so you yourself provide the /oauth2/{authorize,token} routes
<FromGitter> <Blacksmoke16> yea im not aware of any shards for that
<FromGitter> <Blacksmoke16> is deff a bit more tricky
<FromGitter> <Blacksmoke16> would need a framework for scopes and stuff
<FromGitter> <Blacksmoke16> how those scopes map to system permissions
<repo> yeah
<repo> i'm not even dealing with scopes right now
<repo> right now i'm struggling with the sodium shard, how to encrypt some information into an authorization token so i can decrypt it upon token request and use the information encrypted within
<FromGitter> <Blacksmoke16> encrypt what data into it?
<repo> mainly just the code challenge and method
<repo> i could store it but it seems unnecessary
<FromGitter> <Blacksmoke16> would have to store the state no?
<FromGitter> <Blacksmoke16> as it needs to be checked after the redirect
<repo> i wouldn't need a state
<repo> if i use encryption that lets me check that it's me who's encrypted it and it's not been tampered with
<FromGitter> <Blacksmoke16> what auth method are you using?
<repo> code
<repo> so the token request comes in with the authorization token i just decrypt the token and validate the integrity. then i already know it was me who issued it. It can also contain the client and user id so i can associate the token with the client and user
<FromGitter> <Blacksmoke16> bug is fixed if you want to update to latest master commit
<repo> cool thanks
<repo> but i'm also starting to think that just storing this info in the db would be way easier
<FromGitter> <Blacksmoke16> or redis, since the code should expire
<FromGitter> <Blacksmoke16> be easy to setup a ttl
<repo> sure
<repo> Blacksmoke16: do you think this method https://didactic-drunk.github.io/sodium.cr/Sodium/CryptoBox/SecretKey.html#new(*,seed:Bytes,erase=false)-class-method creates the same key for identical seeds?
<FromGitter> <Blacksmoke16> not sure, dont really know much about that
<repo> same... :/
<repo> well i guess i just have to try it and see what happens ^^
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <dscottboggs_gitlab> maybe submit a PR if you have the time @repo?
<repo> dscottboggs_gitlab: yeah i just don't even know if that is the expected behavior?
<FromGitter> <dscottboggs_gitlab> Well, your test should determine whether or not it's the case, and showing that in the specs would be useful to others in the future
<repo> yeah
<FromGitter> <dscottboggs_gitlab> or perhaps find something unexpected πŸ˜€
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<repo> :)
<repo> wasn't there some fast binary serialization lib for crystal?
<yxhuvud> Why would you need one?
<repo> yxhuvud: because i want to keep the token as small as possible
<FromGitter> <dscottboggs_gitlab> compress it
<FromGitter> <dscottboggs_gitlab> before encrypting obviously haha
<repo> :)
<repo> hmm
<FromGitter> <dscottboggs_gitlab> I was gonna do a shard for that and then I was like "wait, why not just gzip json?" haha
<repo> hmmmmm
<yxhuvud> json might not need the fast requirement though
<FromGitter> <dscottboggs_gitlab> fair point
<FromGitter> <dscottboggs_gitlab> @j8r has one that's slightly faster and more readable
<FromGitter> <dscottboggs_gitlab> you could also just have a custom text-based serialization like "first line is this, second line is this" etc.
<repo> ?
<repo> oh
<repo> 3 years ago
<FromGitter> <Blacksmoke16> https://github.com/jeromegn/protobuf.cr/ not sure of the status tho
<FromGitter> <dscottboggs_gitlab> yeah anything by papierkorb is abandoned
<FromGitter> <dscottboggs_gitlab> :(
<FromGitter> <dscottboggs_gitlab> That's a really cool thing he did there though.
<repo> Blacksmoke16: protobuf seems a bit overkill somehow
<repo> considering i just want to handle the bytes of a struct or so
<FromGitter> <Blacksmoke16> is this speed requirement really needed, versus just like base64 something or something
<FromGitter> <dscottboggs_gitlab> why not just...take the bytes of the struct?
<repo> dscottboggs_gitlab: i can... do that?
<FromGitter> <stronny> is there a `Struct#to_bytes`?
<FromGitter> <dscottboggs_gitlab> oh... crystal isn't ABI stable, you could run into shit breaking down the line
<FromGitter> <stronny> or should you macro it up?
<repo> mmh
<FromGitter> <dscottboggs_gitlab> I don't remember exactly how to do it, I'll try to look into it
<repo> hm what about msgpack
<repo> that's lightweight
<FromGitter> <dscottboggs_gitlab> that was the one I was gonna make a shard for and never finished it
<FromGitter> <stronny> msgpack looks iviting indeed
<repo> yeah i think i'll go with msgpack
<FromGitter> <Blacksmoke16> whats the goal here again, just getting a small size representation of a string/
<repo> not just strings
<repo> i have uuids in there too
<FromGitter> <dscottboggs_gitlab> no, some arbitrary struct
<repo> which do have string representations but the bytes are way more compact
<FromGitter> <dscottboggs_gitlab> here it is https://crystal-lang.org/api/0.34.0/Object.html#unsafe_as(type:T.class)forallT-instance-method
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/UUID.html#bytes:StaticArray(UInt8,16)-instance-method
<FromGitter> <Blacksmoke16> can get the bytes for a uuid
<FromGitter> <Blacksmoke16> and strings have `.to_slice`
<repo> Blacksmoke16: yeah but that get's ugly quick
<FromGitter> <Blacksmoke16> prob
<raz> is it possible to store *args and **kwargs in an instance var without knowing their types? - along the lines of https://play.crystal-lang.org/#/r/8veu
<FromGitter> <Blacksmoke16> possibly
<FromGitter> <dscottboggs_gitlab> you could do `some_struct.unsafe_as StaticArray(UInt8, sizeof(some_struct)` if and *only if* the struct contains no reference types -- No strings, arrays, slices, pointers, or class members. So it's useful for a VERY specific use-case but probably won't work for yours :/
<FromGitter> <dscottboggs_gitlab> Although UUID is a value type so it would work for that
<FromGitter> <Blacksmoke16> raz: actually not by default, would need to use generics
<raz> Blacksmoke16: hmm. perhaps with some dirty macro trickey?
<FromGitter> <dscottboggs_gitlab> no, it has to use a generic
<FromGitter> <dscottboggs_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e91db736823cb38acc4d555]
<raz> ahh thx. gotta look into that, never used them so far
<FromGitter> <dscottboggs_gitlab> the ` : T` isn't required on the splat but you need the ` : Tuple(T)` on the instance method definition
<FromGitter> <dscottboggs_gitlab> > ahh thx. ⏎ ⏎ NP
<FromGitter> <Blacksmoke16> can also use spat generics
<FromGitter> <Blacksmoke16> i used it for some athena stuff
<FromGitter> <Blacksmoke16> i.e. like `struct Foo(*Args)` then `Foo(Int32, String, Bool).new xxx`
<FromGitter> <dscottboggs_gitlab> very cool :D
<FromGitter> <Blacksmoke16> where `Args` would be a tuple of the types you pass
<FromGitter> <Blacksmoke16> i use that and `Tuple.from` to handle splatting arguments from an array to the proc
<raz> phew, that looks like black magic
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/8520 is a bug tho
<FromGitter> <Blacksmoke16> just a heads up
<repo> any reason why there's no Slice#+(other : self) ?
<FromGitter> <dscottboggs_gitlab> is that the one where the answer is just "holy shit, don't do that"
<FromGitter> <Blacksmoke16> hehe
<FromGitter> <dscottboggs_gitlab> congratulations, you broke the type system!
<raz> hmmm
<raz> halp :D
<repo> https://p.jokke.space/t28lT6/crystal let's see then...
<FromGitter> <Blacksmoke16> kwargs is a `NamedTuple`
<raz> i have no clue about generics
<raz> ohhhhh
<raz> hmm, how do i genericify that?
<raz> i get Error: can only instantiate NamedTuple with named arguments :(
<FromGitter> <dscottboggs_gitlab> oh, interesting...
<FromGitter> <dscottboggs_gitlab> oh, i know
<FromGitter> <Blacksmoke16> have to pass the full type no?
<FromGitter> <Blacksmoke16> `NamedTuple(x: Int32, y: String) ⏎ `
<FromGitter> <stronny> https://carc.in/#/r/8vf0
<FromGitter> <dscottboggs_gitlab> can't you https://play.crystal-lang.org/#/r/8vf1?
<FromGitter> <stronny> @repo instead of `Slice#+(other : self)`
<raz> dscottboggs_gitlab: well, according to the compiler error you apparently can't ;)
<raz> Blacksmoke16: but i don't know the tuple type. that's the point here - i want it to work for arbitrary arguments (the ones defined on the Callee's method)
<FromGitter> <dscottboggs_gitlab> yeah I was asking @Blacksmoke16 since he's worked with this stuff so much. Idk he might be right, it looks like using kwargs for that is kinda a pain
<FromGitter> <Blacksmoke16> mhm, and there are no double splat generics
<FromGitter> <Blacksmoke16> whats the actual use case here/
<raz> component based web framework (similar to lucky). raises exception to switch rendering to a different component. exception contains the target component class plus the args that should be passed to it.
<raz> (that's the very short version ;) )
<raz> i guess i can do without kwargs here or figure out a different way. just would find the above pattern pretty useful
<FromGitter> <Blacksmoke16> another framework :0
<FromGitter> <Blacksmoke16> sounds fancy if you can get it to work
<raz> however i can just make that a constraint for now. components that can be switched to in this way can't take kwargs. (that exception-switch is only used for error-handling / redirects anyway, not part of normal routing)
<FromGitter> <Blacksmoke16> would it not be better to define each exception and specify the arguments it uses there?
<raz> well there is only one exception. `raise Switch.new(OtherComponent, arg_for_comp, kwargs_for: comp)
<raz> anyway, will do w/o kwargs for now. the generic works lovely for the normal args
<FromGitter> <Blacksmoke16> πŸ‘
<raz> thx for your helps!
<FromGitter> <dscottboggs_gitlab> please don't abuse exceptions like that
<mps> j8r: oprypin: thanks for your ideas and help. I found some time besides my $day_job and upgraded shards for Alpine
<oprypin> :>
<oprypin> dscottboggs_gitlab, sometimes, when it's appropriate, people don't shy away from it in Python land
<oprypin> but yea this is probably too far :D
<FromGitter> <dscottboggs_gitlab> yeah, I write python a lot and that kinda annoys me. I try not to do it myself, but there's not really anything you can do about `StopIteration` 😬
<mps> Blacksmoke16: do you think we should rebuild 'oq' with crystal 0.34.0 for alpine linux
<repo> heh
<repo> this is an auth token i just encoded: Nxs_dF4_Zc0XwZHppLihFgPjT4yOGEVaB8OACvvceUyydioOXllwGGXp6R6p2Mspl3OYBJJjvFTjA1eqgNIBsw1b4GKcC0iDd4OTtlFckQb-L29TM69HBGLhAOVZbae8hljZf2_lcB46mMrbQ9Rw6eFthAuBq_l3fmKPTbThv5iPLmCF_NySPKcErCsKZ-HJIldD_rQ8Zz00_chdFFmezIA4_l3g9Tc65eKowkIO0RWRKk2uVTOQgrUd-V-iLTj83rHAto2u
<repo> :D
<repo> or rather an authorization code
<repo> checking the RFC if there's a size limit for it
<repo> ahh
<repo> darn
<FromGitter> <dscottboggs_gitlab> what's the limit?
<FromGitter> <Blacksmoke16> mps: hm? you mean its a package on alpine?
<repo> If an authorization code is used more than once, the authorization server MUST deny the request and SHOULD revoke (when possible) all tokens previously issued based on that authorization code. The authorization code is bound to the client identifier and redirection URI
<repo> there goes my stateless authorization
<mps> Blacksmoke16: yes
<FromGitter> <Blacksmoke16> oh wow, who added it?
<mps> jirutka
<FromGitter> <Blacksmoke16> ah cool, didnt know that
<mps> Maintainer: Jakub Jirutka <jakub@jirutka.cz>
<FromGitter> <Blacksmoke16> ill be doing a new release this weekend, so prob wait until after that?
<mps> this weekend mean tomorrow, I think :)
<FromGitter> <Blacksmoke16> yes by tomorrow
<mps> ok, no problem
<mps> thanks for info
<FromGitter> <Blacksmoke16> np
<FromGitter> <grkek> Isn't it weird that I have the permission to create channels in the slack workspace?
<oprypin> grkek, no it's not, you're all colleagues, right?
<FromGitter> <grkek> I mean the crystal slack workspace
<oprypin> me too
<FromGitter> <grkek> Interesting, all the past experiences disallowed me to create channels in the workspace
<FromGitter> <grkek> COMMUNITYβ„’
claudiuinberlin has joined #crystal-lang
<FromGitter> <asterite> fixed now :-)
<hightower2> there goes that feature :)
chachasmooth has quit [Ping timeout: 258 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <grkek> what feature?
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Remote host closed the connection]
<FromGitter> <wout> I there (currently) a way to install shards from private repos? I keep getting `Username for 'https://github.com':`. Double checked the shard name, everything is as it should be.
<FromGitter> <wout> Thanks, that helped a lot!
sorcus has quit [Quit: WeeChat 2.8]
<FromGitter> <dscottboggs_gitlab> Slack?
sorcus has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Do we have a slack room now?
<FromGitter> <Blacksmoke16> unofficially
<FromGitter> <Daniel-Worrall> unofficial is good enough for me
<FromGitter> <Daniel-Worrall> I just don't know where to look for it
<FromGitter> <dscottboggs_gitlab> I don't get it... we already have gitter, IRC, and discord, why slack?
<FromGitter> <dscottboggs_gitlab> would be cool if we could link the discord server's #general room to the IRC/gitter
<FromGitter> <dscottboggs_gitlab> (or slack)
<FromGitter> <dscottboggs_gitlab> for backwards compatibility
<FromGitter> <Blacksmoke16> i found a bug
<FromGitter> <dscottboggs_gitlab> what else is new, @Blacksmoke16? lay it on us...
<FromGitter> <asterite> we'll eventually mak
<FromGitter> <asterite> make it easier to join
<FromGitter> <asterite> (hard to type with a cat on top of half of the keyboard)
<FromGitter> <dscottboggs_gitlab> πŸ˜€
<FromGitter> <Blacksmoke16> sec, making a playground link
<FromGitter> <Daniel-Worrall> Gitter is official. IRC is for the anti-gitters. Discord is unofficial.
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8vh5
<FromGitter> <Blacksmoke16> `XML::Reader` fails to read self closing tags
<FromGitter> <Blacksmoke16> or at least treats them as `NONE`?
<FromGitter> <Blacksmoke16> semantically those should be the same
<FromGitter> <asterite> self closing is `<foo/>`
<FromGitter> <asterite> not `</foo>`
<FromGitter> <Blacksmoke16> 😬 my bad :p
<FromGitter> <Blacksmoke16> i just noticed
<FromGitter> <dscottboggs_gitlab> hah
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#7217aad (master - Add Log handler for HTTP::Server (#9034)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/673850997
<oz> Ah well... another Slack. πŸ˜•
<FromGitter> <Blacksmoke16> given the string ⏎ ⏎ ``` <number>1</number> ⏎ <number>2</number> ⏎ <number>3</number>``` [https://gitter.im/crystal-lang/crystal?at=5e9214f516f84f04616fe434]
<FromGitter> <Blacksmoke16> and clever ways to get this to return `3` (as in the count of elements with the same name)
<oprypin> Blacksmoke16, is this libxml
<FromGitter> <Blacksmoke16> yea...
<FromGitter> <Blacksmoke16> trying to figure out a way to determine if there are multiple elements with the same name so i can parse them as an array of values
<FromGitter> <Blacksmoke16> without loading in the whole string/node into memory
<oprypin> Blacksmoke16, `.children.count &.name == "number"`
<yxhuvud> normally I think a stream parser would be what you want for that. Depending on what you try to extract of course
<FromGitter> <Blacksmoke16> essentially attempting to steam in the XML and stream out JSON
<FromGitter> <Blacksmoke16> last thing left to handle are arrays
<yxhuvud> :D
<oprypin> it was never used
<FromGitter> <Blacksmoke16> πŸ˜† nice
<oprypin> Blacksmoke16, so do u consider your xml issue solved?
<FromGitter> <Blacksmoke16> prob could work with that
<FromGitter> <Blacksmoke16> ill keep you posted
Human_G33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <asterite> oprypin: i guess I was looking at nokogiri when writing that... no idea why I ended up not using it: https://github.com/sparklemotion/nokogiri/blob/63f2eea4b80b566e3ba5796d0722c82f6739d127/lib/nokogiri/xml/searchable.rb#L14
<FromGitter> <j8r> I have a bug with exhaustive case :/
<FromGitter> <j8r> I try to reproduce it, that's not easy
<FromGitter> <j8r> `BUG: `action` at /home/jrei/Desktop/Projects/ricr/src/docs.cr:117:14 has no type (Exception)`
<FromGitter> <j8r> I suspect that's because on a block
<FromGitter> <Blacksmoke16> 😒
<FromGitter> <j8r> It only fails to compile if there is two or more class types in `when`
hpyc9 is now known as HIPOINTAF
HIPOINTAF is now known as hpyc9
<raz> hum. i'm in a constant state of confusion about symbol vs string, hash vs NamedTuple.
<raz> could we perhaps remove symbols from the language or would that be bad? :p
<FromGitter> <Blacksmoke16> Namedtuples are immutable
<FromGitter> <Blacksmoke16> Hashes are not
<raz> i know. i just find myself wanting to pass them around, merge and modify them all the time. like the case from earlier today (saving kwargs for using/modifying them later)
<raz> i also know removing symbols isn't realistic. it's just the one thing that i kinda wish we hadn't inherited from ruby ;)
<oprypin> raz, namedtuple is storage of kwargs. its keys are represented as symbols
<oprypin> u dont have to use symbols otherwise
<oprypin> u dont have to use namedtuple otherwise
<oprypin> don't find yourself wanting to pass them around ;p
<FromGitter> <Blacksmoke16> there is an issue about removing symbols, as they dont really have a purpose beyond NT keys and autocasting enums
<raz> oprypin: in theory i don't. in practice all my codebases use shards. and those do it their way.
<oprypin> raz, reeeeally
<oprypin> which are they so i know
<FromGitter> <Blacksmoke16> with the goal to make them solely autocasting
<raz> oprypin: well the fun starts with ORMs. pick any :D
<oprypin> no thanks
<raz> blacksmoke16: that sounds promising to me!
<raz> prob not a high prio thing anyway. just my little headache of the day
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
mps has left #crystal-lang [#crystal-lang]
_ht has quit [Quit: _ht]
postmodern has joined #crystal-lang
<postmodern> are Arrays of Int types the same memory layout wise as a C array? There's no extra bits in between the elements?
<FromGitter> <j8r> wow strange
<FromGitter> <j8r> when I interchange the types, no more compiler bug: https://github.com/ricr-web/ricr/blob/master/src/docs.cr#L118
<FromGitter> <j8r> This types are generics
<oprypin> postmodern, correct
<oprypin> size, capacity, pointer to contiguous memory in heap
<yxhuvud> postmodern: Slice of Int is the same as C arrays. Arrays is additionally a struct with a size and a pointer to the underlying slice
<oprypin> yxhuvud, um Slice is a struct with a size and a pointer to the underlying slice
<oprypin> Array is a class (i.e. pointer-to-struct) with a size and capacity and pointer to the underlying <strike>slice</strike> memory
<postmodern> yxhuvud, but the additional bits are at the beginning/end? just making sure the elements are contiguous.
<oprypin> postmodern, elements are contigous. as i was saying. size, capacity, pointer to contiguous memory in heap
<yxhuvud> oprypin: Hmm. didn't array used to be implemented in terms of slice? TIL that they are not that still.
<oprypin> slice has so little functionality that using it doesnt matter
<yxhuvud> The struct with size etc and the actual contents doesn't look to be contigous though.
<oprypin> u put a slice or u put pointer and int directly, who cares
<oprypin> (size capacity [buffer]--)------------heap---------->(elem1 elem2 elem3 elem4 elem5)
<oprypin> but actually because it's a class, then it's....
<oprypin> ( [pointer]--)----------heap----------->(size capacity [buffer]--)---heap--->(elem1 elem2 elem3 elem4 elem5)
<oprypin> while slice actually is without the additional pointer step
<oprypin> (size [buffer]--)---heap--->(elem1 elem2 elem3 elem4 elem5)
<yxhuvud> right.
<postmodern> so what's the simplest/easiest GUI toolkit available to crystal, if you just need to draw pixels onto a window?
<oprypin> hummmm
<postmodern> SDL? Gtk? Clutter? X11? Qt?
<yxhuvud> There are qt bindings, but I dont know if they are well maintained
<oprypin> open a graphics application and run libxdo πŸ˜‚
<oprypin> nah qt is borked
<oprypin> SDL seems in a good shape though i never know which exact binding is the right one. CrSFML can be a bit complicated to set up but it's nice (i'm biased)
<postmodern> hmm libxd looks nice, except eeeewww C-plus-plus :/
<oprypin> postmodern, nono i was saying "libxdo" and it's a joke
<oprypin> never heard "libxd"
<FromGitter> <j8r> yeah got my bug
<FromGitter> <j8r> very very hard and weird
<FromGitter> <asterite> did you reduce it? I compiled the repo with that `when` with the types like that and flipped, works fine
<FromGitter> <j8r> https://carc.in/#/r/8vhi
<FromGitter> <j8r> it was the snippet in the README.md
<FromGitter> <asterite> ugh... generics... and structs
<FromGitter> <asterite> they are bound to crash
<FromGitter> <j8r> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e923caefea5216d697210d6]
<FromGitter> <asterite> also it has nothing to do with exhaustive case?
<FromGitter> <j8r> I compiles before
<FromGitter> <j8r> Ha hum
<FromGitter> <j8r> let me test
<oprypin> did you bisect it
<FromGitter> <j8r> my bad
<FromGitter> <j8r> It never worked
<oprypin> πŸ˜‚
<FromGitter> <j8r> I did not notice it because adding a route prevent the bug to happen
<FromGitter> <asterite> Similar to this one: https://github.com/crystal-lang/crystal/issues/7960 (probably the same)
<FromGitter> <j8r> Interestingly: https://carc.in/#/r/8vhm
<FromGitter> <asterite> Essentially when you have a module and generic types including it, but you never instantiate theem
<postmodern> hmm no one's written clutter behinds yet. could be useful/interesting
<FromGitter> <asterite> Not an excuse, but I feel that modules and generics will never work well unless someone comes and rewrites it all with a better strategy
<FromGitter> <j8r> @asterite not sure it is the same
<FromGitter> <j8r> it is the opposite, a standard module included by a generic struct
<FromGitter> <j8r> the error is also no the same, but root cause may be the same
Shredster has joined #crystal-lang
Shredster has quit [Remote host closed the connection]
<postmodern> how does Pointer.malloc allocate memory on the heap, without Crystal's GC/allocator clobbering it? I'm assuming Pointer.malloc is used under the hood, but the GC is hooked in somehow for .new/.allocate allocations?
<postmodern> i see something like that in src/object.cr in macro def_clone.