ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
ua has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <00dani> I've also tried building from source now. No dice. :|
<FromGitter> <00dani> Hmm, just tried `crystal play` and that seems to work, oddly enough. Hmm.
<oprypin> 00dani, low on RAM? maybe ~/.cache/crystal went bad? (if that's even the cache path, i don't remember)
<oprypin> show the stack trace
<FromGitter> <00dani> Yeah, that is the cache path. But it looks like the problem was actually with my project, somehow? I'm guessing I installed an incompatible combo of shards or something, since I'm experimenting with Amber and different ORMS. Crystal is working just fine anywhere *except* that project. Here's the trace anyway: https://gist.github.com/c395d23389c5138c86a751de656eb137
<FromGitter> <00dani> Figured out what was happening: I had an infinite recursion in one of my Slang templates because the Amber docs say to use `render "partialname"` for a partial but should say `render partial: "partialname"`.
<FromGitter> <00dani> It's surprisingly difficult to discern what's happened when you have an infinite macro expansion.
sherjilozair has quit [Quit: Leaving...]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <Grabli66> Hi! How to catch exceptions, that was raised in fibers?
rohitpaulk has joined #crystal-lang
<oprypin> Grabli66, you must catch exceptions inside the fiber
<oprypin> you can then send them through a channel if you really want to, and re-throw
<FromGitter> <Grabli66> Can i do something like this? https://play.crystal-lang.org/#/r/43s9 ?
<FromGitter> <Grabli66> Or it's bad?
hightower6 has joined #crystal-lang
<hightower6> oprypin, hey, I was thinking about your comment from the other day that macros are never associated with an object, so one can't call obj.some_macro. While that's OK, it is strange that inside a def that works -- one *can* call a macro as if seemingly it was on an instance... E.g. https://play.crystal-lang.org/#/r/43sk
sz0 has quit [Quit: Connection closed for inactivity]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii is now known as Raimondi
<FromGitter> <Flipez> Hi guys, I'd like to initialize a property later in the code and cannot assign it on startup since I miss some params. I am used to do this in Ruby but how am I supposed to do this in crystal? I bet there must be a way? :D ⏎ https://play.crystal-lang.org/#/r/43sw
<FromGitter> <epergo> you can add a `?` when declaring the property
<FromGitter> <epergo> that means it can be nil
<FromGitter> <epergo> you could write it this way too `property me : Battlesnake::Snake | Nil` which is more explicit
<FromGitter> <Flipez> Ah that's what I was looking for. Thank you!
OvermindDL1 has quit [Quit: Connection closed for inactivity]
<FromGitter> <epergo> πŸ‘
<FromGitter> <Flipez> I like how crystal handle the type safety but this is still a bit confusing if you grow up with ruby though πŸ˜…
<FromGitter> <bararchy> @Flipez Yeha as a Ruby dev it takes some time to get used too
<FromGitter> <manveru> anyone using `anykeyh/clear` here? I'm wondering how I'd express `Post.query.with_user.find(12)`...
<FromGitter> <manveru> also `file.project ? file.project.name : ""` fails with `undefined method 'name' for Nil (compile-time type is (Project | Nil))`, i don't quite understand why
<FromGitter> <manveru> `project = file.project; project_name = project ? project.name : ""` seems to work though
<FromGitter> <yxhuvud> @Flipez it is also possible to initialize a variable as `uninitialized` but that is not type safe and should be avoided if possible.
<FromGitter> <yxhuvud> @manveru the compiler is not smart enough to know that the value of file.project doesn't change between your calls.
<FromGitter> <yxhuvud> (I'm not certain it *could* be that smart, in the general case)
<FromGitter> <manveru> ok
emilsp has quit [Quit: cya]
<FromGitter> <manveru> also seems like clear craps out when i do some benchmarking... doesn't look like it's using a connection pool and runs out of fds
emilsp has joined #crystal-lang
hightower6 has quit [Quit: Leaving]
<FromGitter> <bararchy> Is there a way to find a string inside antoerh string without using Regex?
<FromGitter> <epergo> you can use `includes?`
<FromGitter> <epergo> https://crystal-lang.org/api/0.24.2/String.html#includes%3F%28search%3AChar%7CString%29-instance-method
<FromGitter> <epergo> or `index(search : String, offset = 0) `
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
duane has joined #crystal-lang
<FromGitter> <bararchy> It seems includes? and index wont find the string
<FromGitter> <bararchy> it really is annoying
<FromGitter> <bararchy> it is there, vim search finds it, sublime search finds it
<FromGitter> <bararchy> It's a little problomatic string in the case that it has special chars
rohitpaulk has quit [Ping timeout: 264 seconds]
duane has quit [Ping timeout: 245 seconds]
<FromGitter> <faustinoaq> Hey, I just read Why Django Sucks? (https://speakerdeck.com/kennethreitz/flasky-goodness) and I realize Amber Minimal is not that bad (https://amberframework.gitbook.io/amber/examples/minimal-configuration) and works pretty nice :-P ⏎ ⏎ (https://i.imgur.com/KcemWdv.gif "OMG Amber Minimal is very nice! :-D") (https://amberframework.gitbook.io/amber/examples/minimal-configuration)
That_Guy_Anon has joined #crystal-lang
duane has joined #crystal-lang
<FromGitter> <fridgerator> Django does suck
<FromGitter> <bararchy> @faustinoaq you need to publish this gif as a tutorial :)
<FromGitter> <Grabli66> Crystal is awesome, but not so popular as python and django. And lack of good IDE, and parallelism, and so on :)
<That_Guy_Anon> i feel like the biggest thing simply is parallelism and windows, not sure if a IDE is that needed, the vscode plugin is really nice and probably enough for most
<wmoxam> Is windows support really a big deal?
<That_Guy_Anon> yeah
<wmoxam> What sort of programs do people want to use Crystal for to run on windows?
<That_Guy_Anon> many devs i know still use windows
<wmoxam> Most dev I see Crystal being used for is server oriented
<wmoxam> and most Windows oriented folks I know want to use a MS stack for that
<wmoxam> (and I don't blame them for it)
<That_Guy_Anon> hm, i think more about the barrier of entry, but yeah, might be scewed perspective :D
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Windows because you want to be able to run your clients, GUI, games, utils, etc.. In Windows
<oprypin> hightower2, in your example it's just "a macro available inside objects of this type", still no instances are involved
<FromGitter> <faustinoaq> I use Windows and Visual Studio with C# & .Net in my daily basics at university and work πŸ˜…
<FromGitter> <faustinoaq> C# and Visual Basic are not that bad 😜
<FromGitter> <faustinoaq> > you need to publish this gif as a tutorial :) ⏎ ⏎ @bararchy Oh, yeah! With the new GitBook UI is very pleasant and easy πŸŽ‰ https://amberframework.gitbook.io/amber
<FromGitter> <faustinoaq> I just need some time, though
<FromGitter> <faustinoaq> > Django does suck ⏎ ⏎ @fridgerator Well, I still use Django on some client projects and isn't that bad, just a different approach πŸ˜…
<FromGitter> <faustinoaq> @Grabli66 For me the most important is Windows support, parallelism and stability πŸ˜‰
<FromGitter> <faustinoaq> > What sort of programs do people want to use Crystal for to run on windows? ⏎ ⏎ wmoxam, Would be very nice to create a GUI using QT5.cr (https://github.com/Papierkorb/qt5.cr) and deploy it to a windows machine πŸ˜‰
<That_Guy_Anon> stability in the sense of stable API (?) or in the sense of stable programs
<FromGitter> <faustinoaq> That_Guy_Anon both
<FromGitter> <faustinoaq> Stable for me, means a LTS (Long Term Support) release with no more breaking-changes and critical bug fixes
<That_Guy_Anon> i still haven't really gotten into crystal, like ive red docu, did tutorials but am still missing a project that gets me hooked
<FromGitter> <faustinoaq> Have you tried https://github.com/veelenga/awesome-crystal ? πŸ˜‰
<FromGitter> <faustinoaq> > <That_Guy_Anon> many devs i know still use windows ⏎ ⏎ In fact most devs use Windows XD ⏎ ⏎ https://twitter.com/wycats/status/973761496277704704 [https://gitter.im/crystal-lang/crystal?at=5b02d67a5666c42eb62acc39]
<FromGitter> <faustinoaq> > Is windows support really a big deal? ⏎ ⏎ <wmoxam> Yes, I big one
<That_Guy_Anon> faustinoaq well that only means my perception isn't wrong :D
<That_Guy_Anon> i mean even i use windows from time to time if i have to use CodeSys or smth
<FromGitter> <faustinoaq> > Most dev I see Crystal being used for is server oriented ⏎ ⏎ <wmoxam> I still use Windows Server at work πŸ˜…
<FromGitter> <faustinoaq> My boss loves Windows XD
<That_Guy_Anon> tbh i don't dislike windows per se either, i dislike where they are taking it
<FromGitter> <faustinoaq> > and most Windows oriented folks I know want to use a MS stack for that ⏎ ⏎ <wmoxam> Well, that's true, At work I only use .Net, nothing more. I tried to introduce crystal & amber but it doesn't work on windows yet, so I'll try once crystal support on Windows, (2019-2020 I guess πŸ˜… )
<FromGitter> <faustinoaq> > tbh i don't dislike windows per se either, i dislike where they are taking it ⏎ ⏎ <That_Guy_Anon> Well, The new Open Souce approach at Microsoft feel very nice, the new VSCode and Net Core are very awesome projects, well received by the community πŸ˜„
<That_Guy_Anon> they are, but windows core is still unaffected by this, and for example the VSCode license does have a few ouchie points
<That_Guy_Anon> i mean i even like many things about windows 10, and will probably be dualbooting for quite some years to come
<FromGitter> <faustinoaq> > Crystal is awesome, but not so popular as python and django. And lack of good IDE, and parallelism, and so on :) ⏎ ⏎ @Grabli66 I'm working on Intellij-Idea support, see: https://github.com/crystal-lang-tools/intellij-crystal-lang/issues/2#issuecomment-386788005 ⏎ ⏎ Also see: https://github.com/crystal-lang-tools/scry [https://gitter.im/crystal-lang/crystal?at=5b02d8c3e0b50c2d05dd2cf6]
<FromGitter> <faustinoaq> I already implemented basic rename and working on code-actions feature I'll publish them soon πŸ˜‰
<FromGitter> <Grabli66> @faustinoaq , i use vscode, crystal plugin and scry. Not so bad :). Need to try intellij idea
<FromGitter> <Flipez> If I am working on a variable that either can be nil or a class, how do I avoid the compile-time 'undefined method for nil' error? Checking if the variable is nil does not seem to do the trick
<FromGitter> <faustinoaq> <That_Guy_Anon> I do dual booting with W10 and Manjaro Linux and works pretty nice πŸ˜„
<FromGitter> <faustinoaq> Manjaro even have a guide for that, see: https://manjaro.github.io/homepage/public/support/userguide/
<That_Guy_Anon> i have had issues with dualbooting in the pas but solus /win10 works really well so far
<FromGitter> <faustinoaq> πŸ‘
<FromGitter> <faustinoaq> > Need to try intellij idea ⏎ ⏎ @Grabli66 Not yet, I still need to publish some bugfixes on Scry protocol πŸ˜…
<FromGitter> <faustinoaq> @Flipez You can use `if my_var = var` (recommended) or `.try` (alternative) or `.not_nil!` (not recommended)
<FromGitter> <S-YOU> @Flipez checking does not change the type of variable, you need to assign to another variable
<FromGitter> <faustinoaq> `.not_nil!` just creates a Nil Assertion Error very similar to Undefined method for nil on Ruby, JavaScript and Java, etc
<FromGitter> <faustinoaq> Checking nil is a crystal feature like Scala, Kotlin or Rust πŸ˜‰
<FromGitter> <Flipez> I see, thanks guys :)
<FromGitter> <Flipez> Feels a bit like a overhead reassigning those every time 😟
<FromGitter> <S-YOU> LLVM compiles down to SSA, which reassign to new variable for every step, and it is very good for optimizations.
<FromGitter> <faustinoaq> Also Nim have nil checks :-)
<FromGitter> <faustinoaq> @S-YOU πŸ‘
rohitpaulk has quit [Ping timeout: 245 seconds]
OvermindDL1 has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
sz0 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <fuegito> Hi. Is there a specific reason why there is no method to get the remote IP from a HTTP::Request? Am I missing something?
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <fuegito> I know the workaround with adding a http-header by a reverse-proxy. The discussions on github/crystal-lang did not make me smarter...
<FromGitter> <vladfaust> WDYT on where to place stlib extensions in shards? E.g. add `Int#my_method`. Should I place it in `shard/src/ext/int/my_method.cr` or `shard/src/shard/ext/int/my_method.cr`?
rohitpaulk has joined #crystal-lang
<FromGitter> <manveru> @fuegito strange indeed, got a link to the discussion? because https://crystal-lang.org/api/0.24.2/IPSocket.html#remote_address-instance-method is definitely an option
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
<FromGitter> <fuegito> It was discussed in an issue in 2015. There has been a PR adding it as a property in 2016 I think. I'll look if I find the links. I just wonder why there is almost no "noise" around this issue...i mean getting the IP from the connecting socket in a HTTP context is not really an exotic use case...
snsei has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
Ven`` has joined #crystal-lang
snsei has quit [Ping timeout: 260 seconds]
Ven` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
rohitpaulk has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 245 seconds]
sherjilozair has joined #crystal-lang
rcvalle has joined #crystal-lang
Ven` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
sherjilozair has quit [Quit: Leaving...]
greengriminal has joined #crystal-lang
duane has quit [Ping timeout: 245 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 245 seconds]
That_Guy_Anon1 has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 245 seconds]
That_Guy_Anon has joined #crystal-lang
That_Guy_Anon1 has quit [Ping timeout: 252 seconds]
Jenz has joined #crystal-lang
<Jenz> Evening
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wontruefree has joined #crystal-lang
snsei has joined #crystal-lang
greengriminal has joined #crystal-lang
snsei has quit [Ping timeout: 260 seconds]
<FromGitter> <faustinoaq> (https://files.gitter.im/amberframework/amber/yQG2/vokoscreen-2018-05-21_15-56-14.gif) ⏎ ⏎ Crystal GC works!!! πŸ˜„
<Jenz> Which GC?
<FromGitter> <faustinoaq> I mean Boehm–Demers–Weiser garbage collector πŸ˜…
<FromGitter> <faustinoaq> This is used by default in Crystal πŸ‘
<FromGitter> <faustinoaq> ^^ http://www.hboehm.info/gc/
<Jenz> Oh, haven't it always worked?
<Jenz> :smile:
wontruefree has quit [Quit: bye]
<Jenz> Im more impressed by you setting up a systemd service for running an amber server (im a web-dev noob)
<FromGitter> <faustinoaq> Yep, I was worried it didn't work, because the memory usage was just growing and growing without freeing. Now I know Crystal GC works very nice πŸ˜„
wontruefree has joined #crystal-lang
<FromGitter> <faustinoaq> BDWGC doesn't recollect as frequently as I want but does the work! πŸ‘
<Jenz> Yeah, I remember seing some interesting talk about the boehm tackling data-intensive situations
<FromGitter> <faustinoaq> Jenz, Is a very nice and simple systemd service setup, see: https://github.com/amberframework/amberframework.org#systemd-service
<Jenz> Very nice
Jenz has left #crystal-lang ["'gtg'"]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 260 seconds]
<oprypin> faustinoaq, lol dont run things as root
<FromGitter> <faustinoaq> oprypin, Yeah, I just notice that πŸ˜… , do you have any idea how to run a process on port 80 without root?
<oprypin> let nginx handle it
<FromGitter> <faustinoaq> Oh, I did a quick search, I can use `iptables` for that πŸ˜…
<oprypin> faustinoaq, it's possible that the code needs special handling for systemd sockets, just that gitea happens to have it maybe
<FromGitter> <faustinoaq> `sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080` did the trick πŸ˜„
<oprypin> meh
<FromGitter> <faustinoaq> oprypin, Oh, you solution is better because it works when droplet is restarted πŸ‘
<FromGitter> <faustinoaq> Thank you! πŸ˜„
wontruefree has quit [Quit: bye]
<FromGitter> <faustinoaq> oprypin The socket thing didn't work πŸ˜…
<FromGitter> <faustinoaq> So, I'm using a iptables service now πŸŽ‰
snsei has joined #crystal-lang
<FromGitter> <bew> iptable service? How did you do it? (kinda know how to theorically, just want to know your version)
snsei has quit [Ping timeout: 260 seconds]