RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> ```code paste, see link``` ⏎ ⏎ hmm [https://gitter.im/crystal-lang/crystal?at=5c39353e66f3433023b2bbd3]
<FromGitter> <Blacksmoke16> dunno what that was about
<FromGitter> <proyb6> I'm always curious if we need a monitoring tools for monitoring each shards memory usage which is nice to have
<FromGitter> <Blacksmoke16> cool, refactored the command
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c393b2483c7e3776555ffc2]
<FromGitter> <Blacksmoke16> if the param is nilable is assumed to be optional, otherwise its required and will raise if you dont supply it
<FromGitter> <Blacksmoke16> `Unhandled exception: Required argument 'val' was not supplied. (Exception)`
<FromGitter> <Blacksmoke16> :100\
jemc has joined #crystal-lang
<FromGitter> <silmanduin66> Hello
<FromGitter> <Blacksmoke16> o/
<FromGitter> <silmanduin66> i just noticed my crystal version is "0.27.1-dev "
<FromGitter> <Blacksmoke16> you on mac?
<FromGitter> <silmanduin66> no
<FromGitter> <silmanduin66> making some tests on aarch64
<FromGitter> <Blacksmoke16> ah
<FromGitter> <silmanduin66> is there anyone else also using aarch64 here ?
<FromGitter> <Blacksmoke16> no sorry
<mps> silmanduin66: I have crystal on aarch64
<FromGitter> <silmanduin66> oh
<FromGitter> <silmanduin66> how is it going ?
<mps> on Alpine Linux
<mps> fine :)
<FromGitter> <silmanduin66> i am in a strange situation where i can only build my code if i use the --release
<FromGitter> <silmanduin66> else i get in a lot of trouble
<mps> to me it is same as on x86_64
<FromGitter> <silmanduin66> which version of crystal and llvm are you running ?
<mps> 0.27.0 and llvm5
<FromGitter> <silmanduin66> oh llvm5
<mps> yes, that is packaged on Alpine
<FromGitter> <silmanduin66> i use archlinux and the default package is with llvm 6.0.1
<FromGitter> <silmanduin66> runs fine on x86_64
<FromGitter> <silmanduin66> but its catastrophic on aarch64
<FromGitter> <Blacksmoke16> isnt RPI arm?
<FromGitter> <silmanduin66> the rpi3 is aarch64
<mps> I didn't made anything big yet, don't know if I will have similar issues
<mps> yes
<FromGitter> <silmanduin66> yes :-)
<mps> I'm on chromebook Armv8
<FromGitter> <silmanduin66> unless i'm totally wrong arm7 -> arm
<FromGitter> <silmanduin66> armv8 -> aarch64
<FromGitter> <Blacksmoke16> :shrug: :p
<FromGitter> <silmanduin66> it doesn't really matter anyways
<FromGitter> <silmanduin66> the rpi is far too slow to compile
<mps> arm7 -> 32bit arm8 -> 64bit
<FromGitter> <silmanduin66> cross compiling each app is much faster
<mps> true
<mps> but on aarch64 it is fast nearly like on x86_64
<FromGitter> <silmanduin66> just the cross compilation to aarch64 was bugy until today
<FromGitter> <silmanduin66> i fixed the bug and i saw they commited it today
<FromGitter> <silmanduin66> :-)
<mps> it is slower because arm machines are usually with sd cards not ssd
<mps> sd cards are slow :/
<mps> even emmc
<FromGitter> <silmanduin66> also in your chromebook ?
<mps> yes, it is slow, today I built firefox-esr on it, takes eight hours
<FromGitter> <silmanduin66> :0
<mps> and Alpine is really fast, uses musl libc instead of glibc
<FromGitter> <kevinelliott> @silmanduin66 what cross compiler toolset do you use?
<mps> silmanduin66: it is late (or early :) ) here (Europe) going to bed. good night
<FromGitter> <silmanduin66> europe too, it's 2:33 am
<FromGitter> <silmanduin66> @kevinelliott what do you mean by toolset
<FromGitter> <girng> @mps what's difference between glibc and libc?
<FromGitter> <Blacksmoke16> one starts with a g, the other doesnt :trollface:
<FromGitter> <girng> 😆
<FromGitter> <kevinelliott> @silmanduin66 What are you using to cross compile.
<FromGitter> <silmanduin66> crystal build src/server.cr --cross-compile --target "aarch64-unknown-linux-gnu"
<FromGitter> <silmanduin66> @kevinelliott
<FromGitter> <Blacksmoke16> prob should build in release as well :p
<FromGitter> <silmanduin66> if you're patient yes
<FromGitter> <silmanduin66> if you just want to see if it's working better not :-P
<FromGitter> <Blacksmoke16> :p fair enough
<FromGitter> <kevinelliott> @silmanduin66 Oh I see, cool.
<FromGitter> <kevinelliott> What version has the aarch64 armv8 patches?
<FromGitter> <silmanduin66> Crystal 0.27.1-dev
<FromGitter> <silmanduin66> llvm 6.0.1
<FromGitter> <kevinelliott> awesome
<FromGitter> <silmanduin66> but Crystal is partially broken on aarch64 with
<FromGitter> <silmanduin66> llvm 6.0.1
<FromGitter> <silmanduin66> that why I have to cross compile
<FromGitter> <silmanduin66> *that's
<FromGitter> <kevinelliott> oh otherwise you’d build directly on device?
<FromGitter> <kevinelliott> what are you building for embedded btw?
<FromGitter> <silmanduin66> yeah , but after some thoughts it s useless to directly build on the device ( too slow )
<FromGitter> <silmanduin66> i have 2 raspberry pi 3
<FromGitter> <silmanduin66> on one I will make a simple static web
<FromGitter> <silmanduin66> on the other I m making a chat app
<FromGitter> <silmanduin66> using the Amber framework
<FromGitter> <silmanduin66> *website
<FromGitter> <kevinelliott> chat app on pi? what’s the use case there?
<FromGitter> <kevinelliott> btw, i do a lot on embedded too… i think i have about 20 pi’s here at home
<FromGitter> <silmanduin66> I m building a small app which will be included in a website so people from this website can talk to each other and answers questions
<FromGitter> <silmanduin66> the only reason I use rpi3 is that is the only "server" I have for the moment
<FromGitter> <kevinelliott> Oh i see, cool
<FromGitter> <silmanduin66> I had to buy a rpi for some sensors project
<FromGitter> <silmanduin66> accelerometer and gyroscope
<FromGitter> <silmanduin66> but I don't use any more so I ll use them as web server for the moment :-P
Raimondi has joined #crystal-lang
<FromGitter> <Blacksmoke16> is there a way to build and run tests against a built app?
wmoxam has joined #crystal-lang
spacemanspam has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 245 seconds]
jemc has quit [Quit: WeeChat 2.2]
<FromGitter> <Blacksmoke16> nvm didnt end up needing it
_whitelogger has joined #crystal-lang
<FromGitter> <Nbotz> SO I found this shard for detecting user agents, but its completely useless if i have to enter the user agent manually, so how do i detect user agents?
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
spacemanspam has quit [Read error: Connection reset by peer]
cyberarm has quit [Ping timeout: 240 seconds]
<FromGitter> <r00ster91> Isn't Crystal's `var = uninitialized Int32` actually the same as C's `int var;`?
cyberarm has joined #crystal-lang
<FromGitter> <j8r> @silmanduin66 you can build statically for arm64 with Docker on x86-64 if you're interested. It's not really fast with qemu, usually it take x10 more times
<FromGitter> <silmanduin66> @j8r thanks but i'm only targetting aarch64 for the moment and i do it from my x86-64 pc so it's fine.
<FromGitter> <silmanduin66> btw i have absolutely no idea what is docker
<FromGitter> <silmanduin66> same with qemu
<FromGitter> <silmanduin66> my plan is to simply test the code on my x86-64 machine and then cross compile to aarch64
<FromGitter> <j8r> You have exactly the same library version on both your PC and RPi?
<FromGitter> <j8r> For all the dependencies? This is required for linking
<FromGitter> <silmanduin66> yes i have
<FromGitter> <silmanduin66> archlinux OS, crystal 0.27.0-1 and llvm 6.0.1
<FromGitter> <j8r> Nice then 👍
<FromGitter> <silmanduin66> but i guessi should learn how to use docker right ?
<FromGitter> <j8r> Don't know, depends of your needs. Sometimes Docker is useful
<FromGitter> <j8r> That's like LXC, Jails or even VM but more user friendly (on the surface)
<FromGitter> <silmanduin66> well i come from a math background so all my programs were pretty long single file calculation code
<FromGitter> <silmanduin66> but i'm going into web developpement
<FromGitter> <silmanduin66> so i have no idea about most of the tools people are using
<FromGitter> <j8r> Oh, ok. Interesting
<FromGitter> <j8r> For devs the main advantages with Docker is having the same environment for all people, even in macOS, Windows, whatever Linux and in Prod
<FromGitter> <j8r> This prevents also setup times to install all the dependencies locally
<FromGitter> <silmanduin66> so you actually run your code with / on ? docker before deploying or the target machine ?
<FromGitter> <silmanduin66> *on the target
<FromGitter> <j8r> I compile inside the container. That's a reproducible build
<FromGitter> <silmanduin66> so if you 're making a web app, where do you test it ?
<FromGitter> <j8r> I've crystal installed on my machine for simplicity, I use Docker primilarly for the final release build
<FromGitter> <j8r> i.e I run `crystal build myapp.cr` locally and `crystal build --release myapp.cr` in Docker
<FromGitter> <silmanduin66> ok i see, and what is the speed diffrence with building on docker and locally ?
<FromGitter> <j8r> I build also with --static on docker
<FromGitter> <j8r> A bit slower – normal
<FromGitter> <j8r> Not that much, it shares the kernel with the host
<FromGitter> <silmanduin66> oh about --static , i didn't understand what is the advantage . It makes a bigger file right ?
<FromGitter> <j8r> Yes, that you can run everywhere
<FromGitter> <j8r> All libs are bundled into it
<FromGitter> <silmanduin66> oh interesting
<FromGitter> <silmanduin66> i didn't know about that :-P
<FromGitter> <j8r> It works only on Alpine Linux
<FromGitter> <silmanduin66> hmm
<FromGitter> <silmanduin66> i don't have alpine linux
<FromGitter> <j8r> Because of musl.
<FromGitter> <j8r> Me too, that's why Docker :)
<FromGitter> <j8r> Some uses also LXC/LXD, that's up to your taste
<FromGitter> <j8r> It's also practical to have a quick sandbox ready in 1s instead of a big VM
<FromGitter> <silmanduin66> hmm i actually spent hours trying to make crystal work on my aarch64 and now i learn i could just use docker
<FromGitter> <silmanduin66> :-P
<FromGitter> <j8r> :) Yes you could compile statically, drop the binary in your RPi and done
<FromGitter> <silmanduin66> yeah now i'm doing that with cross-compile but i think your way is much more efficient
<FromGitter> <silmanduin66> i'll try tonight if i have time thanks :-)
<FromGitter> <j8r> I've
<FromGitter> <j8r> Look at source/dppm-static to see how I have done.
<FromGitter> <j8r> I need to improve docs :/
<FromGitter> <j8r> Because I noticed some people in Crystal are interested for cross compilation
<FromGitter> <silmanduin66> oh so it's a tool to get faster but i could just do the same manually right ?
<FromGitter> <silmanduin66> i need to go now , thanks for your help
<FromGitter> <j8r> yes
<FromGitter> <j8r> Ideally i need to refactor the tool a bit for the user to only have to enter their project URL and the program path
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
ua__ has joined #crystal-lang
ua_ has quit [Ping timeout: 240 seconds]
Jenz has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Jenz has quit [Ping timeout: 258 seconds]
Jenz has joined #crystal-lang
<FromGitter> <greenbigfrog> ```code paste, see link``` ⏎ ⏎ Any ideas why the second "query" gets stuck and never completes? [https://gitter.im/crystal-lang/crystal?at=5c39ebee8318994524d9dc6e]
<FromGitter> <greenbigfrog> hm. apparently it fails if there's a none nilable Array in the Mapping, but not in the RS
<FromGitter> <talbergs> Do we have variable variables in crystal?
<FromGitter> <talbergs> Could I call a method by it's name stored in some variable?
<FromGitter> <Sija> nope, Crystal ain’t that Ruby-ish
<FromGitter> <Sija> there’s no dynamic dispatch
<FromGitter> <Sija> you can mock around it a bit with macros but it’s better to find another solution
<FromGitter> <Sija> there’s no `Object#send` and friends either
<FromGitter> <j8r> @talbergs you
<FromGitter> <Sija> @j8r not rly
<FromGitter> <Sija> Objective-C has it and it ain’t interpreted
<FromGitter> <j8r> how its possible?
<FromGitter> <Sija> methods are stored in vtable which can be introspected and it’s modifiable at runtime
<FromGitter> <j8r> that sounds like an interpreter. weird to have this is in a compiled one
<FromGitter> <Sija> that’s what gives ObjC such a dynamic feel to it, personally I dig it a lot
<FromGitter> <Sija> and in the end it’s compiled down do C99
<FromGitter> <j8r> can we add methods at runtime?
<FromGitter> <j8r> back in crystal, the closer you can have is case/when
<FromGitter> <Sija> yep, you can
<FromGitter> <j8r> with whens generated by macros
<FromGitter> <Sija> nah, that’s a nasty hack - it works for some cases but it’s far away in terms of functionality...
<FromGitter> <j8r> what do you think of Swift @Sija ?
<Jenz> ObjC's syntax is a nighmare IMO
* Jenz DX
<FromGitter> <j8r> I've even seen ObjC++ in some places O.o
<FromGitter> <j8r> hopefully no ObjC# lol
<Jenz> lmao
<FromGitter> <Sija> @j8r nothing much, I haven’t been using it for any project rly
<FromGitter> <Sija> lol
laaron has quit [Remote host closed the connection]
<FromGitter> <Sija> please no... # is only good in a pipe
<FromGitter> <Sija> @Jenz it’s not as bad as LISP
<FromGitter> <Sija> but close
<FromGitter> <talbergs> ^^
<FromGitter> <j8r> Is it really worse than Java? I don't think so
<Jenz> Lisp's quite nice IMO, I think it just requires another way of thinking... Not that I've ever wrapped my head around it
<Jenz> I'd say ObjCs syntax is worse than Java
<FromGitter> <j8r> I hate Java, its GC and memory usage costs us time and money
<Jenz> Yeah, Java's quite... restricted
<FromGitter> <j8r> its GC render its perfs and memory unpredicatable
<FromGitter> <r00ster91> didn't java improve its GC a lot? with the ZGC
<FromGitter> <j8r> Go garanties to not perform a GC more than one each 100ms
<Jenz> I don't like Go's syntax either, but I love Crystal's :D
<Jenz> I mean, Go's syntax is just plain and boring, haha
<FromGitter> <j8r> agree
<FromGitter> <Sija> https://carc.in/#/r/5zd6 -> argghh, that’s so frickin’ annoying
<Jenz> Huh
<FromGitter> <Sija> adding `.as(String?)` helps but that’s ugly and pointless :/
<Jenz> There's also `| nil`
<Jenz> (i.e. `"foo" | nil`)
<FromGitter> <Sija> no?
<FromGitter> <Sija> that’s calling `|` operator on `String` instance?
<Jenz> Oh
<FromGitter> <talbergs> Yes today I run in many Proc type issues as well: `Proc(Nil, Nil) # is created if i capture method that returns nil` and `Proc(Nil) # is made from "proc = ->{}"` and they are not equal.
<Jenz> True, Sija
<FromGitter> <talbergs> Also some `Proc(NoReturn)` type appeared among all this
<FromGitter> <talbergs> Id expect all 3 of them to be assumed the same at compile time
<Jenz> I meant "foo" ||nil
<FromGitter> <Sija> `Proc(Nil, Nil)` means you’re passing a `Nil` argument and expect a `Nil` return type, whereas in the second case there’s no arguments passed, just `Nil` return type
<Jenz> Though it'll always evaluate to "foo", it'll be of type String?
<FromGitter> <talbergs> Yes but the class method I capture - it does not accept any arguments, and still `Proc(Nil, Nil)` got implied
<FromGitter> <Sija> @Jenz yep, that would work but it’s just a different flavor of `.as(String?)`, still weird and pointless :(
<Jenz> Indeed :(
<FromGitter> <Sija> @talbergs that’s odd,do you have any short repro code?
<FromGitter> <talbergs> Second.
<Jenz> Uh, how do I list all items in view again?
<Jenz> Oops wrong chat, sorry
<Jenz> *channel
simerax has joined #crystal-lang
<FromGitter> <talbergs> Ok, that must be my overlook. No issues sorry
<FromGitter> <talbergs> @Sija This one to me seems like a bug? https://play.crystal-lang.org/#/r/5z4n
Raimondi has quit [Ping timeout: 240 seconds]
<Jenz> Nah, I'm pretty sure that's invalid syntax in line 15
<Jenz> Oh like that
laaron has joined #crystal-lang
<FromGitter> <Sija> you can create a `Proc` only from (optional) receiver and it’s method passing argument types if needed
<FromGitter> <Sija> no chaining
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <Blacksmoke16> how can i determine if a var is a generic in a macro? https://play.crystal-lang.org/#/r/5zff
<FromGitter> <Blacksmoke16> doing `== Generic` returns `undefined constant`
laaron has joined #crystal-lang
<FromGitter> <Sija> @Blacksmoke16 generics are known to be broken and atm general advice is stay away from them if possible
<FromGitter> <Blacksmoke16> really i only need to know if its an array or not then
<FromGitter> <Blacksmoke16> or really some way to differentiate between `Int32` and `Array(Int32)`
<FromGitter> <Blacksmoke16> that come from method param restrictions
<FromGitter> <Blacksmoke16> `{{Array(Bool) <= Array}}` that'll work
<FromGitter> <Blacksmoke16> well no it didnt, hmm
<FromGitter> <Sija> couldn’t say... crystal generics are unfortunately a can of worms :(
<FromGitter> <Blacksmoke16> `a.restriction.is_a?(Path) ? a.restriction.resolve.nilable? : a.restriction.resolve? ? a.restriction.type_vars.any? { |t| t.resolve.nilable? } : a.restriction.types.any? { |t| t.resolve.nilable? } }` what a mess but seems to work :shrug:
<FromGitter> <Blacksmoke16> all i want to know is if the type is niable :p
<FromGitter> <Sija> you can tell from the amount of `nilable?` calls :P
<FromGitter> <Blacksmoke16> ;)
Jenz has quit [Ping timeout: 268 seconds]
<FromGitter> <greenbigfrog> ```code paste, see link``` ⏎ ⏎ Is this intentional behaviour? [https://gitter.im/crystal-lang/crystal?at=5c3a0ea1ba5936605bab7d79]
<FromGitter> <greenbigfrog> If I set the mapping like this, it'll (obviously) work ⏎ ⏎ ```DB.mapping( ⏎ text_array: Array(String)? ⏎ )``` [https://gitter.im/crystal-lang/crystal?at=5c3a0edb95e17b45253e068e]
<FromGitter> <Blacksmoke16> prob should error not hang
<FromGitter> <Blacksmoke16> since its trying to convert null into an array of strings
<FromGitter> <greenbigfrog> yep
<FromGitter> <greenbigfrog> I guess I'll open a issue. ⏎ At crystal-pg, right?
<FromGitter> <Blacksmoke16> maybe see if you can replicate it with normal db driver?
<FromGitter> <Blacksmoke16> but yea prob pg shard
<FromGitter> <greenbigfrog> the normal db driver doesn't support array type though, does it?
<FromGitter> <greenbigfrog> unless I'm missing sth
<FromGitter> <greenbigfrog> which totally could be the case ;)
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <Blacksmoke16> tbh i have no idea
laaron has joined #crystal-lang
spacemanspam has joined #crystal-lang
<FromGitter> <girng> Hello!!
<FromGitter> <Blacksmoke16> o/
<FromGitter> <girng> guess what Saturday is?? Crystalday!!
<FromGitter> <girng> All day bby lets get it
<FromGitter> <girng> @Blacksmoke16 thanks for helping me with `round`. am using it and my hp/mp values get sent over the pipe as 2 decimals only now, not 5.999999 or whatever.
<FromGitter> <Blacksmoke16> np
<FromGitter> <Blacksmoke16> https://carc.in/#/r/5zif trying to implement `Union#nilable?` but i dont know what im doing :p
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c3a41600721b912a56d0d53]
<FromGitter> <Blacksmoke16> in my example if i print `pp @types # => [String, :Nil]` but that returns flast
<mps> RX14: Alpine v3.9_rc1 is released with crystal 0.27.0 on x86_64 and aarch64
<RX14> Yay
<mps> I tested in on both and looks fine, didn't noticed any problem
<mps> s/in on/it on/
<mps> if I see something not working I will post here
<FromGitter> <kingsleyh> evening :)
<FromGitter> <Blacksmoke16> o/
<FromGitter> <kingsleyh> @girng I see there is Ruby custom language support for godot - I was considering making a Crystal one
spacemanspam has quit [Read error: Connection reset by peer]
<FromGitter> <girng> @kingsleyh that would be very interesting/cool
<FromGitter> <girng> i saw the ruby repo on that, i remember it saying it had like 20x worse performance than gdscript though LOL. although, crystal would be faster i imagine
<FromGitter> <girng> but, seems like a big undertaking (from my perspective)
simerax has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
<FromGitter> <kingsleyh> I think it will have threading issues
<FromGitter> <kingsleyh> After reading more into it - it looks pretty easy to write C bindings same as the Ruby one
<FromGitter> <kingsleyh> But godot works by using many threads which cause the Ruby version to hang and crash - which is one reason they wrote gdscript - I think Crystal will suffer the same issues with threading
<FromGitter> <kingsleyh> Maybe forking multiple processes would be a workaround
sagax has joined #crystal-lang