<FromGitter>
<bartimus-primed> Quick question, crystal noob here, is there a reason why crystal's type system doesnt allow Int as a type declaration and forces int8/16/32 ?
<FromGitter>
<dscottboggs_gitlab> Because it's ambiguous depending on the platform
<FromGitter>
<dscottboggs_gitlab> `Int` is allowed as a type restriction though
<FromGitter>
<johnjansen> its also just plain ambiguous
<FromGitter>
<johnjansen> if you want to use `Int` is that because you dont know the range you are dealing with?
<FromGitter>
<bartimus-primed> true but, 32bit is pretty standard, unless using an embedded. kind of, looking at some encryption stuff, guess i can just use the max to ensure it doesnt hit limt
<FromGitter>
<Blacksmoke16> `UInt64` π
<FromGitter>
<johnjansen> @straight-shoota its totally true, and since either approach requires you know what is in the file first im inclined to seperate configurables from code in a better way
<FromGitter>
<bartimus-primed> @Blacksmoke16 yeah, just wasn't sure if there was a reason why, guess i could typedef it maybe
<FromGitter>
<johnjansen> @bartimus-primed i dont think being explicit (and the extra 2 chars) is that onerous, the advantage is that there is no ambiguity
<FromGitter>
<dscottboggs_gitlab> and now you know why lol
f1refly has joined #crystal-lang
<FromGitter>
<bartimus-primed> understood, was more of just wondering since i ran into the error a couple times :P
<FromGitter>
<bartimus-primed> I do want to say thanks to everyone though, finally a newer language that kept the OOP constructs, Go and Nim had disappointed me.
<FromGitter>
<Blacksmoke16> good to hear
lucasb has quit [Quit: Connection closed for inactivity]
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
f1refly has quit [Ping timeout: 268 seconds]
f1refly has joined #crystal-lang
chemist69 has quit [Ping timeout: 268 seconds]
chemist69 has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @girng what are you doing that requires you to still use `as_i` etc? If you are using the `JSON.mapping` or `JSON::Serializable` then it should just auto convert everything into an instance of that struct/class vs giving you a big object of `JSON::Any`?
<FromGitter>
<Blacksmoke16> gotta love fixing older code after you think about it more
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ashirase has quit [Ping timeout: 255 seconds]
ashirase has joined #crystal-lang
DTZUZO has joined #crystal-lang
<Groogy>
hmm how is parallelization going in Crystal? Been ages since I checked
<Groogy>
looking into implementing SPH based fluid dynamics and solviing things concurrently would be good
<FromGitter>
<dscottboggs_gitlab> There's concurrency for IO-type stuff but MT scheduling and high-level APIs are still indefinitely far off :( basically all we have is `fork do...rescue...end`
<Groogy>
Hmm before I went on my hiatus there were tons of talk about it
<Groogy>
oh well
<Groogy>
Windows port probably more important
<FromGitter>
<dscottboggs_gitlab> There is significant progress on that front
<FromGitter>
<dscottboggs_gitlab> seems smart to me to get Windows support working in general first anyway. Would bring in more people who use it on the desktop, and if you're going for cross-platform you're gonna need to make your MT APIs work on Windows too, you know? β β Sad to me, though, I haven't used Windows for anything in years.
<SerkanDevel[m]1>
Is there anyone here who maintaines the Qt5 bindings?
<FromGitter>
<r00ster91> @Papierkorb does
DTZUZO has quit [Quit: WeeChat 2.0]
<FromGitter>
<dscottboggs_gitlab> @SerkanDevl[m]1 the Qt bindings are unmaintained. I've been "maintaining" it in that I've been fixing problems created by breaking changes in crystal to keep it working as it is now but TBH the bindgen project is a little beyond me.
<FromGitter>
<dscottboggs_gitlab> So like I've been able to keep it running but not fix problems and whatnot
<FromGitter>
<dscottboggs_gitlab> but @Papierkorb is not very active
<SerkanDevel[m]1>
is it possible to use these bindings for writing a plasma mobile app in crystal?
<FromGitter>
<dscottboggs_gitlab> If you can use the older QtWidgets APIs to create a plasma-mobile app, then yes.
<SerkanDevel[m]1>
Is there a way to use kirigami with it?
<FromGitter>
<dscottboggs_gitlab> if plasma-mobile is focused on QtQuick then I'm not sure if you can the bindings to create new QtQuick widgets
<FromGitter>
<dscottboggs_gitlab> what's kirigami
<FromGitter>
<dscottboggs_gitlab> oh I see
<SerkanDevel[m]1>
but is it possible to use those bindings for that?
<FromGitter>
<dscottboggs_gitlab> Yeah, so, I've never tried using Crystal to build a QML type. Its something I was looking into but I don't have time to do right now. It *is* possible, but it is not a currently supported feature by any means. If you look at the qt.yml (https://github.com/Papierkorb/qt5.cr/blob/master/qt.yml) file used to tell bindgen how to construct the bindings, you can see that the QtQuick interface is not yet
<FromGitter>
... configured at all. However, you could use the rest of the existing configuration as an example to add in the QtQuick APIs. This is not a small project, but it is doable.
<SerkanDevel[m]1>
and for kirigami?
<SerkanDevel[m]1>
probably might need to build on top of it
<FromGitter>
<dscottboggs_gitlab> yeah...see you're wading into new territory here. I'd say it's possible... you're just going to be linking with another C or C++ library to provide the available QML types, but I don't know how that will work with the Crystal compilation process and the QtQuick build process. Perhaps it would be easiest to begin the project as a standard QML project and go back and add in any missing types by binding
<FromGitter>
... the Crystal to that as a C project, or perhaps create a C companion file which will be linked to by the Crystal compiler
<FromGitter>
<dscottboggs_gitlab> ideally we could go the other way -- `#include`ing a Crystal lib from C rather than binding to C from Crystal but that concept is experimental and not supported.
<FromGitter>
<j8r> Why `Array#includes?` is more efficient than `Set#includes?`
<FromGitter>
<jgaskins> @j8r Efficient how?
<FromGitter>
<jgaskins> Do you mean faster?
<FromGitter>
<j8r> like, a lot faster
<FromGitter>
<jgaskins> It's only faster if the array is small :-)
<FromGitter>
<j8r> I've tested even large configurations
<FromGitter>
<j8r> the difference is smaller, but still faster
<FromGitter>
<dscottboggs_gitlab> wow, that's a huge difference
<FromGitter>
<jgaskins> Sometimes you have to assign the result to a variable to keep LLVM from optimizing the entire call out, which can be difficult to remember when benchmarking π
<FromGitter>
<j8r> @jgaskins thanks!
<z64>
@j8r `Set#includes?` is implemented via `Hash#has_key?`, which of course, goes through hash API. array#includes? just iterates over each element, so its O(N)
<FromGitter>
<jgaskins> I forgot it in the first run of this benchmark, too, and all of the Array calls were optimized out, making it look like no matter how big the array was it was still 1-2ns. Then I remembered LLVM is trying to be helpful. :-D
<FromGitter>
<silmanduin66> for the moment pure crystal but i want to do the same later in wasm
<FromGitter>
<silmanduin66> so like assembly
<FromGitter>
<Blacksmoke16> is the input a string or number?
<FromGitter>
<jgaskins> Oh, I mean, are you okay with converting numbers to strings and back?
<FromGitter>
<dscottboggs_gitlab> "being in assembly" doesn't make it automatically efficient haha
<FromGitter>
<dscottboggs_gitlab> yeah what @jgaskins said
<FromGitter>
<dscottboggs_gitlab> you can do it in math though...
<FromGitter>
<silmanduin66> folling this idea i can 4 into 7, 10 into 15
<FromGitter>
<dscottboggs_gitlab> idk man look into bitwise math, there might be a way to do it
<FromGitter>
<jgaskins> If you're willing to incur the heap allocations by converting to strings, @Blacksmoke16's `gsub` example is the simplest βΒ `number.to_s(2).gsub('0', '1')`. tbh, it's not WebScaleβ’ but it's still fast.
<FromGitter>
<Blacksmoke16> is the input a string or number? @silmanduin66
<FromGitter>
<Blacksmoke16> im assuming the latter
<FromGitter>
<dscottboggs_gitlab> which, I would prefer if it didn't do that but ok
<FromGitter>
<j8r> thanks1
<FromGitter>
<silmanduin66> i found was i was looking for, thanks for your answers anyways. If anyone is interesting by the solution for C : i use that with u32 β β ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c97c8646a3d2e230d1ad3da]
<FromGitter>
<Blacksmoke16> i have no idea what this is doing
<FromGitter>
<Blacksmoke16> π’ `BUG: trying to downcast Athena::Routing::QueryParam(T) <- Athena::Routing::PathParam(Int32) (Exception)` i cant win ha
<FromGitter>
<Blacksmoke16> filed some bugs that i reproduced
return0e has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
<wuehlmaus>
what's the best way having all numbers from 1 to 100_000_000 in a file? it's only a test but i seem to choose the wrong algorithm to do it. picolisp is interpreted and does it in 26 seconds while my version needs over 5 minutes in crystal.