<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`)
<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?
<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
<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.
<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>
<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>
<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
<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
<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)
<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.