ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
<FromGitter> <naqvis> > I'm not familiar with libmagic, and I'm not entirely clear after some web searching, but does it guess file types from the contents? ⏎ ⏎ @RespiteSage yeah. The same library supports `file` command on *nix systems.
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
Guest12 has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> so what's stopping crystal from compiling to shared libraries? assuming we allocate GC so it doesn't conflict with other memory, I suspect we could expose an enter_crystal C function and a Crystal VM.yield function that would stop execution, while executing the Crystal program GC could be ran.
<postmodern> a lot of C plugin systems use shared libraries, and being able to compile crystal into a shared library would open some doors to us
<postmodern> currently looking into PipeWire's plugin system (SPA)
<FromGitter> <naqvis> postmodern you can
<postmodern> interesting. didn't know `fun` excepted a ` = ` syntax and an implicit block of code
<FromGitter> <naqvis> you don't need `=` sign
<FromGitter> <naqvis> that is actually to name method differently
<FromGitter> <naqvis> previously Crystal didn't supported FFI methods with Uppercase names etc
<FromGitter> <naqvis> so `=` is kind of aliasing that
<FromGitter> <naqvis> but now you can do that
Guest12 has quit [Quit: Client closed]
wmoxam_ has joined #crystal-lang
wmoxam has quit [*.net *.split]
Stephie- has quit [Quit: Fuck this shit, I'm out!]
Stephie has joined #crystal-lang
Stephie- has joined #crystal-lang
Stephie has quit [Ping timeout: 252 seconds]
psilotorp has joined #crystal-lang
psilotorp has quit [Quit: Client closed]
postmodern has quit [Quit: Leaving]
arestifo has joined #crystal-lang
arestifo has quit [Client Quit]
arestifo has joined #crystal-lang
jrayhawk has quit [Ping timeout: 272 seconds]
jrayhawk has joined #crystal-lang
<FromGitter> <rishavs> Is there an smtp server for crystal?
<straight-shoota> there's
<straight-shoota> does seem actively developed, though
<FromGitter> <rishavs> yeah. :(
<straight-shoota> what do you need it for?
<FromGitter> <rishavs> web mails to users for auth verification and normal "contact me" stuff
<straight-shoota> I'd recommend to use a tried and tested mailsever for this kind of thing, especially receiving inbound mail
<FromGitter> <rishavs> Should I just use the dev api for GMail for something like this? How does that differs from Saas offerings like Mailchimp, sendgrid etc? (Sorry if question is too naive. Very new to this domain)
<straight-shoota> mailchimp is for sending newsletters
<straight-shoota> sendgrid is for mass sending of transactional mails
<straight-shoota> if you don't have a lot of traffic, you can just use an ordinary mail account like gmail
<FromGitter> <rishavs> Thanks! ❤️
<FromGitter> <rishavs> Gmail will also be the simplest thing for me to do. I can add my domain on top of it from the dev console
<straight-shoota> yes, just start with that
<straight-shoota> you can always easily plug in something else in case you outgrow it
<straight-shoota> but that's prob a long way
<FromGitter> <rishavs> makes sense. Thanks
<yxhuvud> sendgrid (or something like it, I have certain issues with certain misfeatures of sendgrid) is nice once you feel you want things like bounce handling etc. There is so many ways sending emails can go wrong.
<yxhuvud> .. and suddenly my stupid bug went away. yay!
jhass[m] has quit [Read error: Connection reset by peer]
jhass[m] has joined #crystal-lang
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greenbigfrog has joined #crystal-lang
arestifo has joined #crystal-lang
<yxhuvud> straight-shoota: btw, do you know why `def yield(fiber : Fiber) : Nil` in the scheduler exist? I can't find any usages..
<yxhuvud> I guess it is part of the public api of scheduler, but the scheduler is kinda private for most in any case..
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arestifo has joined #crystal-lang
arestifo has quit [Client Quit]
arestifo has joined #crystal-lang
<straight-shoota> I don't know
<straight-shoota> looks like it was introduced in #6897
<DeBot> (Fiber/Scheduler refactorings)
<straight-shoota> but there doesn't seem to be any explanation
<yxhuvud> right. hmm.
<straight-shoota> can probably be removed
Stephie- has quit [Quit: Fuck this shit, I'm out!]
Stephie has joined #crystal-lang
deavmi has quit [Ping timeout: 244 seconds]
deavmi has joined #crystal-lang
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arestifo has joined #crystal-lang
<FromGitter> <Dan-Do> Is the local variable in a proc shared by multiple fibers?
<FromGitter> <Dan-Do> In a proc call of kemal, I have this
<FromGitter> <Dan-Do> ```code paste, see link``` []
<FromGitter> <Dan-Do> suddenly, a query `Arango::AQL` was newly created. The id changed from `0x7f454c090b00` to `0x7f454c0a5420`
<FromGitter> <Dan-Do> ```class DB ⏎ def aql(...) ⏎ ⏎ end ⏎ end``` []
<FromGitter> <Dan-Do> ```code paste, see link``` []
<FromGitter> <Dan-Do> 1) I converted the query id from decimal to hexa and updated the above log
<FromGitter> <Dan-Do> unfortunately the stack trace is always `(running, unable to get backtrace)` (@naqvis showed me yesterday)
greenbigfrog has quit [Quit: Connection closed]
<FromGitter> <Dan-Do> so I cannot trace back where is the root cause of that changed
greenbigfrog has joined #crystal-lang
Flipez4 has joined #crystal-lang
deavmi has quit [Ping timeout: 264 seconds]
Flipez has quit [*.net *.split]
Flipez4 is now known as Flipez
deavmi has joined #crystal-lang
dostoyev1ky2 has joined #crystal-lang
dostoyevsky2 has quit [*.net *.split]
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<FromGitter> <naqvis> what are the main use-cases for `begin ... end`? This doesn't start a new scope
<FromGitter> <naqvis> so is `begin` just used for exceptional handling mechanism?
<FromGitter> <Blacksmoke16> for the most part yea. But can also be used to group expressions into one scope. E.g. assign the "return" value of it to a constant
arestifo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Blacksmoke16> like
<FromGitter> <Blacksmoke16> ```FOO = begin ⏎ a = "foo" ⏎ a += "bar" ⏎ a.upcase ⏎ end``` []
<FromGitter> <naqvis> but vars defined inside it, still clutter the scope
<FromGitter> <Blacksmoke16> "chunk of code" maybe would have been better wording 😆
<FromGitter> <naqvis> technically speaking `begin` should be starting a new scope
<FromGitter> <naqvis> hahahaha
<FromGitter> <Blacksmoke16> im not actually sure what the proper naming there is
<FromGitter> <naqvis> people coming from different languages might have expected it to behave like starting a new scope
<FromGitter> <naqvis> that is how blocks does
<FromGitter> <naqvis> i would guess this is Ruby behavior
<FromGitter> <Blacksmoke16> probably yea
<FromGitter> <naqvis>
<FromGitter> <naqvis> yay, i can write ruby :P
<FromGitter> <naqvis> > Using ||= begin...end allows you to memoize the result of whatever is run in the begin...end. This is useful for caching the result of resource-intensive computation. ⏎ ⏎ Ruby syntax explanation on SO
Guest10 has joined #crystal-lang
<FromGitter> <naqvis> i believe same stands for Crystal
<FromGitter> <Blacksmoke16> yup, use the left value is set, otherwise set/return the right value
<FromGitter> <naqvis> yeah
<FromGitter> <Daniel-Worrall> As long as it's a truthy value
<FromGitter> <Daniel-Worrall> That is, if the return is truthy, it'll memoize it. It can't memoize a falsey value (false/nil)
Guest10 has quit [Ping timeout: 250 seconds]
greenbigfrog has quit [Quit: Connection closed]
dostoyev1ky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
<FromGitter> <HertzDevil> `begin` creates an `Expressions` node in places that don't normally expect them
<FromGitter> <HertzDevil> mainly arguments to `typeof`
<FromGitter> <HertzDevil> to me that's actually the predominant usage because of my work on the compiler
brw has joined #crystal-lang
<FromGitter> <didactic-drunk> Is there a way to change the log severity for a single class at runtime?
<FromGitter> <Blacksmoke16> i think it's `.level = `
<FromGitter> <didactic-drunk> @Blacksmoke16 thx
ixx has joined #crystal-lang
Guest0 has joined #crystal-lang
Guest0 has quit [Client Quit]
ixx has quit [Quit: Client closed]
<FromGitter> <mixflame> i'm trying to use the scalable press api from crystal. here's my code
<FromGitter> <mixflame> ```code paste, see link``` []
<FromGitter> <mixflame> their api returns
<FromGitter> <mixflame> ```code paste, see link``` []
<FromGitter> <mixflame> i tried plugging numbers and number strings in doesn't work. maybe broken API yeah but raising the question about crystal, are all formdata numbers sent as strings? not sure what the API wants from me so i figured i'd ask here
<FromGitter> <mixflame> using crystal-lang 1.0.0
<FromGitter> <Blacksmoke16> are you able to make the request in postman or something?
<FromGitter> <mixflame> they don't provide postman lol, i should look for that tho lolz
<FromGitter> <mixflame> good idea thanks @Blacksmoke16
<FromGitter> <Blacksmoke16> or curl, or insomnia, or whatever HTTP client you like
<FromGitter> <Blacksmoke16> get it working there then can port it to crystal
<FromGitter> <Blacksmoke16> looks like they also support JSON which might be easier
<FromGitter> <Blacksmoke16> nvm, you're using a file
<FromGitter> <mixflame> i think their api is being unfriendly, the code im using works and is a port from Imgur uploader, im doing api specific stuff wrong
<FromGitter> <mixflame> no rush on the feature tho
<FromGitter> <mixflame> gonna take a break and then i'll post man it, the feature is cool, i won't reveal it yet but i think you'll like it :D
<FromGitter> <mixflame> if i don't have to apologize for a rude banner ad a fan bought (automagically) and i didn't remove but i had to change the rules of the uploader lol
<FromGitter> <mixflame> similar uploader for this feature tho
deavmi has quit [Ping timeout: 268 seconds]