ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<FromGitter> <mgarciaisaia> Hehe timezones
swav has quit [Ping timeout: 246 seconds]
dom96 has quit [Excess Flood]
swav has joined #crystal-lang
dom96 has joined #crystal-lang
<FromGitter> <crisward> 2am Here too... Really should go to bed.
<FromGitter> <codenoid> 08:39 time to work
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
maxpert has joined #crystal-lang
maxpert has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
RockyBalboa has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
RockyBalboa has quit [Read error: Connection reset by peer]
RockyBalboa has joined #crystal-lang
<RockyBalboa> Hello! I just wanted to congratulate you and to thank you for this amazing language. I am just starting, but I already love it. It's like Ruby 4.0. I am in love with overloading, the API is so clean, I like too that Crystal has all we need (from an HTTP server to ECR), and so. :)
<FromGitter> <mgarciaisaia> 💙
alex`` has quit [Quit: WeeChat 1.9]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <harindu95> Hey Guys! ⏎ I love Python and has never used Ruby before.(:D) But now that I looked at Nim and Crystal, Crystal feels more pythonic to me. What do you guys think about Nim ?
rohitpaulk has joined #crystal-lang
RockyBalboa has quit [Quit: Lost terminal]
<FromGitter> <elorest> I’ve played with nim(rod) and it’s definitely a cool project. It wasn’t as enjoyable to me as crystal though. Both are powerful but crystal is way more fun in my opinion.
<FromGitter> <CodelessFuture> @elorest Nim don't have nothing similari to Amber and no ORM, Template and so on. It lacks a l'argento number of libraries
<FromGitter> <CodelessFuture> *large sorry
<FromGitter> <elorest> @CodelessFuture Yeah. We’re all working to make crystal the best :)
claudiuinberlin has joined #crystal-lang
<FromGitter> <sdogruyol> Morning everyone
<FromGitter> <elorest> Morning :)
<FromGitter> <sdogruyol> @fridgerator now I am :)
<FromGitter> <elorest> @sdogruyol checkout the question I asked in kemal channal.
rohitpaulk has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 248 seconds]
Tuxified has joined #crystal-lang
Tuxified has quit [Client Quit]
<FromGitter> <alex-lairan> A company based at Paris recruiting Crystal developer?
<FromGitter> <alex-lairan> I know someone who seek a new job in Paris
<FromGitter> <sdogruyol> Answered @elorest :)
snsei has joined #crystal-lang
<FromGitter> <rumenzu> morning everyone
snsei has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest66504
<FromGitter> <rumenzu> I'd like to do some specific semantic analysis of a crystal program. To do so, I need to introspect the AST.
<FromGitter> <rumenzu> What do you think is the best approach? Rely on the macro system and hooks or write a custom Visitor that inherits the crystal compiler visitor
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<vegai> I don't get why everyone uses Jenkins
<vegai> buildbot predates it and is much superior
Guest66504 has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest63547
bmcginty has quit [Ping timeout: 248 seconds]
bmcginty has joined #crystal-lang
Guest63547 is now known as Ven``
ShalokShalom_ has joined #crystal-lang
ShalokShalom has quit [Ping timeout: 248 seconds]
<FromGitter> <miihael> hi! what can be the reason of the following error, when I try to build any program with crystal build --release: ```rystal: /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed. ⏎ /usr/bin/crystal: line 102: 15774
<FromGitter> ... Aborted "$INSTALL_DIR/embedded/bin/crystal" "$@"```
_whitelogger has joined #crystal-lang
<FromGitter> <krypton97> morning
<FromGitter> <krypton97> ✨
<FromGitter> <sdogruyol> Morning everyone
<FromGitter> <codenoid> good night from here ~
<FromGitter> <bararchy> We need the `"Lexical::Scope Error" => "use --no-debug"` as a template
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> or, you know, just fix the error
<FromGitter> <faustinoaq> > I love Python and has never used Ruby before ⏎ ⏎ @harindu95 Me too, I tried Nim, but I like Crystal more. Nim has a good community, but I don't like his syntax 😜
<FromGitter> <krypton97> I've took a look on nim. Is it c/c++/js under the hood?
<FromGitter> <krypton97> The syntax feels like a js mixed with some rust and c
<FromGitter> <krypton97> :)
<dom96> Nim compiles to C/C++/JS :)
<vegai> Nim used to have an interpreter, but I think that's gone now?
<vegai> by interpreter I mean a repl
<FromGitter> <faustinoaq> Hi dom! :-)
<dom96> vegai: It's still there but it's deprecated and hidden.
<dom96> Mainly because it's too limited
<dom96> faustinoaq: strange that you're coming from Python and like Crystal more :P
<Groogy> Liking something more than Python is easy ;D
<Groogy> j/k
<FromGitter> <faustinoaq> I know,well I have to do more things in Crystal and Nim, BTW, Thanks you for Nim in Action :)
<Groogy> I personally can't deal with prototype OO
<vegai> dom96: righto
<FromGitter> <sdogruyol> Same
<dom96> prototype OO? is that what it's called? :)
<Groogy> yeah doesn't Python go by the same model as JS and Lua?
<Groogy> or maybe I am confusing things
<dom96> Nope.
<dom96> Python does OO in the same way as Ruby AFAIK
<dom96> Nim diverges from that.
<dom96> I personally use very little OO
<Groogy> yeah I must be confusing things together
<FromGitter> <faustinoaq> dom96: Something I like in Nim is their fast compilation times, JS generation and small binaries, is quite useful to distribute programs.
<dom96> faustinoaq: cool, and what do you dislike? :)
<FromGitter> <sdogruyol> Yeah Nim has a good compiler
<FromGitter> <sdogruyol> I had a chance to meet with Andreas and he really seemed to know a lot about compilers :)
rohitpaulk has joined #crystal-lang
<dom96> oh, you met Andreas? Where?
<FromGitter> <sdogruyol> Oh it's been a long time
<FromGitter> <sdogruyol> At polyconf 16
<FromGitter> <sdogruyol> Was great
<dom96> oh cool.
<FromGitter> <sdogruyol> It's pleasure to have him around :)
<dom96> I was invited to talk at Polyconf 17 but couldn't make it.
<FromGitter> <sdogruyol> Hope to meet you too 👍
<FromGitter> <sdogruyol> Keep up the good work
<dom96> thanks, hope to meet you too :)
<Groogy> in a switch case, if I test type will the variable be that type in the when body or do I have to convert it myself with as()?
<FromGitter> <sdogruyol> I like polyconf it's a really good organization
<FromGitter> <sdogruyol> @Groogy you probably don't need to convert
<dom96> I wish they remained in Poznan, it's actually very close to my home town.
<FromGitter> <sdogruyol> Ain't it close to Germany
<dom96> yeah, quite close
<Groogy> I should take more days off from work to go to conferences like this :/
<FromGitter> <sdogruyol> @Groogy you should
<FromGitter> <sdogruyol> It's a great way of meeting great people
<FromGitter> <faustinoaq> > cool, and what do you dislike? :⁠) ⏎ ⏎ dom96: I don't know, I found Crystal first, I kept in love with blocks and I forgot Python for a while. When I found Nim, was too late. My brain didn't like Python syntax anymore :-)
<FromGitter> <faustinoaq> Crystal and Nim have great communities, I like how we talk peacefully .
<Groogy> @sdogruyol you have any conferances you recommend?
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <faustinoaq> @ysbaddaden Would be http2 ( merged with crystal core in the future?
<FromGitter> <bararchy> I really miss `String#eql?`
snsei has joined #crystal-lang
<oprypin> bararchy, why would you miss a silly alias for `==`
<FromGitter> <bararchy> because it looks ✨ ✨ BUETIFULLLLLLL ✨ ✨
<oprypin> if by BUE you mean the puking sound
snsei has quit [Ping timeout: 255 seconds]
ShalokShalom_ is now known as ShalokShalom
<Groogy> huh that's odd
<Groogy> for some reason pink becomes purple :/
<Groogy> it's odd
rohitpaulk has joined #crystal-lang
<FromGitter> <kyku> Hi, what can be wrong with the following code: ⏎ query_args = ⏎ ⏎ ``` end ⏎ end``` ⏎ ... []
<FromGitter> <kyku> It gives me an error about creating infinite tuple
<FromGitter> <kyku> on the other hand this works perfectly: ⏎ t = {1, 'a', 3.1415} ⏎ if rand(2) > 0 ⏎ t +="hello") ⏎ end ... []
<FromGitter> <faustinoaq> > <Groogy> ⏎ ⏎ So nice!
<Groogy> implementing the renderer abstraction right now, so when we get threads I can have a parallell thread that optimizes the draw calls for you
<Groogy> ;D
<Groogy> Is there something like std::swap in Crystal?
<Groogy> to just swap the value between two variables
chamar has joined #crystal-lang
<FromGitter> <kyku> x, y = y, x
<FromGitter> <kyku> ?
<Groogy> eh dang that will probably look too ugly with what I am doing
<FromGitter> <kyku> and what do you consider beautiful?
<Groogy> @pixels[index+1], @pixels[index+0] = @pixels[start + 0], @pixels[start + 1]
<Groogy> well std::swap(@pixels[index+0], @pixels[index+1]) would look pretty
<FromGitter> <kyku> how about writing a macro ?
<Groogy> also supposed to be start, not index
<Groogy> yeah will have to do that
<FromGitter> <krypton97> x = x * y ⏎ y = x/y ⏎ x = x/y
<FromGitter> <krypton97> what about this?
<FromGitter> <kyku> ```code paste, see link``` []
<Groogy> fack why do mac have to be special :/
<Groogy> how do I check for mac? flag?(:osx)
<Groogy> ?
<oprypin> kyku, creating += in a loop could create a tuple of any size, including an infinite one. the compiler refuses to accept such a possibility, because, after all, it needs to deduce all possible types that can come from an expression
<FromGitter> <kyku> @oprypin: but where's the loop ?
<oprypin> `Tuple(Int32) | Tuple(Int32, Int32) | Tuple(Int32, Int32, Int32) | Tuple(Int32, Int32, Int32, Int32)` ......
<oprypin> kyku, oh that... is the one-iteration loop but compiler doesnt deduce that
<oprypin> (not 100% sure)
<oprypin> please let me know if my guess was correct
<FromGitter> <kyku> looks like you are right, after taking those tuple concatenations out of the block , it almost compiles, but complains that it cannot splat a union type
<oprypin> hm well for that particular case there's no technical excuse to make that not possible
<RX14> really it can't splat a union?
<oprypin> splatting a union (Tuple(Int32) | Tuple(Int32, Int32)) is not yet supported
<oprypin> kyku, might have to do this lol
<FromGitter> <kyku> well now, it could theoretically switch on the union members and pick a matching one... guess this could produce a code bloat that a modern C++ compiler would be proud of
<oprypin> this sounds like a fun an easy enough bugfix
<FromGitter> <kyku> @oprypin : what I meant what that the compiler should be able to do your "if" automatically
<oprypin> kyku, sure, that's also what i meant with my previous messages
<FromGitter> <kyku> is the compiler guy here? ;-)
<oprypin> "the" compiler guy is almost never here anymore
<oprypin> by "here" i mean only this particular chat
<RX14> well crystal has pretty bloatworthy codegen already
<RX14> imagine multiple dispatch over 5+ overloads on 3+ arguments
<RX14> it gets nasty quick
<oprypin> no but this is simple
<RX14> yeah
<RX14> i'm just saying
<RX14> there's not like there's no precedent
<RX14> splatting a union is no worse than multiple dispatch in terms of codegen bloat
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <kyku> hmm... didn't even know that crystal supports multiple dispatch on method arguments
<RX14> yeah, just overload things and the method arguments will always end up in the right places
<RX14> one less thing to think about
rohitpaulk has joined #crystal-lang
<FromGitter> <kyku> seems interesting, must check it
<Groogy> there we go
<Groogy> FreeImage conforms to the OS format which for Linux & Windows is BGRA order it seems
DTZUZO has joined #crystal-lang
<FromGitter> <kyku> @RX14: seems the multiple dispatch works as you describe, amazing :-)
<RX14> it is somewhat my job to know how crystal works...
<FromGitter> <sdogruyol> :D
<vegai> RX14: oh, hey
<vegai> was wondering whether there's something about the BigDecimal PR that I should still do
<FromGitter> <sdogruyol> @vegai good job on that PR 👍
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has quit [Ping timeout: 240 seconds]
<vegai> sdogruyol: thank you :)
<Groogy> yay :D
<FromGitter> <sdogruyol> Imgur is blocked here
<FromGitter> <sdogruyol> ...
<Groogy> what similar service works in Turkey?
<FromGitter> <sdogruyol> Not sure
<FromGitter> <sdogruyol> Dropbox
<Groogy> pasteboard maybe?
<FromGitter> <sdogruyol> Wow
<FromGitter> <sdogruyol> Thank you
<FromGitter> <sdogruyol> It looks amazing
<Groogy> and as soon as support for parallelism comes I'll be improving the renderer to have draw calls be optimized in the background
<FromGitter> <sdogruyol> Can it be used for anything serious 😄
<Groogy> well any kind of 3D rendering? It's a framework
<Groogy> also kind of cool, I might be able to render an entire UI in one draw call
<Groogy> as long as it uses the same texture
DTZUZO has quit [Ping timeout: 260 seconds]
DTZUZU has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <krypton97> just found this nice go library that generates idiomatic code for db's needs
<FromGitter> <krypton97> is there something simillar in crystal?
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
<oprypin> generating code is not something that you should want to do, it's a workaround
randomCrystal125 has joined #crystal-lang
<randomCrystal125> does crystal have something similar to java streams?
<FromGitter> <sdogruyol> IO?
DTZUZO has joined #crystal-lang
<randomCrystal125> not IO, but i think the docs are better in explaining what i mean :D
<oprypin> randomCrystal125, looks like it's java's silly name for Iterator?
<randomCrystal125> might be, haven´t used higher languages in a while. basically what i want to do is use gets and in the same line use whatever i get from gets without having to store it to something
<randomCrystal125> x = gets.nil? ? 0 : x.to_i { raise x } was the most naive approach, wich to no surprise didn´t work. (instead of x = gets x = x.nil?.....)
<oprypin> randomCrystal125, seems unrelated?
rohitpaulk has quit [Ping timeout: 260 seconds]
<oprypin> x.not_nil!.do_something is one way
<randomCrystal125> not directly. because as far as i udnerstood i would have to pipe the output of gets to the rest of the line. wich in java would be a stream.
<Groogy> and now I support streaming data to the GPU ^^
<oprypin> randomCrystal125, how about we start from the beginning without involving analogies
<randomCrystal125> ok. i want some user input . then i want to check if it is a number, 0 it if it is nil and throw it if it is something else. now one way to do is to do x = gets. and then on a new line to the check/conversion.
<randomCrystal125> i want to be lazy and do that in one line
<oprypin> randomCrystal125, why do you insist on one line?
<randomCrystal125> for tinkering with the language/get to know it.
<randomCrystal125> no higher purpose than that. not possible is a totally valid answer
<oprypin> i think that `(gets || 0).to_i` will serve the purpose well
Tuxified has joined #crystal-lang
<randomCrystal125> oprypin then the compiler compains that .to_i doesn´t expect a block
<oprypin> randomCrystal125, and sure enough, it doesn't
<randomCrystal125> i did not assume the compiler to lie to me :)
<oprypin> randomCrystal125, sorry totally wrong link
hightower3 has joined #crystal-lang
<oprypin> so then something isn't right with your attempt
<randomCrystal125> yep...i am stupid, PEBKAC as usual
<randomCrystal125> thanks
randomCrystal125 has quit [Quit: Page closed]
hightower4 has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
Groogy has quit [Quit: WeeChat 1.9]
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <Porcupine96> Hello :) I'm new to crystal. I'm trying to write a simple crud app using Kemal and mongo bindings and I have a problem: ⏎ ⏎ I created a class called UserController where I have a route POST "/users". The controller takes a @domain_service as a parameter and I'd like to call @domain_service.create_user(email, password) (where email and password are taken from request's body). ⏎ ⏎ However, I'm
<FromGitter> <sdogruyol> That won't work @Porcupine96
<FromGitter> <sdogruyol> Kemal is not Rails
<FromGitter> <Porcupine96> Well I've no experience with rails anyways - I've JVM background. ⏎ ⏎ So in order to do something like this I'd need to use Amethyst instead of Kemal?
<FromGitter> <sdogruyol> No
<FromGitter> <sdogruyol> That's not the issue
<FromGitter> <luislavena> @Porcupine96 if you don't mind, I don't think the problem is Kemal != Rails, but the approach taken.
<FromGitter> <luislavena> You're trying to access an instance variable within a context that cannot be used. Kemal or other will fail. Perhaps the code can be changed so `domain_service` is initialized as part of the request itself, something like:
<FromGitter> <luislavena> ```code paste, see link``` []
<FromGitter> <luislavena> If there is too much repetition on `domain_service =`, it might be candidate to turn it into a macro:
<FromGitter> <luislavena> ```macro domain_service ⏎ %domain_service = ⏎ %domain_service ⏎ end``` []
<FromGitter> <luislavena> Or something like that.
<FromGitter> <Porcupine96> @luislavena Ok, I guess there's a big difference between how you write Java and Ruby-like code. Thank you for help. I'll try your approach or completely redesign my app.
<FromGitter> <harindu95> Hey can anyone tell me how to extract data from a union?
<FromGitter> <harindu95> eg:- names : Array(String) | String
<FromGitter> <harindu95> case names ⏎ when String ⏎ puts names ⏎ when Array(String) ⏎ ... []
<FromGitter> <harindu95> ????
<FromGitter> <sdogruyol>
<oprypin> harindu95, you wrote the answer yourself, then what do the question marks mean?
<FromGitter> <harindu95> because I get ⏎ undefined method 'each' for String (compile-time type is (Array(String) | String))
<oprypin> harindu95, it's because of something else that you're not telling us
<oprypin> harindu95,
<oprypin> or even this "cool" way
<oprypin> theeere we go
<FromGitter> <luislavena> @harindu95 the issue is the usage of instance variables within the if/case
<FromGitter> <harindu95> so it doesn't work with instance variables
<FromGitter> <luislavena> See second link shared by @oprypin
<FromGitter> <harindu95> is there a reason for this?
<FromGitter> <luislavena> @harindu95 the instance variable can be changed from another fiber/thread and the value you reading be the incorrect
<FromGitter> <luislavena> by assigning the value to a local variable, it will no longer matter if another fiber/thread changes the instance value, the method/block will have the expected context.
<FromGitter> <luislavena> All this is described in the above documentation
<oprypin> harindu95, maybe reconsider this implementation
<FromGitter> <luislavena> This applies to `case` too:
<oprypin> or to simply fix your example
<FromGitter> <harindu95> thanks
chamar has quit [Quit: Konversation terminated!]
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <faustinoaq> @Porcupine96 `MongoDB + Kemal` see :
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <Porcupine96> @faustinoaq thank you :) I'll definitely check it out
claudiuinberlin has quit [Quit: Textual IRC Client:]
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has quit [Ping timeout: 264 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]