ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.1 | 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> <jwoertink> so this is kinda cool.... no clue what I'm doing, but I'm doing something πŸ˜‚
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e17c03e04adee486b5ea724]
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e17c04ce52f635378b32ebd]
<FromGitter> <Blacksmoke16> not sure what im looking at either
<FromGitter> <watzon> So I just ported `StringScanner` to node to make my life easier πŸ˜‚
<FromGitter> <tenebrousedge> 😬
<FromGitter> <tenebrousedge> js is such a mess
<FromGitter> <watzon> It is haha. But my next job is likely going to be using it pretty heavily, so I may as well get use to it.
<FromGitter> <stnluu_twitter> it is a mess. ES6 ain't too bad these days
<FromGitter> <stnluu_twitter> the only thing that still grinds my gear is the automatic semi colon shit
<FromGitter> <watzon> Yeah I wish they would fix that. I prefer not using semis, but occasionally it still causes issues.
<FromGitter> <watzon> Thankfully eslint prevents most of them
<FromGitter> <stnluu_twitter> some new hire spent hours debugging and the issues was ⏎ ⏎ ```return ⏎ longCondition1 || ⏎ longCondition 2;``` [https://gitter.im/crystal-lang/crystal?at=5e17c51704adee486b5ec9f5]
return0e has quit []
Xeago has quit [Read error: Connection reset by peer]
Xeago has joined #crystal-lang
return0e has joined #crystal-lang
return0e has quit [Client Quit]
Human_G33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<sorcus> I don't found this function https://github.com/benbahrenburg/Ti.SlowAES/blob/master/SlowAES/aes.js#L679 in crystal's stdlib... So i wrote my own implementation. :-D
<sorcus> Just rewrite code from js to crystal with little code modifications :-D :-D :-D
<FromGitter> <Blacksmoke16> a more user friendly API for handling encryption would prob be a nice addition
<sorcus> `node aes.js 0.13s user 0.02s system 90% cpu 0.168 total` vs `./aes 0.01s user 0.00s system 92% cpu 0.006 total` :-D :-D :-D
<FromGitter> <Nicolab> Excellent✌
<sorcus> Code here - https://gist.github.com/MrSorcus/290b7d5679f9b243993a33cef318186a but it's very ugly and not fully. :-D
<sorcus> Can be useful for generation CloudFlare cookie.
<sorcus> :-D
<sorcus> If site behind Cloudflare and needed access to website from crystal's HTTP client :-D
<FromGitter> <tenebrousedge> you're defining a `rotate` method. Why not use `Array#rotate` ?
<sorcus> tenebrousedge: because i just rewrite similar functions from aes.js to crystal. :-D X-)
<sorcus> tenebrousedge: fixed :-D Thanks.
<sorcus> Now, sweet dreams everyone :-)
alex`` has quit [Ping timeout: 240 seconds]
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Trying to come up with an automated way to package an app with fpm, how can I dynamically list what the app depends on?
<FromGitter> <Blacksmoke16> `ldd myapp`?
early has quit [Quit: Leaving]
<FromGitter> <Daniel-Worrall> ty
martinium has joined #crystal-lang
early has joined #crystal-lang
Nicolab has quit [Quit: Leaving.]
alex`` has quit [Ping timeout: 240 seconds]
alexherbo2 has quit [Ping timeout: 265 seconds]
yukai has quit [Ping timeout: 240 seconds]
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
martinium has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter> <grkek> Hello
uu91 has joined #crystal-lang
ht_ has joined #crystal-lang
<FromGitter> <s0kil> Are there any options or best practices to reduce compilation time? ⏎ I know `--no-debug`shaves off a few seconds, Is there any other options?
ht_ has quit [Quit: ht_]
martinium has joined #crystal-lang
<FromGitter> <stnluu_twitter> use a utility (like fswatch on mac) to watch a folder and run the compile command whenever u save a file
<FromGitter> <stnluu_twitter> saves you a few hundred milliseconds
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Nicolab> Hi
Nicolab has joined #crystal-lang
<FromGitter> <Nicolab> https://github.com/cespare/reflex cross platforms
<FromGitter> <Nicolab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e183662c3950349027475b7]
<FromGitter> <Nicolab> To watch only src dir: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e183d545597551890515ed0]
<sorcus> Hi :-)
<repo> sorcus: o/
lunarkitty has quit [Ping timeout: 248 seconds]
lunarkitty has joined #crystal-lang
alexherbo2 has joined #crystal-lang
lunarkitty has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
lunarkitty has joined #crystal-lang
<FromGitter> <alehander92> reimplementing crypto algo-s requires a lot of carefulness
<FromGitter> <straight-shoota> @Nicolab How's that different/better than entr?
<FromGitter> <Nicolab> entr?
<FromGitter> <Nicolab> What is?
<FromGitter> <Nicolab> if entr is a watcher
<FromGitter> <Nicolab> I don't know, I use *reflex* with Go (lang), so I naturally took it with Crystal too
<FromGitter> <Nicolab> @straight-shoota
<sorcus> alehander92: you mean my implementation of aes.js?
DTZUZO_ has quit [Read error: Connection reset by peer]
<sorcus> alehander92: i know it and i use it only in my parser. :-D
DTZUZO_ has joined #crystal-lang
<sorcus> alehander92: This is just for fun :-D I don't have any plans for using this in serious projects.
<FromGitter> <Nicolab> @straight-shoota https://github.com/eradman/entr ? I have not tested entr
<FromGitter> <Nicolab> what I like about *reflex*, it's the support *glob* and regex (by exclusion `-R` for regex and inclusion `-r` for regex, `-g` and `-G`for *glob* ). Also the flag `--start-service` for a long running process (like a server or a daemon)
<FromGitter> <alehander92> sorcus ok :) not bad to learn, just keep yeah try to use something well checked in serious code
<FromGitter> <manveru> @Nicolab i switched to https://github.com/watchexec/watchexec mostly
<FromGitter> <Nicolab> @manveru I'm going to look this, thank you
<FromGitter> <Nicolab> It looks great!
<FromGitter> <Nicolab> > By default, uses .gitignore to determine which files to ignore notifications for
<FromGitter> <Nicolab> Rust ❀️
ancorgs has quit [Quit: ZNC 1.6.4 - http://znc.in]
<livcd> oh there is not a watcher in Crystal ?
<FromGitter> <manveru> there is https://shardbox.org/shards/guardian
<FromGitter> <manveru> just not a fan of having a config file for this :)
ancorgs has joined #crystal-lang
<FromGitter> <Blacksmoke16> is also https://github.com/samueleaton/sentry
<repo> aaand there's also https://github.com/repomaa/paladin
ht_ has joined #crystal-lang
duane has quit [Ping timeout: 268 seconds]
duane has joined #crystal-lang
<sorcus> https://gist.github.com/MrSorcus/f6a19bf52f499743f54448161430b807 - this code very-very-very slow compiled in release mode. Can someone explain, why it does?
<sorcus> And eats tons of memory :-D
<FromGitter> <tenebrousedge> how big is that array?
<sorcus> tenebrousedge: Very big i think :-D :-D :-D
<sorcus> tenebrousedge: https://github.com/dhuertas/AES/blob/master/aes.c#L32 - ~65KB should be.
<FromGitter> <alehander92> is the compilation slow
<FromGitter> <alehander92> or the runtime
<FromGitter> <tenebrousedge> compilation, but only in release mode
<sorcus> alehander92: Compilation. At runtime it's very fast.
<FromGitter> <alehander92> ah i see
<sorcus> alehander92: AES 47.52k ( 21.04Β΅s) (Β± 2.48%) 11.2kB/op fastest - this measured with crystal's benchmark.
<FromGitter> <alehander92> hmm, but in debug mode ok?
<FromGitter> <cyanidee> hey i have a question, im a beginner and i wanted to know if there is any way to see how macros expand? without actually compiling the code
<FromGitter> <cyanidee> the generated code fails to compile and i wanna see why
<FromGitter> <Blacksmoke16> there is a cli command to do it
<FromGitter> <Blacksmoke16> or you can add `{{debug}}` to the end of your macro and try to run the code and it'll show the expanded macro
<sorcus> alehander92: crystal build gmult_aes.cr 5.35s user 0.98s system 66% cpu 9.478 total - ~10 sec without release flag.
<FromGitter> <cyanidee> @Blacksmoke16 like this?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <cyanidee> uhhh it doesnt show me anything and it still fails to compile
<FromGitter> <Blacksmoke16> scroll up above the error message maybe?
<sorcus> alehander92: crystal build --release gmult_aes.cr 107.24s user 16.94s system 48% cpu 4:14.99 total - and ~4 minutes with --release flag.
<FromGitter> <vlazar> @sorcus For slow compilation it's a known issue, see https://github.com/crystal-lang/crystal/issues/5792
<sorcus> vlazar: Ohh. Sad :-(
<FromGitter> <tenebrousedge> huh
<FromGitter> <vlazar> It seems not a big priority for core team now, workaround works fine, however unlikely people would use such workarounds much.
<FromGitter> <vlazar> I mean if you need to replace all literals with method calls...
<FromGitter> <Blacksmoke16> also whats the error @cyanidee ?
<FromGitter> <cyanidee> oh sorry i was away for a bit
<FromGitter> <cyanidee> uhhh
<FromGitter> <cyanidee> ``` ⏎ 33 | end ⏎ ^ ⏎ Error: expecting token 'EOF', not 'end'``` [https://gitter.im/crystal-lang/crystal?at=5e18a68dc39503490277354e]
<FromGitter> <cyanidee> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e18a69c91129970caa28c11]
<FromGitter> <cyanidee> thats my code
<FromGitter> <Blacksmoke16> there is no `for` loops
<FromGitter> <Blacksmoke16> are*
<FromGitter> <cyanidee> ohhhhhh 😦
<FromGitter> <Blacksmoke16> ```sizeof({{type}}).times do ⏎ @buffer << pointer[a] ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5e18a6bbe409da486cfa7aa9]
<FromGitter> <cyanidee> o
<FromGitter> <cyanidee> where's a though?
<FromGitter> <Blacksmoke16> idk i copied what you had
<FromGitter> <Blacksmoke16> in the loop
<FromGitter> <Blacksmoke16> prob will be another error πŸ˜‰
<FromGitter> <cyanidee> do i need to define `a` outside and increment it?
<FromGitter> <Blacksmoke16> what are you trying to do?
<FromGitter> <Blacksmoke16> prob is an easier way
<FromGitter> <cyanidee> i can write C code for it
<FromGitter> <cyanidee> i cant explain it easily
<FromGitter> <Blacksmoke16> could also link against your C code
<FromGitter> <Blacksmoke16> if it has a lot of logic in it
<FromGitter> <cyanidee> ```for (int i = 0; i < sizeof(Type); i++) { ⏎ // Do whatever I want with `pointer[i]` ⏎ }``` [https://gitter.im/crystal-lang/crystal?at=5e18a745e409da486cfa7ef6]
<FromGitter> <cyanidee> thats what i would like to do
<FromGitter> <cyanidee> i dont really want to depend on C code
<FromGitter> <tenebrousedge> why do you need a pointer?
<FromGitter> <Blacksmoke16> gotcha, is there a reason you need to interact directly with a pointer?
<FromGitter> <cyanidee> i want to get raw bytes of a variable
<FromGitter> <Blacksmoke16> for a specific reason?
<FromGitter> <cyanidee> uhhh i just need them
<FromGitter> <cyanidee> i need them for the protocol implementation :P
<FromGitter> <cyanidee> i can also convert numbers to bytes using simple math but pointers are way easier to do
<FromGitter> <cyanidee> also more universal
<FromGitter> <cyanidee> ohhh so i can create a byte array at given address of given size?
<FromGitter> <cyanidee> oh and turns out the error was just a matter of adding `()` around macro call πŸ˜…
<FromGitter> <cyanidee> thanks @tenebrousedge for the `Slice` hint!
<FromGitter> <tenebrousedge> you're welcome, hope it works for you
<FromGitter> <grkek> Hello
<FromGitter> <watzon> Hola @grkek
<FromGitter> <Nicolab> Hello @grkek
<FromGitter> <cyanidee> okay sorry to bother you guys again, but i have a quick question: can i use `self` to pass current object instance to some other method/function?
<FromGitter> <watzon> @cyanidee as long as you're not doing it in the initializer
<FromGitter> <tenebrousedge> yes. It's a little unusual
<FromGitter> <cyanidee> ```class Test ⏎ def test ⏎ consume_test(self) ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5e18b6919c13050f1faa3227]
<FromGitter> <cyanidee> would this work?
<FromGitter> <watzon> It should
<FromGitter> <cyanidee> okay thanks! im going to try it out
<FromGitter> <grkek> How are you guys ?
<FromGitter> <watzon> In Ruby you can do that anywhere, including the initializer, but Crystal doesn't allow you to because your object may not be finished initializing when it gets passed into another object
sagax has quit [Ping timeout: 240 seconds]
<FromGitter> <watzon> @grkek pretty well. Doing some reading up on Zig lang today
<FromGitter> <grkek> Is there a function to override for that purpose like finished_init or something
<FromGitter> <grkek> zig ?
<FromGitter> <grkek> sounds weird
<FromGitter> <watzon> Yet another newer language haha
<FromGitter> <grkek> is it even half as good as crystal ?
<FromGitter> <watzon> finished_init? Not that I know of. You can always call a function at the end of your initializer.
<FromGitter> <watzon> Well zig is barely half as old as Crystal, and will never have it's syntax. Faster though.
<FromGitter> <grkek> Is it faster ?
<FromGitter> <watzon> It's actually faster than C apparently, and also can be used as a C compiler. It came out in 2017 though, and still has a long way to go before it's mature. Syntax changes are still happening all the time.
<FromGitter> <grkek> oh damn it looks like it has a c-ish syntax
<FromGitter> <watzon> And no package manager yet
<FromGitter> <grkek> It is faster than C how ?
<FromGitter> <grkek> does it do better optimizations via assembly than the GCC compiler ?
<FromGitter> <grkek> no way
<FromGitter> <watzon> Yeah it's got a similar syntax to C. More powerful out of the box though, or so it seems to me.
<FromGitter> <watzon> It's definitely possible to be faster than C. It wouldn't be the only one.
<FromGitter> <watzon> I haven't gotten to test the "faster than C" claim myself yet. Benchmarks pending.
<FromGitter> <grkek> I want to try the language now
<FromGitter> <grkek> damn
<FromGitter> <grkek> i like the shorthand declaration of types
<FromGitter> <grkek> and keywords seem cute as well
<FromGitter> <watzon> It could just be "faster" because it's easier to write performant code in Zig than it is in C, seeing as C is so old and clunky.
<FromGitter> <watzon> /shrug
<FromGitter> <grkek> /double-shrug
<FromGitter> <watzon> Unfortunately the don't have a regex implementation working yet, but I think that will be coming soon
<FromGitter> <watzon> As a toy project I'm going to work on writing a StringScanner implementation for Zig like I did for nodejs yesterday, should be a fun introduction to the language
<FromGitter> <watzon> But without regex I can only scan char by chat
<FromGitter> <grkek> Well I can say the language looks disgusting
<FromGitter> <grkek> a bit
<FromGitter> <grkek> larger codebase makes it look sad
<FromGitter> <grkek> anything else than zig ?
<FromGitter> <grkek> I know nim
<FromGitter> <watzon> Yeah it's definitely still very new. They're working on a self-hosted compiler right now.
<FromGitter> <grkek> I loved it and then I found crystal
<FromGitter> <watzon> The main ones I know of are Crystal, Nim, and Zig
<FromGitter> <watzon> Zig I just barely learned about
<FromGitter> <grkek> crystal is the best one so far
<FromGitter> <watzon> Julia is a good one as well
<FromGitter> <grkek> So it is on llvm as well
<FromGitter> <watzon> Yeah, although it seems as though they have the goal of eventually removing LLVM, at least for some cases
<FromGitter> <watzon> I watched on of the creator's live streams where he said he eventually hopes to create his own assebmler
<FromGitter> <grkek> > route(handler::Function, app::App, methods::Int, path::String)
<FromGitter> <grkek> the declaration of types
<FromGitter> <grkek> is disgusting
<FromGitter> <watzon> Where did that come from?
<FromGitter> <watzon> If it's a blog post there's a very good chance it's out of date, type declarations don't look like that
<FromGitter> <btihen> @tenebrousedge - why is it unusual to pass self?
<FromGitter> <watzon> Here's their JSON parser implementation https://github.com/ziglang/zig/blob/master/lib/std/json.zig
<FromGitter> <rishavs> If you are interested in gamedev, there's also https://github.com/beefytech/Beef
<FromGitter> <tenebrousedge> it's slightly more typical to call methods defined on `self` than to pass `self`. So presumably there's a good reason for doing the latter
<FromGitter> <rishavs> It went really big on HN this week and is made by the co-founder of popcap games
<FromGitter> <watzon> > The syntax and many semantics are most directly derived from C# ⏎ ⏎ Well I'm out
<FromGitter> <rishavs> same boat. Love the idea behind the language. But I really dislike the verbosity of c#
<FromGitter> <watzon> Yeah same. I just can't, especially when there are so many other choices.
<FromGitter> <watzon> Good editor support is nice, but I can deal
<FromGitter> <rishavs> There is also https://vlang.io/. Pretty young and the author is known to make big claims but folks are pretty hyped about it
<FromGitter> <rishavs> we are pretty much in the golden age of languages right now
<FromGitter> <watzon> I can't with Vlang either. The creator somehow expects the community to thrive in a box. He bans people from the communities and github just for criticizing the language and having a difference of opinion and he is the *only* core maintainer.
<FromGitter> <watzon> It showed promise, but he'd have to give up control before I'd be willing to really give it a fair shake again
<FromGitter> <grkek> now, now C# is nice
<FromGitter> <grkek> why would you insult it
<FromGitter> <watzon> There are definitely a lot of good languages coming out though. I blame LLVM for making it so easy.
<FromGitter> <grkek> true LLVM is like the open gate for everyone to make a programming language
<FromGitter> <rishavs> c# is nice but I prefer smaller languages.. C# is too verbose and has way too many features
<FromGitter> <watzon> C# is unnecessarily verbose and still has shit support on Linux, even though Microsoft open sourced dotnet years ago.
<FromGitter> <grkek> C# was my first language tho
<FromGitter> <rishavs> :)
<FromGitter> <watzon> PHP was mine, and I hate it lol
<FromGitter> <grkek> then I moved to C, C++
<FromGitter> <grkek> I hate php so much
<FromGitter> <grkek> oh my god
<FromGitter> <grkek> I hate it
<FromGitter> <watzon> PHP is one of the worst
<FromGitter> <rishavs> I really want to love f#. it seems to have everything that i want. but i just suck with func languages
<FromGitter> <kinxer> My first language was TI-BASIC. Like with PHP, anything else is an improvement.
<FromGitter> <watzon> My problem with F# is one of my same problems with C#. Microsoft.
<FromGitter> <watzon> They're just not good at languages
<FromGitter> <watzon> Look at VB
<FromGitter> <watzon> Ahhh all the BASIC variations
<FromGitter> <rishavs> qBasic was my 1st as well
<FromGitter> <rishavs> that and LOGO
<FromGitter> <grkek> the VB
<FromGitter> <grkek> is so bad
<FromGitter> <grkek> its just
<FromGitter> <grkek> worse than php
<FromGitter> <grkek> VB*
<FromGitter> <grkek> not the VB ;d
<FromGitter> <watzon> Lol
<FromGitter> <watzon> I hate PHP and Java almost equally
<FromGitter> <grkek> I really like Elixir
<FromGitter> <grkek> comfy af
<FromGitter> <watzon> Elixir is nice, I just can't wrap my head around the model they use. Very different from what I'm use to.
<FromGitter> <watzon> Same with Pony
<FromGitter> <watzon> That's another good newer language btw
<FromGitter> <grkek> True
<FromGitter> <grkek> I loved pony
<FromGitter> <grkek> a lot
<FromGitter> <grkek> but couldn't get myself up to learn it
<FromGitter> <rishavs> I like elixir too, but hate the fact that you cant use it for anything other than webdev
<oprypin> when/after running specs, is there a way to find out programmatically how many failed? i guess one way would be to read junit-style test results, any quick pointers on that?
<FromGitter> <watzon> Well elixir definitely can be used for stuff besides web dev, but it's not much of a systems language I'll say that for it
<FromGitter> <watzon> It's good for protocol implementations, telecom, web dev, etc
<FromGitter> <watzon> Stuff where you need to send data from point A to point B and you want to do it in a concurrent, distributed, fail-safe manner
<FromGitter> <grkek> Crystal still beats it
<FromGitter> <straight-shoota> oprypin, tap formatter could be an option as well. It doesn't print a summary currently, but it prints one line for every example and you could simply count the lines starting with "not ok"
<FromGitter> <grkek> Are there any advanced books to learn crystal form ?
<FromGitter> <grkek> from*
<FromGitter> <watzon> Agreed, at least in most cases. I'd much rather use Lucky for webdev myself.
<FromGitter> <watzon> No advanced books yet afaik. I do think someone is writing a book, but I'd have to go looking.
<FromGitter> <grkek> Have you looked at uhh my framework @watzon
<FromGitter> <watzon> Can't say I have. Brb.
<FromGitter> <grkek> Ill link w8
<FromGitter> <grkek> https://github.com/grkek/grip
<FromGitter> <grkek> here you go
<FromGitter> <watzon> Hmm interesting. So the goal is for it to be used for JSON APIs?
<FromGitter> <grkek> It basically is a fork of kemal switched up and morphed into a JSON only router around the http server :D
<FromGitter> <grkek> yeah
<FromGitter> <grkek> and nothing else
<FromGitter> <rishavs> I prefer to sue vanila crystal. I am using just the http module for my api server
<FromGitter> <watzon> Nice. I'll have to keep it in mind for the next time I need a simple API.
<FromGitter> <Blacksmoke16> looks like athena has some competition now πŸ˜‰
<FromGitter> <grkek> Oooh my
<FromGitter> <grkek> Its not as good as athena
<FromGitter> <grkek> but it works when you need it to wokr
<FromGitter> <grkek> work*
<FromGitter> <Blacksmoke16> getting close to releasing the rewrite, is pretty πŸ’―
<FromGitter> <grkek> also has a bomb ass websocket support
<FromGitter> <watzon> Ooooh
<FromGitter> <Blacksmoke16> got me beat on that :p
<FromGitter> <watzon> I like rewrites
<FromGitter> <grkek> true, anything rewritten gets better
<FromGitter> <grkek> not the case for microsoft but
<FromGitter> <grkek> you get the image
<FromGitter> <straight-shoota> oprypin alternatively you can just hook into `spec` in a helper and add a custom formatter that prints the results on the last line. See `Spec.add_formatter`
<FromGitter> <Blacksmoke16> @watzon https://github.com/Blacksmoke16/athena/pull/36
<FromGitter> <grkek> Specs are a thing I need to learn for sure
<FromGitter> <watzon> Ahh you separated DI, nice
<FromGitter> <watzon> Very nicely done
<FromGitter> <Blacksmoke16> yea, the routing side of things is now event based using event distpatcher
<FromGitter> <grkek> That is a big PR
<FromGitter> <grkek> also what does DI do in general
<FromGitter> <watzon> Yes it is haha
<FromGitter> <grkek> I have no idea
<FromGitter> <watzon> Dependency Injection
<FromGitter> <grkek> because I suck at OOP
<FromGitter> <watzon> It's a huge topic
<FromGitter> <grkek> what does it do explain in couple of words
<FromGitter> <Blacksmoke16> so like its much easier to add/listen in on specific events during the request's life-cycle
<FromGitter> <Blacksmoke16> versus having to add a new `HTTP::Handler` at a given index in an array
<FromGitter> <grkek> dissing me huh ?
<FromGitter> <grkek> : (
<FromGitter> <Blacksmoke16> no, thats how you had to do it before in athena
<FromGitter> <Blacksmoke16> i didnt like it
<FromGitter> <Blacksmoke16> :p
<FromGitter> <grkek> Isn't DI slower ?
<FromGitter> <tenebrousedge> than?
<FromGitter> <grkek> runtime < compiletime ?
<FromGitter> <Blacksmoke16> the SC is built out at compile time, but there is more overhead since it has to be instantiate for every request
<FromGitter> <Blacksmoke16> so yes its slower than kemal for example, but still plenty fast
<FromGitter> <watzon> It's a convenience feature. Generally convenience tends to make things a little slower, but you make up for it in productivity
<FromGitter> <grkek> I am so glad I joined this gitter I've learned so much :D
<FromGitter> <Blacksmoke16> (needs to be updated for some changes in that PR tho)
<FromGitter> <Blacksmoke16> but that gives you a good overview (from the viewpoint of my di shard)
<FromGitter> <watzon> Honesly one thing I can say for Crystal: best community by far
<FromGitter> <grkek> true, people are just happy for it
<FromGitter> <grkek> happy for eachother etc
<FromGitter> <Blacksmoke16> tl;dr DI abstracts the instantiation of objects into a single location that handles providing those objects where they are needed. Works best if you base your code on interfaces versus concrete types
<FromGitter> <watzon> Pretty languages tend to make people happy 😊
<FromGitter> <grkek> Python community is just OOH USE LIST COMPREHENSIONS
<oprypin> excuuuuse me
<FromGitter> <grkek> its slow because you're just not doing it right
<FromGitter> <grkek> > Language bashing
<FromGitter> <grkek> > Not fun but okay
<FromGitter> <j8r> then they become list incomprehensions
<FromGitter> <grkek> @j8r this guy gets it
<FromGitter> <j8r> haha πŸ˜„
<FromGitter> <grkek> What type of music do you people listen to ?
<FromGitter> <tenebrousedge> atmospheric noise
<oprypin> it's very tempting to reply but it's certainly off topic
<FromGitter> <j8r> that's like interference noise?
<FromGitter> <tenebrousedge> more random, I think
<FromGitter> <grkek> @tenebrousedge I listened to harsh noise and made me lose hearing in my left ear
<FromGitter> <j8r> usually when asking this question, it should have a random dude replying with a list of dozen of exotic music types
<FromGitter> <grkek> @tenebrousedge https://www.youtube.com/watch?v=CFT4McaInMg
<FromGitter> <grkek> here is the thing I listened
<FromGitter> <grkek> like 5-6 times
<FromGitter> <grkek> I really like the hell aesthetics
<FromGitter> <tenebrousedge> usually when coding I have Cage's 4'33" on in a loop
<FromGitter> <grkek> and the Doom OST is just perfect to be angry and program at the same time
<FromGitter> <grkek> but atmospheric noise is perfect for concentration
<FromGitter> <grkek> as well as Susumo Yokota
<FromGitter> <watzon> Mongolian Throat Singing is pretty cool
<FromGitter> <j8r> on topic: anyone has experience with the Docker API - any feedback?
<FromGitter> <grkek> Oh my god I love it so much
<FromGitter> <watzon> Look up "The HU`on YouTube
<FromGitter> <tenebrousedge> the docker API?
<FromGitter> <watzon> @j8r I actually started writing a shard for it a loooong time ago
<FromGitter> <grkek> wolf totem is pretty nice
<FromGitter> <grkek> this guy
<FromGitter> <grkek> perfecto
<FromGitter> <grkek> I respect mongolian empire a lot
<FromGitter> <j8r> @watzon what do you think of it? I would like to see how it compares with the LXD REST API, which I am writing a shard
<FromGitter> <j8r> I have used it once, and it found it meh
<FromGitter> <watzon> Honestly I haven't touched it in a while and don't really know anything about the LXD API. I don't remember liking it much though.
<FromGitter> <j8r> there is rest api, or it's through socket?
<FromGitter> <grkek> I am also into Iraqi songs
<FromGitter> <grkek> this one particularly
<FromGitter> <grkek> > Talk about pHp
<FromGitter> <grkek> > Youtube recommends php talks now
<FromGitter> <grkek> gitter is a google spy
<FromGitter> <watzon> Oof lol
<FromGitter> <grkek> Google is basically everywhere at this point
sagax has joined #crystal-lang
<oprypin> 😬
<FromGitter> <watzon> Big brother is watching
<FromGitter> <grkek> Everytime everywhere
<FromGitter> <grkek> they are sitting in the corner glowing
<FromGitter> <grkek> you cant see them
<FromGitter> <grkek> but they are there
return0e has joined #crystal-lang
<FromGitter> <sudomaxime> Hey guys, just discovered crystal, I think it's awesome ! Is there any use case of people using it in production for web services ?
<FromGitter> <Blacksmoke16> o/
<FromGitter> <sudomaxime> Thanks a lot !
<FromGitter> <Blacksmoke16> is also https://friendsofcrystal.com/
<FromGitter> <sudomaxime> How stable is the core, does it changes often still ?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Blacksmoke16> can checkout the changelog https://github.com/crystal-lang/crystal/blob/master/CHANGELOG.md
<FromGitter> <Blacksmoke16> can search for `(breaking-change)`
<FromGitter> <Blacksmoke16> granted it's mostly API changes, nothing super super major that iv've seen so far
<FromGitter> <sudomaxime> Right !
<FromGitter> <Blacksmoke16> if you pay attention to upcoming releases, run your spec suite against nightly, and pay attention to warnings you should be fine
<FromGitter> <sudomaxime> We're building a content distribution service and we need to build small contained proxies for our clients to consume our API, we've been playing with Rust because speed / memory is a huge issue, Crystal is much more productive than Rust
<FromGitter> <sudomaxime> I guess we will give it a shot :) !
<FromGitter> <Blacksmoke16> πŸ‘ sounds like a plan
<FromGitter> <watzon> @sudomaxime welcome to the community
<FromGitter> <watzon> Definitely reach out if you need any help getting started
<FromGitter> <sudomaxime> Thanks so much !
<FromGitter> <grkek> Welcome, would you mind taking a look at my framework ? @sudomaxime
<FromGitter> <grkek> > Shilling intensifies
<FromGitter> <sudomaxime> Yeah sure pass it along !
<FromGitter> <grkek> https://github.com/grkek/grip
<FromGitter> <grkek> here you go !
<FromGitter> <sudomaxime> This looks really nice, I'm going to try that out !
<FromGitter> <grkek> Thank you a lot ! ❀️
<FromGitter> <Blacksmoke16> have you done any research on what libraries you're going to need/user?
<FromGitter> <sudomaxime> Not so much at this point, really I need to talk to a mongo database, a oAuth service and send back json
<FromGitter> <Blacksmoke16> as a RESTful API?
<FromGitter> <sudomaxime> Yup !
<FromGitter> <Blacksmoke16> with a lot of endpoints?
<FromGitter> <sudomaxime> not so much, prob under 20
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <Blacksmoke16> you have some options
<FromGitter> <sudomaxime> The business logic is very simple
<FromGitter> <Blacksmoke16> https://luckyframework.org/ and https://amberframework.org/ would be your more rails like frameworks
<FromGitter> <watzon> They might be a bit bulky though, depending on the usecase
<FromGitter> <Blacksmoke16> @grkek's and https://kemalcr.com/ are more like Sinatra, probably sufficient if your project is simple
<FromGitter> <watzon> They're definitely powerful
<FromGitter> <sudomaxime> I'm looking for something like Flask for Python, Express for Js or Actix for rust
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/athena (almost done with the rewrite) would be like Spring or Symfony
<FromGitter> <grkek> Mine is not like sinatra tbh
<FromGitter> <grkek> it has its own type of a thing
<FromGitter> <Blacksmoke16> in how you define routes and stuff it kinda is
<FromGitter> <grkek> hmmmm kemal is but mine is like
<FromGitter> <grkek> class a ⏎ route "/" ⏎ end
<FromGitter> <Blacksmoke16> true true
<FromGitter> <grkek> its more of a mix of class oriented
<FromGitter> <grkek> and sinatra liek
<FromGitter> <grkek> like*
<FromGitter> <sudomaxime> The implementation is not a big issue for me, just the lightness, I rather bring tools together to build what I need than using frameworks
<FromGitter> <grkek> Try and have fun with crystal
<FromGitter> <grkek> happy crystaling
<FromGitter> <Blacksmoke16> depends on the architecture/style you're used to
<FromGitter> <Blacksmoke16> each has their pros/cons
<FromGitter> <sudomaxime> Yeah ! we'll get used with the language first and then see what brings us joy, Marie Kondo style :D
<FromGitter> <Blacksmoke16> πŸ‘
<FromGitter> <grkek> Good luck with it !
Nicolab has quit [Ping timeout: 268 seconds]
<FromGitter> <watzon> Crystal definitely sparks joy as a language, I'm sure you'll find a solution you love
alexherbo28 has joined #crystal-lang
alex`` has quit [Ping timeout: 258 seconds]
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo28 is now known as alexherbo2
alex`` has joined #crystal-lang
<sorcus> Hmmm... https://github.com/crystal-lang/crystal/issues/5792 - why this is hard to fix? It's a crystal's restrictions or LLVM?
<FromGitter> <watzon> Apparently LLVM
alexherbo28 has joined #crystal-lang
alex`` has quit [Ping timeout: 268 seconds]
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo28 is now known as alexherbo2
alex`` has joined #crystal-lang
Nicolab has joined #crystal-lang
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
<sorcus> watzon: but why similar code clang compiled via clang without problems? :-D
<FromGitter> <watzon> /shrug
<FromGitter> <watzon> That would be a question for the maintainers. I don't know a lot about the LLVM code generation.
duane has quit [Ping timeout: 258 seconds]
<sorcus> watzon: https://github.com/crystal-lang/crystal/issues/4516#issuecomment-306259664 - @asterite said the LLVM produce a lot of `alloca`, but for this code https://gist.github.com/MrSorcus/f6a19bf52f499743f54448161430b807 i don't see them. But i'm not good familiar with LLVM IR and i don't understand why it's still compiled slowly even without tons of `alloca`. Hmmm....
<FromGitter> <watzon> Yeah idk either
<FromGitter> <jwoertink> What's the crystal version of Ruby's `[].pack()`?
<FromGitter> <Blacksmoke16> dont think there is one?
<FromGitter> <watzon> There isn't one unfortunately
<FromGitter> <jwoertink> ah damn!
<FromGitter> <watzon> You have to deal with a number of different things, like `IO::ByteFormat`
<FromGitter> <jwoertink> I saw that, but wasn't quite sure how to use it
<FromGitter> <watzon> Someone started writing a shard for pack iirc, but idk how complete it is
<FromGitter> <jwoertink> Alright, I'll dig around.
<FromGitter> <watzon> I've needed it a number of times, but I've always had to dig in to what the pack expression was actually doing and figure out how to replicate it in Crystal
<FromGitter> <watzon> Usually not fun
<FromGitter> <jwoertink> Is there a reason it's not in, or just that it was never added? I'm wondering if I should open an issue about it
<FromGitter> <Blacksmoke16> was quite a while ago tho
<FromGitter> <jwoertink> ah, good find
uu91 has quit [Remote host closed the connection]
<sorcus> Looks like array allocated on line 63903... Maybe...
<sorcus> Oh, this is so hard for me :-D :-D :-D
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo20 is now known as alexherbo2
alex`` has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
ht_ has quit [Quit: ht_]
<FromGitter> <jwoertink> If there's a bug in the `play.crystal-lang` site, are those reported to the main repo, or is there a different repo that goes to?
<FromGitter> <straight-shoota> @jwoertink play.crystal-lang.org is https://github.com/jhass/carc.in
<FromGitter> <jwoertink> ah, ok.
<FromGitter> <jwoertink> Not sure if this bug is the site related, or crystal related. But I'll start there
<FromGitter> <jwoertink> Thanks
<FromGitter> <straight-shoota> What is it?
<FromGitter> <jwoertink> ```io = IO::Memory.new ⏎ ⏎ IO::ByteFormat::LittleEndian.encode(5, io) ⏎ ⏎ puts io``` [https://gitter.im/crystal-lang/crystal?at=5e18f9b28d9f831bc508fdaa]
<FromGitter> <jwoertink> putting that in the play just sends you back to an empty text field
<FromGitter> <jwoertink> oh, I guess it's only empty in chrome. Firefox shows the original code.
<sorcus> https://github.com/rust-lang/rust/issues/49330 - Haha, Rust has similar issue. X-)
<FromGitter> <straight-shoota> @jwoertink Yeah, I get the code in Chrome as well. It's probably caused by the program writing a null byte to it's stdout
<FromGitter> <straight-shoota> This reproduces the same behaviour: ⏎ ⏎ ```puts Char::ZERO``` [https://gitter.im/crystal-lang/crystal?at=5e18faf443c3b62d79d28d13]
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> Crystal error?
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo29 is now known as alexherbo2
<FromGitter> <jwoertink> I made an issue on carc.in
<FromGitter> <straight-shoota> No, Crystal performs exactly as expected. Carc.in seems not to be able to cope with that.
<FromGitter> <jwoertink> πŸ‘
alexherbo2 has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 268 seconds]
alexherbo2 has joined #crystal-lang
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
alexherbo29 is now known as alexherbo2
<FromGitter> <Nicolab> @sudomaxime Welcome! Me too I started Crystal a week ago (to start 2020 well!). ⏎ ⏎ I’ve been looking some thing like Express (JS), Echo / Gin (Go) or Actix (Rust). I chose Kemal to add what I need as I go along. ⏎ ⏎ It’s an exploration. When everything is good (learning curve), go to the prod. ... [https://gitter.im/crystal-lang/crystal?at=5e1904e9b990d50d818fd33a]
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
<FromGitter> <jwoertink> Anyone know what Crystal's version of Javascript's `>>> (Zero-fill right shift)` bitwise operator would be?
<FromGitter> <tenebrousedge> `>>` I think?
<FromGitter> <jwoertink> That's what I thought too, but not quite
<FromGitter> <jwoertink> ```> -1 >>> 7 ⏎ 33554431 ⏎ > -1 >> 7 ⏎ -1``` [https://gitter.im/crystal-lang/crystal?at=5e1908a3b720fa5b3cf19ae0]
<FromGitter> <jwoertink> Crystals `>>` matches up with the JS `>>`, but I need the top one
<FromGitter> <tenebrousedge> `-1_i16 >> 7 #=> -1`
<FromGitter> <jwoertink> exactly.
<FromGitter> <jwoertink> Yeah, I don't see a way to do it
<FromGitter> <watzon> I've been there haha. Can't actually remember what I had to do.
<FromGitter> <watzon> Basically the `>>>` operator preserves the first bit, which is used to mark the number as positive or negative, whereas the `>>` operator will shift the bits regardless of the first bit's value
<FromGitter> <watzon> I remember finding somewhere how to do it in ruby, and then just made it work in Crystal. I can't remember what project that was for though, or if it was even one I ended up pushing.
<FromGitter> <jwoertink> Yeah, I'm digging through ruby forum stuff now
<FromGitter> <jwoertink> hoping to find something
<sorcus> `crystal eval "pp -1 >> 7 & (2**(32-7)-1)"` is it?
<sorcus> *found here.
<FromGitter> <jwoertink> oh wow. Good find. Let me try that out
<FromGitter> <watzon> That looks about right, good find!
<sorcus> Happy to help :-)
<FromGitter> <jwoertink> yup! That's what I needed. Thanks!
<sorcus> jwoertink: I'm happy that you happy.
<FromGitter> <jwoertink> I wonder if that should just be in crystal