lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter>
<mwlang> @jaydorsey yes, sir!
<FromGitter>
<jaydorsey> thatβs crazy!
<FromGitter>
<mwlang> Ruby is not exactly known for crunching numbers.
<FromGitter>
<mwlang> and that's exactly what's going on with computing stock indicators.
<FromGitter>
<mwlang> Bollinger was a good one for me to test because it repeatedly needs to look back X data points to do mean, then square differences of price and mean squared, and then finally do another mean of that to arrive at a rolling standard deviation.
greengriminal has joined #crystal-lang
<FromGitter>
<mwlang> woah, just boosted performance again by using a struct to hold each data point in the bollinger series:
<FromGitter>
<mwlang> any guidance on setting up a crystal project so that compiled modules end up in their own folder instead of living alongside the sources?
<FromGitter>
<mwlang> or is that a necessary evil (I seem to recall C object and executables also lived alongside their sources when compiled).
<FromGitter>
<Blacksmoke16> could make them shards then require them
<FromGitter>
<Blacksmoke16> then each "module" would go into its own dir under lib/
greengriminal has quit [Quit: This computer has gone to sleep]
alexherbo29 has quit [Ping timeout: 244 seconds]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<elankvitko> hey everyone! Happy to join this room and meet you all. I love this project and I hope itβs ok if I ask questions from time to time.
<FromGitter>
<bew> @elankvitko welcome ;) we're here to help!
<FromGitter>
<kaukas_gitlab> Hi! I am tinkering with bindings to a C library. Could anyone please point me to any documentation on how I could release and reschedule the current fiber upon call to or return from the C lib?
<FromGitter>
<bew> @kaukas_gitlab what do you mean? When you call an external function (from a lib), it blocks the current thread until the function returns, and all fibers currently runs on a single thread,
<mps>
j8r: straight-shoota: during preparing and building crystal 0.28.0 I noticed 'signal 11' few times on both arch's (x86_64 and aarch64)
<mps>
also, another developer informed me that he saw the same, and last night x86_64 had this in first build try
<mps>
I don't know deeply crystal internals and didn't tried to find a bug (or what is it) so, please if you notice the same on alpine inform me to have at least some notes about that
<FromGitter>
<bew> @kaukas_gitlab oh right, in that case I think you'll have to play with channels.. But beware that crystal code will fail at you if it's executed on another thread (e.g it won't be able to find the gc, or the sceduler..)
<FromGitter>
<bew> scheduler*
<FromGitter>
<kaukas_gitlab> Is there a somewhat safe way to ping the current thread to resume, from another one (preferably in Crystal)?
<mps>
I didn't noticed it anytime when build crystal programs, only when building/compiling crystal apk
azuri5 has joined #crystal-lang
<FromGitter>
<bew> @kaukas_gitlab I don't know the details for that, maybe @RX14 @straight-shoota @ysbaddaden @asterite might be able to help? *if they see this msg*
<FromGitter>
<kaukas_gitlab> Thank you!
<RX14>
Use channels
<RX14>
There's no real safe way to do it
<FromGitter>
<kaukas_gitlab> I'll give it a try, thank you!
<RX14>
Since 0.28.0 the gc works on other threads
<RX14>
So you could potentially use threads for blocking C calls
<RX14>
If I read correctly that that's your problem
<FromGitter>
<straight-shoota> mps is there any more detailed output than on the error?
<RX14>
mps: that is weird, I haven't seen any segfaults so far
<mps>
straight-shoota: RX14: I will try later again and make build log and post it
<FromGitter>
<mavu> @kaukas_gitlab not exactly the same, but maybe it helps. Ihave the code running, and it seems to work fine.
<FromGitter>
<kaukas_gitlab> @mavu, with a `channel.send(nil)` in a callback I get `Failed to raise an exception: END_OF_STACK`. So it seems very similar. Reading your whole thread now, thank you!
<FromGitter>
<kaukas_gitlab> @mavu, like you, I have a situation where the callback fires in a different thread, and `Channel` does not support inter-thread communication. Unlike your wPi problem I can't go through OS sockets, that would mostly defeat the purpose. I'm interested if there's anything like `Channel` but with inter-thread support. Since Crystal officially does not support MT yet the hope is low.
<FromGitter>
<j8r> We can segfault with circle dependencies
<FromGitter>
<Blacksmoke16> damn, got me excited for ice cream
<FromGitter>
<jwoertink> @vladfaust looks good!
olbat has joined #crystal-lang
alexherbo29 has quit [Read error: Connection reset by peer]
alexherbo29 has joined #crystal-lang
<FromGitter>
<Blacksmoke16> could add Athena if you want ;) something like `an REST/API oriented framework`
<FromGitter>
<vladfaust> Yes, sure
<FromGitter>
<Blacksmoke16> <3 cheers
<livcd>
vladfaust: i think that comparison is a bit unfair because the Ruby team said they would change the way how this will work once merged upstream
<livcd>
so sorbet is more of a band aid than anything
<livcd>
but obviously Stripe cant wait and needs the solution now
<z64>
"the IIRC Ruby team clearly has an intention to merge it into the core"; is there a citation on this? i know they want to add type annotations in some form, and rbi files were a candidate, but not including what stripe builds on top of rbi in regular .rb files
<z64>
additionally, you have a choice with sorbet to only use the static checker. you don't need to run with the sorbet runtime, so "a program utilizing Sorbet would run a bit slower due to runtime type checking" isn't exactly clear on this
<z64>
i agree that its an unfair comparison. ruby has a problem that crystal doesn't; years and years and years of existing ruby code to maintain bw compatibility with
<z64>
and crystal has plenty of disadvantages
<FromGitter>
<vladfaust> Um.
<FromGitter>
<vladfaust> > so "a program utilizing Sorbet would run a bit slower due to runtime type checking" β β Thanks, gonna change this
<z64>
yeah. check the top of here for a quick breakdown of sorbet's tools; https://sorbet.org/docs/overview - srb is the static checker, and there is a *seperate* gem for the runtime
<z64>
"The resource footprint becomes even heavier..."; making suggestions like these without data to back it up doesn't look very good. what this paragraph says is true for just about any new sufficiently complex tool you add to your app, regardless of language. nothing powerful is truly free; you need to make some trade offs somewhere, and data informs whether those tradeoffs are worth it
<FromGitter>
<vladfaust> Right, I've removed that paragraph
<FromGitter>
<vladfaust> I've applied changes regarding to β β > "a program utilizing Sorbet would run a bit slower due to runtime type checking"
<FromGitter>
<vladfaust> You're talking about unfair comparison, but isn't that clearly stated in the article that Sorbet is only for type-checking? I fully understand this and use the hype train to advertise Crystal
<z64>
what i don't like is you open talking about sorbet but it runs away trying to dismantle ruby as a whole. ruby has tons of advantages over crystal in other areas, and crystal is presented without the same critical obvservations you gave to ruby
<FromGitter>
<vladfaust> Yeah, that's true. I'm biased with Crystal
<z64>
which is fine - sharing the romantic view of the language is great, showing that it has a clear direction that really inspires people. i just recommend adding some of the usual precautions - it's a 0.X language (but we have an active community to help you keep up with changes); the package ecosystem is weaker than ruby's (which mens plenty of opportunities for the reader to contribute)
<FromGitter>
<vladfaust> Will do, thanks
<z64>
yw
bars0 has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<straight-shoota> @vladfaust Maybe you could insert a code example for using Sorbet, before talking about it's syntax
<FromGitter>
<straight-shoota> I don't know how sorbet looks, but you're already talking about the discrepancies
laaron has quit [Remote host closed the connection]
<FromGitter>
<vladfaust> There is one
laaron has joined #crystal-lang
<FromGitter>
<straight-shoota> Yes, but it's 2 pages after the first mention
return0e has quit [Remote host closed the connection]
<FromGitter>
<straight-shoota> But yeah, it could be difficult to fit that in there
<FromGitter>
<straight-shoota> Maybe just change the intro: "With all those signatures ..."
<FromGitter>
<straight-shoota> This is a reference to something you assume the reader to know about, when in fact he might not.
<FromGitter>
<nsuchy> I have a JSON array see https://hacks.sm64hacks.com/api/hack/1/versions, how do I loop over each key in the array (e.g. object 1, object 2, etc) and do something with the value?
<FromGitter>
<Blacksmoke16> 2 ways
<FromGitter>
<nsuchy> I tried version_data.each do |hack_version| # actions end
<FromGitter>
<nsuchy> the .as_a method is what I was looking for
<FromGitter>
<nsuchy> thank you
<FromGitter>
<Blacksmoke16> the 2nd option would make everything easier for you overall
<FromGitter>
<vladfaust> Thanks, @straight-shoota, I'll try to see what I can do
<FromGitter>
<straight-shoota> You could change it to something like this, which reads better (shorter sentences) and adresses al readers without prior knowledge β β > It adds a lot of signatures, mandatory `T::Sig` extensions, magic comments (`# typed: true`) and separate `.rbi` files. This makes Ruby loose its beauty and expressiveness. It's becoming more enterprise like Java, where safety and confidence are crucial.
<FromGitter>
<straight-shoota> (shorter sentences are better as well)
<FromGitter>
<straight-shoota> Also, what's the "IIRC Ruby team"? Can't find anything on google.
<FromGitter>
<straight-shoota> And "clearly has an intention" should be backed up by a citation
<FromGitter>
<vladfaust> Yeah I feel that I have problems with short sentences. That's because in Russian we got used to express our thoughts in complex ones :)
<FromGitter>
<nsuchy> looks like I might need the second option
<FromGitter>
<Blacksmoke16> apparently it thinks your data is a hash
laaron has quit [Remote host closed the connection]
<FromGitter>
<vladfaust> > Also, what's the "IIRC Ruby team"? Can't find anything on google. β β Thats what a Ruby comitter said in our Crystal Telegram hash. I guess I have to look for origin, that's true
<FromGitter>
<straight-shoota> Haha, I'm german. And German loves lots of subclauses :D
<FromGitter>
<Blacksmoke16> sec
<FromGitter>
<nsuchy> okay wait
<FromGitter>
<nsuchy> I am an idiot
<FromGitter>
<nsuchy> I was pulling the wrong api endpoint
<FromGitter>
<nsuchy> :|
<FromGitter>
<Blacksmoke16> that would do it
<FromGitter>
<Blacksmoke16> but for reals, id look into option 2
<FromGitter>
<nsuchy> I was pulling /data
<FromGitter>
<nsuchy> and not /versions
<FromGitter>
<Blacksmoke16> will be easier on you so you dont have to do like `.as_` or `as_i` everywhere
<FromGitter>
<Blacksmoke16> plus gives you actual objects so can have methods on them etc
<FromGitter>
<nsuchy> maybe after I get everything imported
<FromGitter>
<nsuchy> I'm weeks behind
<FromGitter>
<nsuchy> been so busy studying for finals
<FromGitter>
<straight-shoota> > Thats what a Ruby comitter said... β β Basing such a strong claim solely on someone's word is not a good idea. If you don't get your facts right, people wont believe you
<FromGitter>
<Blacksmoke16> fair enough
<FromGitter>
<nsuchy> haven't had as much time for crystal stuff
<FromGitter>
<Blacksmoke16> π’
<FromGitter>
<straight-shoota> Another one: β β > have many Ruby developers with different skill levels. β β I'd say even experienced devolpers don't always get their types right. Typechecking is good for everyone. [https://gitter.im/crystal-lang/crystal?at=5ccca98a8446a6023ebf5a52]
<FromGitter>
<nsuchy> Anyways I finally have the import script written meaning I can pull production data then deploy tonight and copy data from my laptop to the server
<FromGitter>
<straight-shoota> @vladfaust And: β β > Crystal is a front-end for LLVM β β This presents Crystal as a minor addition, on top of LLVM. Obviously, LLVM does the heavy lifting of Crystal's performance, there is no need to argue against. But when promoting Crystal it's better to say `Crystal uses an LLVM backend`. This is more accurate, because LLVM could (theoretically) be swapped out without changing the
<FromGitter>
<Blacksmoke16> but ofc it would fail if you gave it a float and tried to cast it to an int
beepdog has joined #crystal-lang
issyl0 has joined #crystal-lang
bazaar has quit [Ping timeout: 250 seconds]
bazaar_ has joined #crystal-lang
return0e has joined #crystal-lang
FromGitter has quit [Ping timeout: 264 seconds]
FromGitter has joined #crystal-lang
bazaar_ has quit [Quit: Reconnecting]
bazaar has joined #crystal-lang
<FromGitter>
<jwoertink> I have this error where I'm assigning an instance variable a value, casting it, and saying it's not nil, but it still seems to think it's nil
<FromGitter>
<jwoertink> I know on line 18 I can do `@bar.as(Foo::Bar).call` which is fine
<FromGitter>
<jwoertink> but I'm curious why when I assign this value, it still doesn't know about it? Does the casting part info not get stored in the variable?
moei has quit [Quit: Leaving...]
jeremycw has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> well `@bar` is typed to `Foo::Bar | Nil`
<FromGitter>
<jwoertink> Right. But when I finally assign the value to it, I tell it `@bar = Foo.run.as(Foo::Bar).not_nil!`
<FromGitter>
<Blacksmoke16> still doesnt mean it couldnt be nil
<FromGitter>
<Blacksmoke16> i.e. if you dont call preload
<FromGitter>
<jwoertink> ah
<FromGitter>
<jwoertink> right.
<FromGitter>
<jwoertink> So the compiler says that no matter what, the type is always `Foo::Bar?`, it's just when doing the `as` part, you're just saying which part of the union you're using at that moment
<FromGitter>
<jwoertink> I understood what it was doing, just not how to explain why it was doing that. So that makes sense. now. Thanks