ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.22.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<FromGitter> <bew> How to declare an argv-like array on the stack?
<FromGitter> <bew> this code will run before the `main` function (so before `GC.init`)
<crystal-gh> [crystal] MakeNowJust opened pull request #4477: Remove TODO due to 0.22 released (master...fix/enum/rm-todo-self)
<FromGitter> <bew> nvm, I forgot about `StaticArray`
Kug3lis_off is now known as Kug3lis
<crystal-gh> [crystal] MakeNowJust opened pull request #4478: Codegen: fixed #4470, to work a return in ensure block (master...fix/crystal/ensure-return)
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
Kug3lis is now known as Kug3lis_off
rocky has quit [Remote host closed the connection]
<FromGitter> <martinium> does crystal have anything like a numpy or pandas dataframe?
<FromGitter> <martinium> a lib maybe?
zipR4ND has quit [Ping timeout: 260 seconds]
<FromGitter> <bigtunacan> @martinium not yet
<FromGitter> <bigtunacan> It's on the "wanted" list here
snsei has joined #crystal-lang
rocky has joined #crystal-lang
<FromGitter> <mgarciaisaia> @martinium have you checked ? ⏎ I don't know it, but I know it comes from good hands, and is inspired by NumPy (which idk either)
snsei has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
crystal-lang548 has joined #crystal-lang
danielpclark has joined #crystal-lang
<FromGitter> <martinium> Ah thanks guys
_whitelogger has joined #crystal-lang
danielpclark has quit [Quit: Leaving]
crystal-lang548 has quit [Ping timeout: 260 seconds]
crystal-lang077 has joined #crystal-lang
<FromGitter> <bararchy> Did anyone installed Crystal on Alpine Linux ?
<FromGitter> <codenoid> omg
<FromGitter> <codenoid> hi @fridgerator @sdogruyol
crystal-lang077 has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
TheLemonMan has joined #crystal-lang
<FromGitter> <bararchy> Compiling the compiler for 4h now ... :(
<FromGitter> <bararchy> 2Cores Xeon
<oprypin> bararchy, that is not normal. you probably have low RAM.
<FromGitter> <bararchy> 4GB ram
<FromGitter> <bararchy> it wont go above 100Mb though
<FromGitter> <sdogruyol> on alpine?
<FromGitter> <bararchy> Yeha
<FromGitter> <bararchy> It's also using a single CPU only
<FromGitter> <bararchy> I even forced --thread=4 in the make file
<FromGitter> <bararchy> ```code paste, see link``` []
<FromGitter> <bararchy> Could be a bug in musl ?
<FromGitter> <sdogruyol> you should talk that with @ysbaddaden
<FromGitter> <bararchy> I'll open an issue
splitty___ has joined #crystal-lang
splitty__ has quit [Ping timeout: 260 seconds]
Kug3lis_off is now known as Kug3lis
cyberarm has joined #crystal-lang
Kug3lis is now known as Kug3lis_off
Kug3lis_off is now known as Kug3lis
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
Kug3lis is now known as Kug3lis_off
Kug3lis_off is now known as Kug3lis
Ven has joined #crystal-lang
Ven is now known as Guest70007
Guest70007 has quit [Ping timeout: 246 seconds]
Ven_ has joined #crystal-lang
sz0 has joined #crystal-lang
Ven_ has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest80608
hako_ has joined #crystal-lang
Ven has joined #crystal-lang
Kug3lis is now known as Kug3lis_off
Guest80608 has quit [Read error: Connection reset by peer]
Ven is now known as Guest24123
Guest24123 has quit [Ping timeout: 258 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 268 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 255 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 245 seconds]
Kug3lis_off is now known as Kug3lis
<TheGillies> How do I get id of ?
<Yxhuvud> the id?
<FromGitter> <sdogruyol> `(`?
<TheGillies> sdogruyol: undefined method 'id'
<FromGitter> <sdogruyol> that should be inside of a macro block
<TheGillies> i don't mean MacroId
<TheGillies> I mean like if you `p` it shows class name an unique identifier
<TheGillies> and an*
<FromGitter> <sdogruyol> this
<Yxhuvud> It does? I thought it just showed the memory address.
<TheGillies> Yxhuvud: Oh it might be memory address then
<FromGitter> <sdogruyol> not sure about that
<TheGillies> ok how do I return memory address from an object
<Yxhuvud> the first counter question is, why would you want to? I mean sure, there are ways (involving pointers and whatnot), but what are you trying to achieve?
<FromGitter> <sdogruyol> i bet @RX14 have an idea about that
<TheGillies> Yxhuvud: My entire purpose is to use the id for an art project
<TheGillies> As a bit of satire
<FromGitter> <bigDaddyS1oth> Hey peeps. Anything exciting with the language been happening lately?
<Papierkorb> TheGillies: `pointerof(x)` for the Pointer, or maybe you meant `Object#hash`
<FromGitter> <sdogruyol> @bigDaddyS1oth parallelism
<FromGitter> <bigDaddyS1oth> @sdogruyol Oh shiiiiiit
<Yxhuvud> sdogroyul: it is not released yet, is it?
<FromGitter> <sdogruyol> nope
<FromGitter> <sdogruyol> it's still being worked on
<FromGitter> <sdogruyol> however i succesfully compiled and used it with kemal
<FromGitter> <bigDaddyS1oth> Hey that's still great
<FromGitter> <sdogruyol> yeah
<FromGitter> <bigDaddyS1oth> Hopefully Crystal will start getting picked up more with all the other newer languages coming out.
<TheGillies> interesting the pointer id doesn't match the printed id
<TheGillies> in fact, in a loop, all the object pointer ids are the same
<FromGitter> <sdogruyol> @bigDaddyS1oth it's all about getting more people interested
<FromGitter> <sdogruyol> Crystal is awesome but we need more users :)
<FromGitter> <bigDaddyS1oth> Nim, Red, D...I'm sure Crystal will be popular with Nim since both are successors to Python and Ruby (respectively).
<FromGitter> <sdogruyol> Nim is around far more than Crystal
<FromGitter> <sdogruyol> close to 10 years i guess
<FromGitter> <bigDaddyS1oth> Yea the people who made it did I ton of research.
<TheGillies> nim has no high level concurrency paradigm
<FromGitter> <sdogruyol> Crystal is roughly 5 years old
<TheGillies> you just have raw threads like ruby
<FromGitter> <sdogruyol> well before coming to Crystal i've tried all
<FromGitter> <sdogruyol> nim, d, rust, go e.g
<FromGitter> <sdogruyol> all of them didn't feel right to me :P
<FromGitter> <sdogruyol> and here i am haha
<TheGillies> red is cool but gui only works on windows
<FromGitter> <bigDaddyS1oth> Go = lol no generic
<FromGitter> <sdogruyol> i've been doing Crystal since v0.6 or smth :D
<FromGitter> <bigDaddyS1oth> *generics
<FromGitter> <sdogruyol> time really flies
<TheGillies> I think crystal has the best blend of speed/ease of use
<RX14> TheGillies, object_id
<FromGitter> <bigDaddyS1oth> I've been getting into Scala, Clojure, CLisp, Crystal. Knowing all 4 would give me everything I need as a programmer. 😛
<Yxhuvud> I guess you like c's.
<FromGitter> <bew> x)
<FromGitter> <bigDaddyS1oth> Lol
<FromGitter> <bigDaddyS1oth> All 4 just happen to be great. Scala is good for enterprise and big data, Clojure for web, Common Lisp for....everything else, and Crystal for nearly everything else too.
<TheGillies> RX14: Ah thanks. Looks like #hash and #object_id are same value hrm..
<RX14> yes
<RX14> the default implementation for hash is object_id
<TheGillies> ah
<RX14> of course you can override it
<RX14> and you must if you want to have equality of different objects
<TheGillies> why have #hash at all? Im going to guess it's because ruby has it :P
<RX14> no because it's used for hash tables
<oprypin> TheGillies, the reason for this is that equality is by default defined as object_ids being equal
<RX14> object_id is unique to the object
<TheGillies> of it's an equality thing got it
<TheGillies> oh it's*
<RX14> sometimes you want multiple objects to hash the same
<Yxhuvud> thegilles: Because it is nice to be able to put an arbitrary object into a hash table
<RX14> so they're the same key in a hash table
<FromGitter> <bew> why would you want that? Oo
<RX14> "This method must have the property that a == b implies a.hash == b.hash."
<TheGillies> When you say hash table you just mean an instance of Hash right?
<oprypin> TheGillies, Hash is an implementation of a hash table
<FromGitter> <bew> oh nvm I got it
<RX14> if a == b then their hashes MUST be the same
<RX14> it should really be called map like java with a hash table being an implementation
<RX14> but whatever
<oprypin> yeah it's a horrible name
<TheGillies> javascript calls them Maps right?
<TheGillies> I think elixir does too
<oprypin> at least it's not unordered_map like in c++
<TheGillies> and clojure
<RX14> because it maps key to value
<RX14> everything calls them maps
<RX14> or dictionaries
<RX14> ruby is the odd one out
<RX14> because it's wrong
<RX14> essentially
<Yxhuvud> oprypin: it would be OrderedMap in this case as they are ordered
<TheGillies> i don't like dictionary because it's shorted dict and that makes me laught because im immature
<TheGillies> shortened to*
<TheGillies> I also can't type worth a damn
<RX14> i like map
<RX14> it's short and sweet
<RX14> changing it could be cool
<RX14> but i'm a little afraid of adding some crazy java-like inheritance to the stdlib
<RX14> honestly adding Map and List superclasses i'd be in favour of
<RX14> or just modules
<RX14> wouldn't even be backwards incompatible
zipR4ND has joined #crystal-lang
<RX14> i've been installing windows updates for 2 days now lol
<Yxhuvud> we all have our hobbies
<FromGitter> <bew> a C `double` is a `Float32` or a `Float64` ?
<RX14> Float64
<RX14> use Libc::Double though
<RX14> it'll always be a double, on every platform
<FromGitter> <bew> perfect, thanks!
<RX14> LibC::Double*
<FromGitter> <bew> I managed to build a shared library from crystal code, to make a `mpv` plugin (the music player)
<RX14> cool
<FromGitter> <bew> it's just an hellow world ATM, but I have access to mpv internal, so... sky is the limit :)
<RX14> nice
<RX14> crystal shared libraries are definitely possible but loading multiple crystal shared libraries at the same time might not work so well
<FromGitter> <bew> why? because the GC?
<RX14> i think there's some fixed symbol names
<RX14> not sure how that works out
<RX14> also gc
<RX14> idk
<FromGitter> <bew> I don't thinks that would cause any problem, the library lives in her own world imo
<RX14> it might in this case but not in most cases
<FromGitter> <sergiotapia> Hello - I'm in the process of migrating a pet project of mine called Magnetissimo from Elixir to Crystal because I just want to spit out a simple binary that can run anywhere and it looks like Crystal can do that easily.
<FromGitter> <sergiotapia> If need to keep a queue of items I need to process, should I be using `Deque`?
<Yxhuvud> depends on what you need to do with the queue. If you only add or delete at the ends, yes.
<FromGitter> <sergiotapia> Yes, just take the first item, and append to end of the queue.
<Yxhuvud> but not if you need to delete at random locations etc.
<FromGitter> <sergiotapia> Thanks
<FromGitter> <sergiotapia> By the way is Kemal the go-to web framework in Crystal?
<Yxhuvud> I'm not certain we have anything that is big enough to be considered a go-to framework, but it is probably the one that currently have the most traction
<oprypin> deleting at random locations is also pretty good tho
<Yxhuvud> Not really, especially not if it is a huge amount of entries.
<oprypin> there's nothing better though
<RX14> it's not worse than array
<RX14> is it
<RX14> wait oprypin what is deque worse than array at?
<Yxhuvud> Eh, there are plenty of data structures that are better at that. heaps etc.
<oprypin> RX14, it just has overhead with additional moves when resizes happen, and additional checks and calculations at every step
<RX14> yeah thought so
<oprypin> asymptotically not worse at anything than array
<RX14> ok thanks, I thought so, i'm good at missing things though
<Yxhuvud> constant differences can be pretty noticable though.
<Yxhuvud> (by the way, if anyone wants to delete from the middle in arrays, use #delete_at and not #delete if at all possible. The latter is *way* slower)
<FromGitter> <bew> where can I read about `__crystal_main` ?
<Papierkorb> bew, defined in src/ for the default prelude, or src/ for the empty prelude
<FromGitter> <bew> yeah, but what is the content of this main?
<FromGitter> <bew> what does it do exactly?
<FromGitter> <bew> (I'm not talking about `main` but `__crystal_main`)
<Papierkorb> I'm also talking about __crystal_main
<Papierkorb> it's really not magic, have a look
<FromGitter> <bew> well maybe I'm not searching the right thing.. I'm making a shared library, with a custom entry point
<Papierkorb> Oh *that* you mean
<Papierkorb> Part of LibCrystalMain?
<FromGitter> <bew> that entry point receives in parameter a handler, that I'd like to save in crystal constants or something...
<FromGitter> <bew> or wrap it in some way, but don't know how..
<Papierkorb> it takes (argc, argv) - do you mean those?
<FromGitter> <bew> no:
<FromGitter> <bew> `fun mpv_open_cplugin(mpv_handle : Void*) : Int32
<FromGitter> <bew> `fun mpv_open_cplugin(mpv_handle : Void*) : Int32`
<Papierkorb> You're .. trying to create a mpv plugin in crystal?
<FromGitter> <bew> then, (I think) I need to call main, to initialize crystal stuff
<FromGitter> <bew> yep exactly, I just discovered there where C plugins, so I'm trying with crystal :)
<FromGitter> <bew> I messing up the `mpv_handle` when I pass it to crystal world, somehow.. I tried to hack the passage, by putting it in argv in arg1, then retrieve it in crystal code (from inside the main), by parsing `ARGV`, but everything just crash.. (I little tired too, possibly)
<Papierkorb> So first, you write the `fun` for mpv to jump in to, looks like you got that part
<Papierkorb> in there, you can store the handle somewhere
<FromGitter> <bew> where?
<Papierkorb> You don't have argc/v, so make them up for now: argc=1, argv=["foo"]
<Papierkorb> With those, try to call __crystal_main
<FromGitter> <bew> this already works
<Papierkorb> I'd get around that by having a small trampoline.c, which mpv jumps to, and store the handle in a global variable.
<Papierkorb> Then from there, jump to crystal land, and set up a lib to find your global from C again
<FromGitter> <bew> hmm, was thinking, maybe a module variable should work (like a global)?
<Papierkorb> You could try a `StaticArray(Pointer(MpvHandle), 1)` as hack to get a mutable constant. No idea if that'll work.
<Papierkorb> If you're lucky a simple class_property would just work though
<FromGitter> <bew> I'm trying the class_property right now
FromGitter has quit [Remote host closed the connection]
oprypin has quit [Quit: Bye]
FromGitter has joined #crystal-lang
oprypin has joined #crystal-lang
<FromGitter> <bew> it seems to work, it doesn't segfault anymore :)
<FromGitter> <bew> thanks @Papierkorb
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<FromGitter> <bew> Just for the eyes: my plugin currently wait for any event from mpv, and print it on stdout, took me less than a day *cooool*
<FromGitter> <bew> when compiling with `crystal build --cross-compile` there is a `bc_flags` is created, what is it?
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hako_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<TheGillies> what editor do you all use out of curiosity? Been using vscode but it doesn't seem to like crystal very much
<FromGitter> <bew> (neo)vim for me
<TheGillies> crystal tool format is a lifesaver because it does these weird indents
rohitpaulk has joined #crystal-lang
hako has joined #crystal-lang
hako has quit [Ping timeout: 246 seconds]
hako has joined #crystal-lang