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>
<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…]
<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>
kyku, oh that... String.build 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 String.build 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>
https://carc.in/#/r/2nir splatting a union (Tuple(Int32) | Tuple(Int32, Int32)) is not yet supported
<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 👍
<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>
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>
<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>
<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