ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
snsei has joined #crystal-lang
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
dhk has quit [Quit: Leaving]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
jackivan88 has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei_ has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
bmcginty has quit [Ping timeout: 240 seconds]
bmcginty has joined #crystal-lang
<FromGitter> <HCLarsen> For anyone who's installed Crystal on a Mac, how much space does it take up?
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<FromGitter> <swelltrain> I am very new to Crystal and stumbling over how to define a method argument that's an array of strings. def method(messages : Array of String)
<FromGitter> <faustinoaq> @swelltrain try: ⏎ ⏎ ```def method(messages : Array(String)) ⏎ pp messages ⏎ end ⏎ method(["ab", "aa", "bb"])``` []
<FromGitter> <faustinoaq>
alex`` has joined #crystal-lang
jackivan88 has quit [Quit: Ping timeout (120 seconds)]
jackivan88 has joined #crystal-lang
<FromGitter> <ansarizafar> Another benchmark showing Crystal is amazing
<FromGitter> <pnloyd> Wow .net memory usage is so bad in that.. Makes me sad since I'm a big C# fan.
<FromGitter> <pnloyd> Does this blog post still describe the best techniques to make small Docker images? ⏎ Namely that `` is still the best way to find the deps. that need to be in the final image.
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
lacour has quit [Quit: Leaving]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
claudiuinberlin has joined #crystal-lang
flaviodesousa has joined #crystal-lang
mark_66 has joined #crystal-lang
<FromGitter> <Papierkorb> @pnloyd I don't know of a Docker specific dependency ripper. If you shell out somewhere in your Crystal program (using `#command` or others) to another program, make sure to also copy them and their dependencies. If you're using the `shell: true` option, you'll also need a `/bin/sh` and its dependencies.
<FromGitter> <Papierkorb> Also: Good Morning!
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Read error: Connection reset by peer]
<FromGitter> <bew> @Papierkorb is on gitter, that's unusual :p now we'll be able to @ tag you more easily too!
<FromGitter> <Rinkana> Morning
flaviodesousa has quit [Ping timeout: 248 seconds]
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <Papierkorb> Not sure yet, but I think after I tried it for a week, I'll stick to IRC next week again, including at work
cyberarm has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> How buggy for you
<FromGitter> <bew> ?
baweaver has quit [Ping timeout: 240 seconds]
<FromGitter> <Papierkorb> Gitter also wasted big potentional when on flaky connection. I only have shitty GSM in the housing. When you send a message, and the connection dropped, your sent message is gone if you reconnect and someone else wrote something while you were out. Not marked as "was not send", nor copied back into the message input field, just gone. So that sucked yesterday
cyberarm has joined #crystal-lang
baweaver has joined #crystal-lang
<FromGitter> <Papierkorb> Also, the notification thing in the tab title is buggy. It constantly shows a `(1)`, even after I opened the tab. This alone breaks gitter for me, there are other things, but this is too confusing.
baweaver is now known as Guest66309
Papierkorb has quit [Ping timeout: 255 seconds]
<FromGitter> <Papierkorb> The UI is also just not up to par. Wasted space everywhere. I'd have to write a proper desktop client (No electron "desktop app" trash), and ... yeah I can just stick to IRC which served me well for almost a decade
Papierkorb has joined #crystal-lang
dom96 has quit [Ping timeout: 246 seconds]
dom96 has joined #crystal-lang
dom96 has quit [Changing host]
dom96 has joined #crystal-lang
<FromGitter> <yxhuvud> Wasting space is what designers do nowadays.
<FromGitter> <jsn> the doc says: "Global variables start with a dollar sign ($). They are declared when you first assign them a value.", but the compiler says "Syntax error in $global_variables are not supported, use @@class_variables instead"
<FromGitter> <jsn> an error in docs?
jsn- has left #crystal-lang [#crystal-lang]
<FromGitter> <Papierkorb> ... global variables are still in the docs?! Meh :|
<FromGitter> <Papierkorb> @jsn They're obsolete. Only special globals remain at this point, you can't create new ones
<FromGitter> <straight-shoota> they have been removed since 0.19.0
<FromGitter> <jsn> thanks! i'm playing with some microbenchmarks; are class vars as efficient as globals clould be (like, the address known at compile time, no indirections, etc)?
<FromGitter> <Papierkorb> Probably
<FromGitter> <Papierkorb> LLVM will do its optimization magic anyway and get rid of almost any useless (to the computer) indirection
<FromGitter> <jsn> oh hey, i see LLVM is available in standard library; can it be used to e.g. construct and run a JIT-ed function on the fly from crystal?
snsei has joined #crystal-lang
<FromGitter> <Papierkorb> No, JIT doesn't support some things we require for normal code
<FromGitter> <Papierkorb> Especially, thread local storage
<FromGitter> <jsn> hmm, so e.g. this won't work: ?
snsei has quit [Ping timeout: 252 seconds]
snsei_ has joined #crystal-lang
<FromGitter> <Papierkorb> For Crystal? As I said, not without certain modifications
<RX14> the problem with on the fly code generation in crystal is the type system not the infastructure, I think
<FromGitter> <Papierkorb> Ah that actually just worked iirc RX14
<RX14> hmm?
<FromGitter> <jsn> not sure i understand; what i mean is, if i'm writing a e.g. JIT for some (unrelated) bytecode, can i do that in crystal using built-in LLVM?
<FromGitter> <Papierkorb> Surprisingly enough, after cutting out what the JIT doesn't support, it worked, but memory management was an issue. Never got around to debugging it.
<FromGitter> <Papierkorb> @jsn, Of course you can
<RX14> if you can do it in llvm in C+_+
<RX14> you can do it in llvm in crystal
<FromGitter> <Papierkorb> Is that the deadmans C++ emoticon?
<FromGitter> <jsn> yeah, got it, thanks
<RX14> perhaps with some patches or extra bound llvm functions
<RX14> Papierkorb, no just a typo
<RX14> and since when did you abandon us for gitter :(
<FromGitter> <Papierkorb> RX14, I'm in Berlin (aka, away from home) this week. Was too lazy to set up a proper IRC client, and figured I could try gitter for the week.
<FromGitter> <Papierkorb> Gitter is buggy.
<FromGitter> <Papierkorb> Can't wait to use proper IRC again lul
<RX14> i was just joking
<RX14> even i sometimes use gitter when im mobile
<FromGitter> <Papierkorb> We know
<RX14> if only android had a decent irc client...
<RX14> andchat is terrible because it updates the screen synchronously with every incoming message
<FromGitter> <Papierkorb> I used AndroIRC many years ago. Is it any good when used with a bnc?
<RX14> so if you have a large backlog on znc it takes a good 3 mins to clear
<RX14> someone I know is alledgedly working on an android irc client that doesnt suck
<RX14> but it's in their free time so...
<FromGitter> <Papierkorb> How dare people not take what they build in their spare time seriously! I demand a good irc chat client right now, because I'm entitled to it. – Many OSS bugtrackers in a nutshell
<RX14> if only andchat was oss
<FromGitter> <Papierkorb> Hah great, you can now remove videos from a YT playlist (including auto generated ones like My Mix) before opening them. Finally a good addition from the new design
snsei_ has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> @Papierkorb thought you're from berlin
<FromGitter> <Papierkorb> Nah far from it
<FromGitter> <sdogruyol> I heard that berlin has the best doner kebabs <3
<FromGitter> <Papierkorb> They were invented in Berlin by turkish immigrants after all
<FromGitter> <Papierkorb> Though if someone knows where to get good kebab in Berlin, I'm all ears
<FromGitter> <Papierkorb> Will have time tomorrow to wander around some more, a kebab would be a welcome dinner for that
<FromGitter> <sdogruyol> I'm from the hometown of döner & kebabs (Istanbul)
<FromGitter> <sdogruyol> hehe
flaviodesousa has joined #crystal-lang
<RX14> @sdogruyol "I don't have a Mac anymore" what do you use?
<FromGitter> <sdogruyol> switched to an Asus Zenbook with Arch
<RX14> i considered one but you couldn't get one with 16gb ram :(
<RX14> so I just got a thinkpad
<FromGitter> <sdogruyol> yeah, that's probably the only downside
<FromGitter> <sdogruyol> however the price / performance ratio is very high
<FromGitter> <sdogruyol> for now I can live with 8gb :P
<RX14> thinkpads are nice since you can customize their specs
<RX14> i think all I really miss with the thinkpad 13 is the UHD display
<RX14> the thinkpad display's colour representation isn't all too good and it's "only" 1080p
<FromGitter> <martinos> I am currently fighting with the Enumerable#reduce and the type system. ⏎ Can someone look at this gist and tell me what I have done wrong ⏎ ⏎ []
<RX14> i think it's cheaper than the zenbook though, and you get the nice keyboard
<RX14> and most of the time i'm using my existing external displays anyway
<RX14> @martinos that's a rather complex expression
<FromGitter> <sdogruyol> I'm a bit obsessed with the weight / thickness ratio
<FromGitter> <sdogruyol> not sure about thinkpads
<RX14> @sdogruyol thinkpad 13 is pretty thin and light
<RX14> @martinos [["Bob", {"age" => 55}]] is Array(Array(String | Hash(String, Int)))
<RX14> which means that when you use (k, v) in the block constructor, both k and v are of type Hash(String, Int32) | String
<RX14> which is where the error comes from
<RX14> since crystal cannot know which element in an array has which type
<FromGitter> <martinos> Ah I get it
<RX14> if you're only ever using the array to store a pair of items, you should look at tuples
<FromGitter> <martinos> Agreed
<RX14> since they're fixed length, the compiler can determine which index has which type
<RX14> and boom it might work
<FromGitter> <sdogruyol> weirdly, it's more expensive to buy a thinkpad
<RX14> huh
<FromGitter> <martinos> I am converting an Ruby codebase, I wanted to avoid to many changes. But I think I don't have choice here.
<FromGitter> <martinos> I think I should use typeof more often.
<RX14> yeah, ruby and crystal are really different
<RX14> you will have to make changes and any code you port from ruby will have parts which are not idiomatic in crystal
<FromGitter> <martinos> Yes, I was a bit lazy.
<RX14> @sdogruyol weird, my thinkpad 13 config was £670 and the zenbook UX330UA is about £800 here
<RX14> i'm quite happy with an i5 and 16gb ram and 8h battery life for that price lol
<FromGitter> <sdogruyol> here it's the reverse :D
<FromGitter> <martinos> By the way do you know what is the easiest way to convert an Array({K,V}) to Hash(K,V)?
<FromGitter> <sdogruyol> I've the i7 7500, 8gb, 512 ssd version and getting nearly 10-12 hours on daily :P
<FromGitter> <sdogruyol> at around £700
<RX14> thats cool
<RX14> my ssd is only 180gb but im not even filling it lol
<FromGitter> <martinos> < RX14> I have found it Array#to_h
<RX14> nice
gcds has joined #crystal-lang
olbat has quit [Ping timeout: 258 seconds]
olbat has joined #crystal-lang
olbat has quit [Changing host]
olbat has joined #crystal-lang
ShalokShalom_ has joined #crystal-lang
ShalokShalom has quit [Ping timeout: 246 seconds]
<FromGitter> <sdogruyol> @RX14 I'm keeping some free partition for other distros
<RX14> well i'm using btrfs so i could just install them in a different subvol
byteflame has quit [*.net *.split]
cptaffe has quit [*.net *.split]
tybee[m] has quit [*.net *.split]
tybee[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
byteflame has joined #crystal-lang
<FromGitter> <sdogruyol> didn't know that
<FromGitter> <Papierkorb> keep good backups, btrfs is unstable. Lost two partitions already. Never lost any partition on any other FS yet
<RX14> @Papierkorb i've been using btrfs for 3 years and never had an issue
<RX14> was this on a laptop you were loosing partitions?
<RX14> or raid5/6?
<FromGitter> <Papierkorb> On a desktop and on a notebook, each on SSDs
<FromGitter> <Papierkorb> no raids or anything, bare btrfs
<RX14> i've used raid1 on my nas for a while and no problems
<RX14> seen a few scrubs fix up some data
<RX14> because the HDDs in the array have like 6 years of online time
<RX14> and they're just what i had lying around
<RX14> i've had btrfs on a hdd on my desktop for maybe a year and a bit now
<RX14> and no issues at all
<RX14> and so i'm using btrfs on my laptop
<RX14> you have to turn off SATA link power saving aparrently
<RX14> aparrently that causes corruptions
<FromGitter> <Papierkorb> When it happened, I updated my system just prior to that and after `pacman` returned, I shut down the computer. After the first incident, when I wanted to poweroff after updating, I issued a `sync`, but that also failed me. I don't use btrfs anymore.
<RX14> SATA power saving is only a thing when you use tlp/laptop-mode though
<FromGitter> <Papierkorb> It's just too flaky. I don't want to mess with other configuration for a filesystem driver. That's whack
<RX14> i've seen loads of people have issues with btrfs but it's baan absolutely 100% rock solid for me
<RX14> i don't know what they do wrong
<FromGitter> <Papierkorb> I really just used it with default settings. Didn't even use anything like the volumes stuff
<RX14> i'm literally running btrfs on raid1 using the cheapest usb3 to sata adapters on ebay
<RX14> and sometimes they disconnect while they're online
<RX14> and btrfs manages through that
<RX14> i'm unaware of any other FS that could
<FromGitter> <Papierkorb> I'll wait a few years until I give it a try. I don't actually have much reason to use something over ext4
<RX14> I really enjoy having CoW
<FromGitter> <Papierkorb> Which compared to what's possible is bad, but still more solid than all other drivers in the kernel, when subjected to different kinds of failures during load
<RX14> btw, when was this btrfs failure?
<RX14> like how many years ago?
<FromGitter> <Papierkorb> Dunno, maybe two?
<RX14> interesting
<RX14> how often do you update your kernel?
<FromGitter> <Papierkorb> I'm on arch. I like to keep my machines updated.
<RX14> well maybe i've just been lucky
<RX14> i'm not planning on switching since it's always been solid as a rock to me
sz0 has joined #crystal-lang
<FromGitter> <Schniz> Hi, I have a weird question about Generics. Currently, it seems that Crystal supports it only on the Class level
<FromGitter> <Schniz> am I wrong?
<RX14> you mean on methods?
<FromGitter> <Schniz> ```code paste, see link``` []
<RX14> def foo(x : Foo(T)) : T forall T
<FromGitter> <Schniz> indeed
<RX14> you need to declare the type vars using forall
<FromGitter> <Schniz> is it documented somewhere?
<FromGitter> <Schniz> amazing. Thanks!
<FromGitter> <eliasjpr> For those who are interested in Nanobox to add support for Crystal please join their slack channel at
<gcds> Hi guys, I am trying to find some info about event loop on Crystal, but somehow unsuccessful maybe someone know some details?
<gcds> I am trying to attach FD to event loop so I could get notified then data arrivews
<gcds> arrives
<FromGitter> <Papierkorb> gcds, we use fibers for that. Just write normal "blocking" code, and if an I/O call does block, a different fiber will be run
<gcds> ahm :( I dont want to run while loop to always check if data is available :D
<RX14> well what do you actually want to get done
<FromGitter> <Papierkorb> .. you don't "run while loop"
<gcds> I am writing serial <-> websocket server
<gcds> i am using libserialport have file description I wrapped it with IO::FileDescription everything runs fine now I was just thinking whats the best way to deal with multiple opened ports
<RX14> well how do you deal with multiple clients?
<RX14> if 2 ws clients connect then what happens?
<RX14> do you have multiple serial ports?
<gcds> The idea is server opens serial port and every client which is subscribed to that port will receive information
<RX14> so multicast
<RX14> and no write?
<RX14> (to the serialport)
<gcds> with write I have not yet figured out but I think any subscriber can also write
<RX14> the question is how does libserialport handle concurrency
<RX14> because i presume thats a C binding and so how does that interact
<gcds> after I open FD i dont use anymore lib
<RX14> oh cool
<RX14> you want to create a channel every time a client conencts
<RX14> and push that channel to an array
<gcds> it's just termios based library with interacts with and etc I tried to write it down by hand but for somereason something with termios configuration was f*cked so I dropped it
<gcds> yep thats an idea
<RX14> you want to use 1 fiber to read from the serial port, then each chunk of data, you iterate the array and pass the data through a channel
<gcds> ahh now I understand
<RX14> problem is then what if one client blocks
<RX14> your channel then blocks
<gcds> what do you mean blocks?
<RX14> and you stop recieving data on every other socket
<RX14> if the websocket client doesn't read the data
<RX14> i.e. the TCP buffer fills up
<gcds> ahm, so how then normal websocket servers works? :D
<RX14> well typically they don't have 1 fiber producing the same data for each websocket
<RX14> so it works fine
<RX14> it's just a side-effect of iterating *all* the channels and sending a message through them
<gcds> ah you mean it will block on write to socket?
<RX14> if #write blocks that *specific fiber* (it will never block any other fibers from doing work)
<RX14> then it will never recieve from the channel
<RX14> which means the channel fills up
<RX14> and #send to that channel blocks the serial reading thread
<RX14> you can solve it by just checking channel.full? before using send in the serial recieve fiber though
<RX14> which works but you miss data
<RX14> this is a problem in any application btw, no matter how it does concurrency
<RX14> do you buffer the data infinitely or do you loose data?
<gcds> atm I just finished writing library for serial port so I just thinking
<RX14> gcds, what other languages are you familiar with btw?
<gcds> php, ruby, javascript, bit go, bit elixir, c/c++
<RX14> ah, so you're familiar with go's concurrency?
<RX14> crystal's is exactly the same
<gcds> a little bit
<RX14> go's go == crystal's spawn
<RX14> and they both have channels
<gcds> I am thinking of storing what received from serial in each sockets buffer and then socket is available send to it? What do you think?
<RX14> gcds, well the sockets are buffered in the OS anyway
<RX14> im unsure what you mean
<RX14> you can't tell beforehand if #write will block
<gcds> I though as u said if socket is blocked and cant write maybe I could store in buffer until it free's up so it would not block reading
<gcds> what about nonblocking sockets?
<RX14> it is nonblocking
<RX14> it blocks the fiber not the application
<RX14> we use nonblocking sockets under the hood so that as soon as #write blocks we go do something else in another fiber
<RX14> but that fiber itself blocks
<RX14> you automatically get a fiber per-request by using HTTP::Server
<gcds> hmm what if I use event-loop isntead of fibers?
<gcds> with scheduler
<gcds> I have done something similar in php wit libev
<RX14> why reinvent the wheel when this works perfectly fine?
<RX14> it's just a different way of thinking
<RX14> they are exactly equivalent in terms of what you can do in each
<RX14> it's just that fibers and channels is neater than callback hell
<RX14> i've mentioned no problem here that you wouldn't also have in nodejs
<gcds> Yes, I understand that, but you mention that it can block and nothing will work so I am just trying to find a solution
<RX14> the essential problem here is that you can't have an infinitely buffered channel
<RX14> gcds, in essence using an event loop *is* an infinitely buffered channel
<RX14> since you end up with an ever-increasing number of queued events waiting on this socket to unblock
<RX14> and then you have a memory leak explotable remotely
<RX14> doing this the simple way in nodejs would encourage you to create an easilly DoSable service
<RX14> it's just crystal makes that hard to do
<RX14> gcds, you can always just ignore this issue
<RX14> and it'll work
<RX14> it'll just be exploitable
<gcds> it's internal service which will never be exposed D:
<RX14> well
<RX14> it's still possible for it to happen by accident
<RX14> if the recieving service downstream crashes
<RX14> and just freezes and never reads from the socket
<RX14> in nodejs in that case you get a memory leak
<RX14> in crystal in that case your application freezes
<RX14> as in it just stops sending data down other websockets
<RX14> either you create a memory leak manually
<RX14> or you just skip messages sometimes
<RX14> hmm
<RX14> the smartest thing to do would be to define perhaps a 1MiB buffer and if you ever fill it up just close the connection
<RX14> it's "easy" but too much code to really talk about over IRC
<RX14> ok i've got it
<RX14> serial reciever channel fans out to "buffer fibers" which own an Array(UInt8) which they use as a buffer
<RX14> they recieve from the channel they register with the serial channel array of channels and add the data to the array
<RX14> if the array contains more than x bytes then they just close the websocket
<RX14> the websocket channel would send a message to the buffer fiber once it needed more data
<RX14> the buffer fiber can use select to recieve messages from either the serial fiber or the websocket fiber
<RX14> this really needs some pseudocode to explain :(
<gcds> dont worry :)
<gcds> I will figure out myself this stuff
<RX14> gcds, do it the dumb way first
<RX14> get it working
<RX14> and then figure out how to make it failure tolerant
<RX14> and robust
<gcds> as it will be OS maybe later you could review it :)
<gcds> I am pretty new in Crystal :)
gcds is now known as aurimasniekis
<aurimasniekis> I changed nick to reflect on Github :)
<RX14> cool
<RX14> the ideal datastructure would be a single circuler buffer which clients have a position in relative to byte 0 when you oepned the serial port
<RX14> and then if you fell off the end of it any reads would error out
<RX14> and you just close the websocket with an error
<RX14> but if you're up to date it'd block until more data was written
<RX14> i think that'd be an interesting shard to write
<RX14> because I think it's a common enough problem aurimasniekis
<aurimasniekis> Yeah I guess, I mean before I was using nodejs/ruby and etc but then I work with embedded it's usually binary stuff so crystal is life saver :D
<RX14> yeah well
<RX14> the serial port kinda tipped me off lol
<aurimasniekis> "uart" :D
<RX14> yeah
<RX14> i'm doing a bit of embedded myself soon
<RX14> got an ESP32 arriving from china
<aurimasniekis> oh :D
<RX14> going to be a model rocket payload
<RX14> with gps + pressure sensor + accelerometer + gyro
<aurimasniekis> I using this as main controller and then daisy chained smaller modules :)
<RX14> thats cool
<RX14> thats incredibly cheap
<aurimasniekis> yeah and features :)
<aurimasniekis> i love working with bindings :D
<RX14> aurimasniekis, why so?
<aurimasniekis> Invalid memory access (signal 11) at address 0x0 :D
<RX14> aurimasniekis, pointers i see
flaviodesousa has quit [Ping timeout: 255 seconds]
<aurimasniekis> yeah fun stuff :)
<aurimasniekis> then library is also written in magical way... :D
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <sdogruyol> @RX14 do you have any example of using valgrind for crystal programs
<RX14> probably
<RX14> valgrind >?executable
<RX14> ./*
<RX14> i messed that up
<RX14> just run it the usual way
<RX14> i dont know how much you're going to get out of it
<RX14> ive never run it on crystal before
<FromGitter> <sdogruyol> I'm checking out perf for now
<RX14> oh, callgrind you mean?
<RX14> valgrind typically means the diagnostic tool
<FromGitter> <sdogruyol> yeah
<RX14> not the perf tool
<FromGitter> <sdogruyol> currently, I'm trying to do some profiling with perf
<RX14> valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --separate-threads=yes --cache-sim=yes --branch-sim=yes --simulate-hwpref=yes ./program
<FromGitter> <sdogruyol> meanwhile wondered if there's any quick to use valgrind stuff
<FromGitter> <sdogruyol> @RX14 awesome
<RX14> that creates a callgrind.out file
<RX14> then install kcachegrind
<RX14> and use kcachegrind callgrind.out.<pid>
<RX14> and then it's just GUI work
<RX14> perf runs the program at full speed
<RX14> callgrind runs it 100x slower
<RX14> but gets every juicy detail out of it
<FromGitter> <sdogruyol> let me check
<FromGitter> <sdogruyol> thank you
<RX14> and i mean really 100x slower
<FromGitter> <sdogruyol> more like 1000x lol
<RX14> it took me 30 minutes to compile the compiler with --no-codegen
<RX14> so yeah a bit more than 100x slower
<Yxhuvud> it is probably faster with fewer of those flags. less accurate though
<RX14> --seperate-threads is great because it seperates out the GC work
aurimasniekis has quit [Ping timeout: 255 seconds]
<RX14> because the CG is typically threaded
<RX14> --cache-sim and --branch-sim are just for getting a realistic cycle estimate
<RX14> otherwise it just gives you I1 cache reads
<Yxhuvud> yes, but what is the cost of those simulations?
<RX14> aka executed instructions
<RX14> collect-jumps and dump-instr are just required for kcachegrind
<RX14> Yxhuvud, yeah they're expensive
<RX14> you can really leave off everything after --seperate-threads
<RX14> its just ever so slightly less accurate
claudiuinberlin has joined #crystal-lang
ShalokShalom has joined #crystal-lang
ShalokShalom_ has quit [Ping timeout: 248 seconds]
ShalokShalom has quit [Remote host closed the connection]
Guest66309 is now known as baweaver
baweaver is now known as Guest40909
Guest40909 is now known as baweaver_2
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mark_66 has quit [Remote host closed the connection]
<FromGitter> <OldhamMade> are Hashes ordered? as in, if I call `myhash.keys()` and `myhash.values()`, are they both guaranteed to be in the same order?
<FromGitter> <OldhamMade> docs don't really lead to a conclusive answer
claudiuinberlin has joined #crystal-lang
<RX14> yes
<RX14> they keep insertion order
<RX14> each hash entry is linked
<RX14> doubly linked
<FromGitter> <OldhamMade> perfect, thanks!
John has joined #crystal-lang
John is now known as Guest89968
<Guest89968> Hi, what are the advantages over Go, Rust etc._
<FromGitter> <krypton97> well, it
<FromGitter> <krypton97> it's faster than go and easier to write
<FromGitter> <krypton97> also c bindings are faster than go c bindings
<FromGitter> <krypton97> against rust I don't think it's faster, but it provides a standalone binary
<FromGitter> <mixflame> can anyone tell me how the floating crystal on was made?
<FromGitter> <krypton97> compiling with rust will give you a bunch of files and folders fora binary
<FromGitter> <krypton97> canvas
<FromGitter> <krypton97> there also might be d3
<FromGitter> <krypton97> free q&a
<FromGitter> <krypton97> jk
<RX14> @krypton97 it's just as standalone as rust
<FromGitter> <krypton97> brb
<FromGitter> <krypton97> gonna check something
<RX14> Guest89968, well to sum it up, rust is a lot more strict than crystal, and go has less features
<RX14> rust creates single binaries
<FromGitter> <krypton97> is the go stdlib more complex than the crystal one?
<FromGitter> <krypton97> also rust requires ;
<FromGitter> <krypton97> seems that I got a standalon binary
<FromGitter> <krypton97> maybe there ware crates that were dinamically linked
<FromGitter> <krypton97> oO
<RX14> wait rust requires a semicolon?
<RX14> whyyy in 2017
<FromGitter> <krypton97> it's a paint after getting used to js/go/crystal T_T
<FromGitter> <krypton97> pain lol
<FromGitter> <styler1972> question, anyone here in any good crystal slack groups?
<RX14> why slack
<FromGitter> <krypton97> I think this is the largest group
<RX14> like why ask slack specifically
<RX14> it doesnt make sense
<RX14> the point of a community is the community
<FromGitter> <styler1972> i use slack for work and im in a ton of slack groups
<RX14> not the platform it exists on
<FromGitter> <styler1972> im not for having a debate on whats better, simply asking a question
<FromGitter> <styler1972> ive been on irc since the mid 90's.. love irc
<Guest89968> IRC, Slack, it does not matter
<FromGitter> <krypton97> I don't think there's one
<FromGitter> <styler1972> just curious...
<RX14> pretty much the only IM channels for crystal are irc and gitter
<RX14> which are linked
<FromGitter> <krypton97> or there might be small local groups
<FromGitter> <styler1972> sounds good.. i need to get back on irc
Guest89968 has quit [Quit: Page closed]
<RX14> i recommed hexchat if you're not on mac
<FromGitter> <styler1972> yeah im on mac
<RX14> well aparrently there are better ones for mac
<FromGitter> <styler1972> i'd probably end up bitchX'ing through my ubuntu box
<FromGitter> <styler1972> whats the consensus about using crystal for production facing projects currently?
<FromGitter> <styler1972> like, if i wanted to write some microservices in crystal for a startup nowish
<FromGitter> <styler1972> would you recommend? are people doing it?
<FromGitter> <krypton97> Mac provides that really cool psql gui, I really miss it on linxu
<FromGitter> <krypton97> There's a section on github for curretly used in production projects
<FromGitter> <krypton97> currently*
<RX14> @styler1972 well the consensus is that crystal isn't production ready
<RX14> people have done it
<RX14> and we're thankful for the people who do use it in production
<RX14> but we're not going to say it's ready because it's not
<FromGitter> <krypton97> I personally wouldn't use it mostly because they're still tweaking the stdlib and no threading support ..
<FromGitter> <krypton97> btw, why is the development so slow.. There's still branch 2.3 for some time..
<FromGitter> <krypton97> 1) 23
<FromGitter> <krypton97> **
<FromGitter> <krypton97> release***
<FromGitter> <sdogruyol> I prefer having a 0.24.0 release soon
<FromGitter> <sdogruyol> the diff is so big
<FromGitter> <krypton97> the toml parser, right?
<FromGitter> <krypton97> or are there any others sweets added?
<FromGitter> <straight-shoota> there should've been a release 2 weeks ago IIRC. Don't know whats holding up...
<FromGitter> <styler1972> when will there be a rethinkdb driver?
<FromGitter> <krypton97> we have good redis, sql drivers! Looking through awesome crystal I've found this
<FromGitter> <krypton97> haven't used it though
<FromGitter> <styler1972> yeah i think they stopped development on it.. i saw this one a while ago and its incomplete
<FromGitter> <krypton97> may I ask why rethinkdb?
<FromGitter> <krypton97> I've heard it has a nice api
John has joined #crystal-lang
John is now known as Guest18545
<Guest18545> Does Crystal support ARM64?
<RX14> yes
<Guest18545> Is there a download link to install it?
<RX14> @krypton97 we don't have a toml parser
<Guest18545> * for Linux
<RX14> Guest18545, not really
<RX14> are you running raspbian
<RX14> and isn't raspbian 32bit arm?
<Guest18545> No, Debian 9
<RX14> well
<RX14> you're going to have to cross-compile then
<RX14> what board just out of interest Guest18545
<RX14> or is this for scaleway
<Guest18545> Yes, it is for Scaleway
<FromGitter> <styler1972> @krypton97 i heard that rethink is really good but havent done too much with it
<Guest18545> Furthermore, it is for a server
<RX14> Guest18545, its got support but no distribution for arm64
<RX14> Guest18545, you can do it with a bit of effort
<Guest18545> Thanks :)
<RX14> you're going to need an x86 debian 9 and an arm debian 9
<RX14> both up to date
<RX14> then cross-compile
<Guest18545> I will do it :)
<Guest18545> You should apply for
<FromGitter> <krypton97> I remember I wanted to use crystal and go too on rasbian untill I found it got python preinstalled lol
<RX14> Guest18545, those are instructions for raspbian
<RX14> but you can adapt them with a bit of creativity for debian 9
<RX14> since you have debian 9 on both arm and x86 you dont have to worry about llvm version
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Guest18545> Thank you!
<RX14> and you need to change the arget to aarch64-unknown-linux-gnu
<RX14> target*
<RX14> when cross-compiling
<Guest18545> BTW Do you support static binaries?
<FromGitter> <drosehn> @swelltrain -- I don't know if anyone answered your question, but it looks like crystal takes up about 45-meg of disk space once it is installed. I'm sure it requires a lot of extra space when it is compiling itself (to install a new version of the compiler), but once it is installed it does not take up much space.
<RX14> Guest18545, yes
<Guest18545> Amazing !
<RX14> the problem is that openssl and glibc kinda don't
<RX14> so if you want static libraries you need to do it on alpine linux
<RX14> because it's the only platform that really makes static binaries useful
<Guest18545> Why on Alpine Linux?
<RX14> because of dlopen
<RX14> you need to use musl glibc
<RX14> i mean
<RX14> musl libc
<RX14> instead of glibc
<Guest18545> So, it looks like you are using the same tech like Rust. I guess it should be easy then
<RX14> yeah go's an exception
<RX14> because they have enough resources to write their own libc
<RX14> which is crazy
<FromGitter> <drosehn> Bah. I replied to the wrong person... Sorry @swelltrain
<Guest18545> #Googlemoney haha
<FromGitter> <krypton97> they also invested a lot in v8
<FromGitter> <drosehn> @HCLarsen -- I don't know if anyone answered your question, but it looks like crystal takes up about 45-meg of disk space once it is installed. I'm sure it requires a lot of extra space when it is compiling itself (to install a new version of the compiler), but once it is installed it does not take up much space.
<FromGitter> <krypton97> and made javascript fastest scripted language
<FromGitter> <krypton97> it's pretty impressive how they made go without any c dependency
<FromGitter> <krypton97> should have bin crystal instead :P
<Guest18545> They use a lot of Assembly
<FromGitter> <krypton97> been *
<FromGitter> <krypton97> that's for syscall
<FromGitter> <krypton97> and I really don't mind
<Guest18545> Me neighter
<Guest18545> *neither
<Guest18545> Thank you for the nice chat, I guess Crystal is a nice addition to the lang. I know (Go, Rust, C++, etc. etc.)
<FromGitter> <krypton97> simple si better ;)
<FromGitter> <krypton97> you're wellcome, see us around
<Guest18545> :) There is just one thing I do not like. I need to write a lof of "end".. haha
<Guest18545> Thanks
<FromGitter> <krypton97> To be honest, that's the first think I hated to crystal, but got used pretty quick especially with some plugins
<FromGitter> <krypton97> I still find it better than the python syntax though
<Guest18545> Do you mind to share the plugins?
<FromGitter> <krypton97> Our man @faustinoaq made an amazing vscode plugin
<Guest18545> Thanks :)
<FromGitter> <krypton97> it's the first extension that pops
<FromGitter> <krypton97> I've also heard that some ruby extensions works as well ;)
<FromGitter> <krypton97> btw, in the following code
<FromGitter> <krypton97> if true ⏎ temp = 1 ⏎ end ⏎ ⏎ print temp []
<FromGitter> <krypton97> shouldn't `temp` get cleared out the stack?
claudiuinberlin has joined #crystal-lang
<Guest18545> No wonder, as far as I know/understand Crystal is so similar to Ruby that Crystal can be interpreted by Ruby and vice versa
<FromGitter> <krypton97> I don't know ruby, but in other languages, temp would have a local scope and will become undefined when it reaches the print statement
<FromGitter> <drosehn> The two languages are pretty close, but you try to do anything major you'll find a lot of differences. Some of them pretty minor, some of them are pretty significant (at least for some programs).
<FromGitter> <asterite> krypton97: in ruby that variable would be `nil` if the `if` condition doesn't hold, and in crystal it's the same
<FromGitter> <asterite> RX14: do you think this is ready to merge?
<FromGitter> <asterite> (hi!)
<FromGitter> <krypton97> so, is it globally kept?
<Guest18545> Hi
<RX14> @asterite idk perhaps we should make it work for while and stuff while we're at it
<FromGitter> <drosehn> but when the if-condition is `true`, then the `temp` variable does remain set to `1`.
<RX14> we support it in loop through do
<FromGitter> <drosehn> (at least in ruby)
<FromGitter> <krypton97> I think I got it
<FromGitter> <krypton97> it's like declare this variable if the condition is met
<FromGitter> <asterite> mmm... i don't know, Ruby doesn't have it for `while`
<FromGitter> <asterite> and if we go with `while`, why not with `if`?
<FromGitter> <asterite> but then you can do `else` in a begin/end, so that's a conflict. And maybe `while/else` can be confused with python
<FromGitter> <krypton97> but what if inside an `if` condition I wanna create a temporary variable, how would I do it?
<FromGitter> <asterite> local variables are scoped to an entire method, there's no narrower scope
<FromGitter> <krypton97> is there any function to manually clear the stack?
Guest18545 has quit [Quit: Page closed]
<FromGitter> <asterite> no, and I don't think there's a need for that
<RX14> @asterite well it just seems arbitrary which constructs support rescue and which dont
<RX14> before it was begin/end and def
<RX14> which made sense
<oprypin> no it didnt. should've just need `try`
<oprypin> should've just been try/catch or equivalent
claudiuinberlin has quit [Quit: Textual IRC Client:]
<RX14> :(
<RX14> i like begin/rescue/else/ensure
hallomann has quit [Ping timeout: 246 seconds]
hallomann has joined #crystal-lang
baweaver_2 is now known as baweaver
baweaver has quit [Changing host]
baweaver has joined #crystal-lang
Joshua has joined #crystal-lang
Joshua is now known as Guest14794
<Guest14794> There a so many amazing "new" languages! I cannot decide what l should learn! Crystal, Rust, Nim.......
<Guest14794> Do you mind to share some opinons?
<Guest14794> P.S.: I never wrote Ruby
<RX14> Guest14794, it's a matter of taste
<RX14> rust's cool for low-level software developers because it's GC-less and has robust memory guarantees
<RX14> for most higher-level stuff you're going to be better off with a GC and just not using pointers
<RX14> the data race stuff is pretty cool though
<RX14> nim I don't know enough about to judge
<RX14> i get the impression that @asterite knew of num while/before he started crystal
<RX14> nim*
<RX14> crystal's got some cool stuff which means you have to think about types about as much as in a dynamic language
<RX14> and you dont have to write them often either
<RX14> and it's pretty fast I guess
<RX14> oh and we have cool concurrency
<RX14> apart from that really just get to know the languages and what you prefer Guest14794
<Guest14794> Thank you very much!
<Guest14794> Why do you think that "i get the impression that @asterite knew of num while/before he started crystal"
<RX14> because i remember it from somewhere
<RX14> but im not 100% sure
<Guest14794> Ah, thanks
mounibec has joined #crystal-lang
mounibec has quit [Client Quit]
mouph has joined #crystal-lang
<FromGitter> <drosehn> I enjoy crystal. Rust strikes me as interesting, but seems too complicated to me. Nim isn't something I'm interested in. I just found out about "Pony", which I think might be interesting.
mouph has quit [Client Quit]
<RX14> oh for sure pony is very interesting
<RX14> it's said there are two types of programming languages, ones which try out new ideas and ones which are practical
<RX14> rust is surprisingly somewhat both
<RX14> but i can't really imagine pony as much more than an interesting research vehicle for a latter more practical and less pure language
<RX14> or perhaps that latter more practical language was erlang
<livcd> RX14: why is pony not practical ?
<RX14> well capabilities are a lot to think about i guess
<FromGitter> <asterite> what about ziglang? :-)
<FromGitter> <martinos> When I execute `crystal run` I get the following stack trace. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Is there a way to display the line numbers ? []
<RX14> are you on osx?
<FromGitter> <martinos> Yes
<RX14> rip
<FromGitter> <martinos> Sorry, I don't understand
<FromGitter> <faustinoaq> Hey, I encapsulated the Crystal Logo on JSFiddle, Maybe it would be useful for someone 👉
<RX14> @martinos you need to use `crystal build`
<RX14> then run `dsymutil --flat ./my_file`
<RX14> and then run `./my_file`
<RX14> on linux it works properly
<FromGitter> <martinos> Coool, I am trying it.
<livcd> faustinoaq: ahh is that all coded by hand ?
<RX14> @martinos in master branch the compiler does it
Guest14794 has quit [Ping timeout: 260 seconds]
<RX14> so next release this might be fixed
<RX14> not sure about crystal run
<FromGitter> <faustinoaq> livecd, I copied it from Crystal website, I just modified it a bit
<RX14> yup
<RX14> it works for crystal run
<RX14> so its fixed next release @martinos
<RX14> (which should be soon)
<FromGitter> <martinos> Oh yeah! Thank so much <RX14> this was of great help!
<FromGitter> <faustinoaq> livecd, also see the icosahedron data (
<FromGitter> <bew> RX14 there is a toml parser from manastech: (not sure it's uptodate though)
<RX14> yeah but its not in the stdlib
<livcd> faustinoaq: ah ok :) i always wondered how people did go about the canvas manipulations and so on :)
<FromGitter> <bew> Ah yes, yes
<FromGitter> <faustinoaq> Interesting, a multi-threaded JavaScript runtime 👉 Napa.js -
<FromGitter> <faustinoaq> @bew livecd, maybe we can do an 3d spinning Crystal Logo in Crystal using some 3d engine shard 😉
<RX14> @faustinoaq theres still a few features missing
<RX14> try and stop the crystal logo one
<RX14> and see what happens over time
<RX14> oh nvm i guess im wrong
<RX14> it does do that
<oprypin> RX14, what?
<RX14> hmm?
<oprypin> RX14, I did not understand anything from your reply to faustinoaq
<FromGitter> <faustinoaq> 😅
<RX14> <FromGitter> <faustinoaq> Hey, I encapsulated the Crystal Logo on JSFiddle, Maybe it would be useful for someone 👉
<RX14> i was replying to this
<RX14> sorry i didnt make it at all clear
<oprypin> oh nice
<oprypin> it's kinda blurry for me
<FromGitter> <bew> @faustinoaq ask Groogy! He loves playing with opengl ^^ I'm (almost) sure it'll take him 5min
<oprypin> faustinoaq, well it's definitely possible
<oprypin> i made a crummy cube example a long time ago
<oprypin> Jun 30, 2015 wtf am I that old
<FromGitter> <faustinoaq> > ask Groogy! He loves playing with opengl ^^ I'm (almost) sure it'll take him 5min ⏎ ⏎ Yeah, I think is a good shard 👍
<FromGitter> <faustinoaq> > i made a crummy cube example a long time ago ⏎ ⏎ Oh, very interesting, Can I draw an Icosahedron too ? 😅
<FromGitter> <faustinoaq> oprypin, CrSFML is a very good work too ✨ I got fun with your crsfml-examples, very nice 👍
alex`` has quit [Ping timeout: 252 seconds]