<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> 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>
<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> 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> 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>
<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>
<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>
<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> 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> > 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> 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> 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
<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
<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 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>
<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> 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