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
<FromGitter> <3n-k1> ran into a weird issue ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ the dlopen call is returning a null pointer, but the code runs perfectly and exits with a 0 exit code. what's up with that? [https://gitter.im/crystal-lang/crystal?at=5ffb9cb181c55b09c7fd69a7]
<FromGitter> <3n-k1> like, how is the null pointer working perfectly fine in the call to dlsym?
sagax has quit [Quit: Konversation terminated!]
HumanG33k has quit [Ping timeout: 260 seconds]
HumanG33k has joined #crystal-lang
<FromGitter> <asterite> Probably passing a null pointer to dlsym is valid. I see two special values can be passed, maybe one of them is the null pointer. Check man
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <3n-k1> passing in an explicit null pointer has the same effect. my only guess is that it's an undocumented feature
<FromGitter> <3n-k1> which now brings up the interesting question of "why is dlopen returning null?"
<FromGitter> <3n-k1> beacuse my libm file is a linker script, not a shared library ⏎ okay then
<FromGitter> <Blacksmoke16> > If dlopen() fails for any reason, it returns NULL.
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <3n-k1> why is dlopen failing*
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
<FromGitter> <naqvis> if an attempt to `dlopen` fails, it will return `NULL`. You should check the reason by invoking `dlerror`
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ffbb9b5e578cf1e95de0152]
Volk has quit [Quit: See you next time!]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
chachasmooth has quit [Ping timeout: 268 seconds]
avane has quit [Quit: ZNC - https://znc.in]
chachasmooth has joined #crystal-lang
avane has joined #crystal-lang
<FromGitter> <3n-k1> ended up figuring out that ⏎ 1) libm.so is an ld script on my system ⏎ and ⏎ 2) dlopen does not follow symlinks ⏎ libdl was a mistake lol [https://gitter.im/crystal-lang/crystal?at=5ffbf1f9fe007479e404481c]
f1reflyylmao is now known as f1refly
<FromGitter> <naqvis> > If filename is NULL, then the returned handle is for the main program. If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname. Otherwise, the dynamic linker searches for the object as follows (see ld.so(8) for further details):
<FromGitter> <naqvis> you better do `libm = LibC.dlopen("libm.so", LibC::RTLD_LAZY)` on linux systems ⏎ or ⏎ `libm = LibC.dlopen("libm.dylib", LibC::RTLD_LAZY)` on mac
_ht has joined #crystal-lang
<FromGitter> <3n-k1> > you better do `libm = LibC.dlopen("libm.so", LibC::RTLD_LAZY)` on linux systems ⏎ > or ⏎ > `libm = LibC.dlopen("libm.dylib", LibC::RTLD_LAZY)` on mac ⏎ ⏎ libm.so is not a valid elf in gcc and so dlopen returns null [https://gitter.im/crystal-lang/crystal?at=5ffc08379632f63d870d168d]
ua_ has quit [Ping timeout: 265 seconds]
ua has joined #crystal-lang
alexherbo2 has joined #crystal-lang
Volk has joined #crystal-lang
<FromGitter> <Ashvith> Hello folks
<FromGitter> <Blacksmoke16> o/
<FromGitter> <Ashvith> I was wondering if this is the right place to ask, but I was thinking of participating in GSOC...
<FromGitter> <Ashvith> To be honest, I don't have much experience with Crystal, but I've done Ruby before...
<FromGitter> <Ashvith> What do you all say?
<FromGitter> <Blacksmoke16> GSOC?
<FromGitter> <Ashvith> Google Summer of Code
<FromGitter> <Blacksmoke16> oh so it has you contribute to an open source project?
<FromGitter> <Ashvith> yes, but it also requires that the organization has a mentor to work with...
<FromGitter> <Ashvith> and then there are some other basic rules to follow
<straight-shoota> Crystal had applied for GSOC before
<straight-shoota> wouldn't be a bad idea to do it again =)
<FromGitter> <Ashvith> > *<straight-shoota>* Crystal had applied for GSOC before ⏎ ⏎ Interesting...can I know when?
<straight-shoota> If you're interested, feel free to post a proposal at https://forum.crystal-lang.org/
<FromGitter> <Ashvith> How about Crystal for Windows?
<FromGitter> <Ashvith> Or maybe ML gems for Crystal?
<straight-shoota> yeah, there's a lot to be done on that field ;)
<straight-shoota> or both
<FromGitter> <Ashvith> Under <off-topic> or <crystal-contrib>?
<FromGitter> <Ashvith> > *<straight-shoota>* yeah, there's a lot to be done on that field ;⁠) ⏎ ⏎ I have experienced Railsinstaller before, and that was not a pleasant experience
<straight-shoota> crystal contrib
<FromGitter> <Ashvith> > *<straight-shoota>* crystal contrib ⏎ ⏎ Thanks a lot mate!
<FromGitter> <Ashvith> Hmm, seems to me that the forum does not have a reply button? Am I missing something? It looks similar to the Discourse forum actually...
<straight-shoota> it is discourse
<straight-shoota> an there should be reply buttons
<FromGitter> <Ashvith> Umm, there seems to be a "problem" with the forum
<FromGitter> <Ashvith> But I finally got the workaround for it
<FromGitter> <Blacksmoke16> iirc someone else had a problem like that
<FromGitter> <Ashvith> There is no login button, so I had to go to a random post and press on reply
<FromGitter> <Ashvith> then I was able to use my GitHub acc
<straight-shoota> ah, I guess that's that stupid custom header which has been broken for a long time
<repo> @RX14: since you're the maintainer of pub-relay, do you have a list of public relay servers by any chance?
<FromGitter> <Ashvith> Hmmm, wow, so maybe this counts as bug contribution lol?
<FromGitter> <Ashvith> Anyways, I have to deal with a long, exhausting exam, so I'll see you folks soon, after a week, and maybe we can talk more on the GSOC thingy?
<FromGitter> <Blacksmoke16> 👍 gl
<FromGitter> <Daniel-Worrall> shame it's aimed at students, I'd love a crystal lib mentor :D
<Stephie> repo, that project's dead
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<straight-shoota> @Daniel-Worrall Maybe a mentor program could be initiated in the Crystal community independent of outside initiatives like GSOC
<FromGitter> <RespiteSage> Is all Crystal I/O ultimately implemented through bindings? I've been thinking through what would be required for a Crystal static security analyzer for dependencies (basically, generating a report for each dependency about redefinitions, filesystem accesses, network accesses, etc.), and I thought maybe it could process the LLVM IR, but it seems like the IR doesn't deal directly with I/O.
<FromGitter> <RespiteSage> If the static security analyzer idea is infeasible or unwise somehow, I'm also interested to know how.
<straight-shoota> yes, IO is handled by libc
<FromGitter> <RespiteSage> Thanks!
<straight-shoota> @RespiteSage maybe you could talk to @bararchy, he's doing security analysis with Crystal
ua has quit [Ping timeout: 264 seconds]
<FromGitter> <RespiteSage> Oh, cool. Thanks for the recommendation! I honestly know very little about security, but it's concerning to me that Crystal (just like, it seems, most language ecosystems) doesn't really have any tools for dependency security analysis.
<FromGitter> <RespiteSage> Obviously, other kinds of security analysis are also crucial, but I'm not as interested in that side of things.
<FromGitter> <RespiteSage> Or, rather, I'm specifically interested in this one part.
ua has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
Volk has quit [Quit: See you next time!]
<FromGitter> <jrei:matrix.org> when using websockets, better using bytes if I own the server and the client
<FromGitter> <jrei:matrix.org> By bytes I mean a byteformat, vs sending JSON strings for instance
<straight-shoota> as always, depends on what you're doing
Volk has joined #crystal-lang
<FromGitter> <jrei:matrix.org> not really
<straight-shoota> okay, then just use what's always best
<FromGitter> <jrei:matrix.org> excluding the very simple cases, overall a byte format will be more efficient
<FromGitter> <jrei:matrix.org> one point of JSON is it's openness. I made sense for a REST API, so I use it, but I don't see for WebSocket
<FromGitter> <jrei:matrix.org> also I guess I'll have to use json_discriminator if JSON will be sent/received to a single WS endpoint :/
Volk has quit [Quit: See you next time!]
<FromGitter> <Sija> oh, what a swoop of pr mergin’ action I see there, nice!
<FromGitter> <Daniel-Worrall> If you use bytes, then you need to write both the serializing and deserializing code
<FromGitter> <Sija> there’s already bson, msgpack, not to mention protobuf
<FromGitter> <jrei:matrix.org> @Daniel-Worrall: that's exactly like JSON. I use a library for this
<FromGitter> <jrei:matrix.org> I came up with a very simple non-descriptive protocol based on IO::ByteFormat
<FromGitter> <jrei:matrix.org> The first byte declares the message type, then the following is a list of float, integers and/or strings
_ht has quit [Remote host closed the connection]
o5r has quit [Ping timeout: 260 seconds]
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
<raz> oki doki.... so i have a little story to tell...
<raz> so yesterday my mbp 16" died. it was very sudden. GPU. denial. stages of grief. tears. you know how it goes... :(
<raz> so today i went out to get a replacement. m1 of course. because who would buy intel anymore.
<raz> and i was a bit nervous about crystal in emulation and stuff. :X
<raz> and yea... i kinda expected it to be bad
<raz> so, well, under emulation, on this 13" mbp m1
<raz> my compile times are almost half of the i9 ¯\_(ツ)_/¯
<raz> it's a bit bonkers how fast this thing is. i mean, i expected maybe a bit slower. or much slower. but not faster by such a margin.
<straight-shoota> that seems really unrealistic
<raz> it is 7.07 real
<raz> on my i9 it was 12
<straight-shoota> warm cache maybe?
<raz> i kid you not
<raz> well, perhaps my i9 was dying a little already before it went. but it had no symptoms at all (GPU just zapped out yesterday)
<FromGitter> <Blacksmoke16> What were the clock speeds for each?
<FromGitter> <Blacksmoke16> Single core is the main factor in compile times
<raz> too lazy to look'em up, but was the fastest i9
<raz> and now is the 8G/512G mbp
<raz> if you have something small/self-contained i should try compiling
<raz> happy to do a bench
<raz> ah i'll try athena
<raz> time crystal spec = real0m31.523s
<raz> (on warm cache, 2nd run)
<FromGitter> <Blacksmoke16> not a great benchmark as there are a few programs being compiled in there
<raz> as long it does the same on your end, it should be comparable, no?
<FromGitter> <Blacksmoke16> try `crystal eval --release 'gets.not_nil!.to_i64'`
<raz> that gives me 1.125s
<raz> when i feed it echo 1
<FromGitter> <Blacksmoke16> hm
<raz> yeh, wobbles around a bit on repeat runs. but 1.1-1.2 it is
<FromGitter> <Blacksmoke16> what are you running exactly?
<raz> time echo 1 | crystal eval --release 'gets.not_nil!.to_i64'
<FromGitter> <Blacksmoke16> `real 0m0.631s` 😎
<FromGitter> <Blacksmoke16> usually between `0.5-0.6`
<raz> pfft :p
<raz> but... i think rosetta startup prob adds to it
<FromGitter> <Blacksmoke16> rosetta?
<raz> need sth with longer compile time
<raz> the emulation thingy
<raz> i think it adds to startup time
<FromGitter> <Blacksmoke16> to go making the compiler
<straight-shoota> maybe try stdlib spec
<raz> that sounds like it would run a million years
<raz> anyway, maybe my i9 was really having issues already and i just never noticed. just happy that this thing is plenty fast for my usage
<FromGitter> <Blacksmoke16> time make # => real 0m17.183s`
<raz> real0m0.787s
<raz> Makefile:58: *** Could not locate llvm-config, make sure it is installed and in your PATH, or set LLVM_CONFIG. Stop.
<raz> :p
<FromGitter> <Blacksmoke16> rip
<FromGitter> <jrei:matrix.org> Apple developing LLVM, and having developed M1, we can suspect optimizations in the tool chain
<FromGitter> <jrei:matrix.org> I doubt it is the reason here
<FromGitter> <Blacksmoke16> Business opportunity. Crystal compiling as a service
<FromGitter> <Daniel-Worrall> Blacksmoke is offering to compile crystal-hourly binaries
alexherbo23 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo23 is now known as alexherbo2
lunarkitty7 is now known as pyra
alexherbo2 has quit [Ping timeout: 246 seconds]
<FromGitter> <Where_Is_X_twitter> hi! 🌊 ⏎ ⏎ what are the use cases for a descending range?
<FromGitter> <Blacksmoke16> same as a normal range but revesed
<FromGitter> <Blacksmoke16> reversed
oddp has joined #crystal-lang
<FromGitter> <Where_Is_X_twitter> can you give an example @Blacksmoke16 ?
<FromGitter> <Blacksmoke16> `(5..0).each { |v| puts v }`
<FromGitter> <Where_Is_X_twitter> and do you expect this to print "5 \n 4 \n 3 \n 2 \n 1 \n 0"?
<FromGitter> <Blacksmoke16> i would, but it doesnt
<straight-shoota> exactly
<FromGitter> <Where_Is_X_twitter> why do we allow Ranges to be created where the `begin` is greater than the `end`?
<Andriamanitra> you'd use #reverse_each for that
<FromGitter> <Blacksmoke16> why should it be disallowed?
<Andriamanitra> @Where_Is_X some methods like Array#[Range] use range in a different way than "from Range#begin to Range#end"
<FromGitter> <Where_Is_X_twitter> I just tried ⏎ ⏎ > (5..0).reverse_each { |v| puts v } ⏎ and I nothing printed? [https://gitter.im/crystal-lang/crystal?at=5ffce49b787d8f79c8f7368e]
<FromGitter> <Blacksmoke16> right, its not supported atm
<FromGitter> <Blacksmoke16> theres an issue for it iirc
<FromGitter> <Daniel-Worrall> `(0..5).reverse_each`
<FromGitter> <jrei:matrix.org> maybe `(5..0)` should not compile
<FromGitter> <Blacksmoke16> why?
<FromGitter> <Blacksmoke16> its a valid range
<straight-shoota> 5..0 is not the same as (0..5).reverse_each
<Andriamanitra> but there is an use case for range where #end is smaller than #begin..
<FromGitter> <jrei:matrix.org> because it make no sense @Blacksmoke16
<Andriamanitra> >> [0,1,2,3,4][0..-2]
<DeBot> Andriamanitra: # => [0, 1, 2, 3] - https://carc.in/#/r/a93c
<FromGitter> <jrei:matrix.org> there is nothing between 5 and 0
<FromGitter> <Blacksmoke16> 4, 3, 2, and 1?
<FromGitter> <jrei:matrix.org> Range is like an interval in Math
<straight-shoota> who says that? =)
<FromGitter> <jrei:matrix.org> it looks like
<straight-shoota> I agree that it can be used like an interval
<straight-shoota> but that's not the only use case
<straight-shoota> it also describes a generic sequence of consecutive values
<straight-shoota> *can describe
<FromGitter> <jrei:matrix.org> yeah
<straight-shoota> and such a sequence can be ascending or descending
<FromGitter> <jrei:matrix.org> for me the notation (only) looks like a lot like interval
<FromGitter> <jrei:matrix.org> it can help to explain how it is logic that (5...0) won't yield to 5,4,3 etc