RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.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> <simenge> anyone here familiar with the cltk parser generator library?
alex``` has quit [Ping timeout: 240 seconds]
akaiiro has quit [Ping timeout: 244 seconds]
ashirase has quit [Ping timeout: 256 seconds]
<FromGitter> <Timbus> @talbergs Crystal does not use concurrent threads, it uses cooperative threads. If you call 'sleep' in your thread it will Yield to another thread. In your case; the empty `while true` loop
<FromGitter> <Timbus> this essentially causes your program to hang. Instead of `while true ; end` try a long sleep.
phvse has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
akaiiro has joined #crystal-lang
beizhia has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
wontruefree has joined #crystal-lang
wontruefree has quit [Quit: bye]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 260 seconds]
DTZUZO has joined #crystal-lang
alex``` has joined #crystal-lang
beizhia has quit [Ping timeout: 264 seconds]
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 260 seconds]
DissonantGuile has joined #crystal-lang
<DissonantGuile> Hey, any way to bind Crystal from C? Is in calling a Crystal method from a C program
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6379: Parser: don't use invalid internal names for arguments like `@select` or `@@select` (master...bug/5997-invalid-internal-names) https://git.io/fNqah
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <drum445> possible to see what vars a class has via macros before initializing it?
<travis-ci> crystal-lang/crystal#e110660 (master - Parser: don't use invalid internal names for arguments like `@select` or `@@select` (#6379)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/403853344
<DeBot> https://github.com/crystal-lang/crystal/pull/6379 (Parser: don't use invalid internal names for arguments like `@select` or `@@select`)
<FromGitter> <bararchy> @Timbus its Fibers not Threads, crystal always runs on a single thread.
<FromGitter> <bararchy> DissonantGuile there is a POC, but its not really standard
<FromGitter> <Timbus> Er, yes, I guess I should have called it a fiber.
<FromGitter> <Timbus> my b
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <drum445> This variables must be explicitly nillable is killing me lol
<crystal-gh> [crystal] RX14 closed pull request #6377: http: support serving wasm by StaticFileHandler (master...feat/support-wasm-static-file-handler) https://git.io/fNqmf
<FromGitter> <codenoid> hi, how to get client ip address without nginx in kemal
<FromGitter> <j8r> I don't figure out to use `#dup` with `JSON::PullParser`: https://carc.in/#/r/4igg
<oprypin> maybe it doesnt work, maybe clone works or maybe it doesnt work either
<oprypin> yeah there's no way
<oprypin> it creates a Lexer inside and #dup copies the reference to the same lexer
<oprypin> you consume it once and cant do it again
<oprypin> #dup or #clone are not defined
<FromGitter> <j8r> I will recreate the object so
<FromGitter> <codenoid> idk why, but my kemal/crystal app always get error , `Exception: getcwd: No such file or directory (Errno)`
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b49dd571c0f906b14521e23]
<FromGitter> <codenoid> it's make all request to static file 404
alex``` has quit [Ping timeout: 260 seconds]
alex``` has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6380: Fix compilation with LLVM 6.0.1 (master...llvm-6.0-support) https://git.io/fNq1u
alex``` has quit [Ping timeout: 260 seconds]
<FromGitter> <drum445> What a roller coaster lol
<travis-ci> crystal-lang/crystal#249a2ed (master - Fix compilation with LLVM 6.0 (#6380)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/403889795
<DeBot> https://github.com/crystal-lang/crystal/pull/6380 (Fix compilation with LLVM 6.0.1)
<crystal-gh> [crystal] felixbuenemann opened pull request #6383: Fix version check for LLVM < 6.0 (master...llvm-6.0-support) https://git.io/fNmVI
<FromGitter> <asterite> Instead of a long sleep, you can just sleep without arguments
<FromGitter> <asterite> (maybe sounds like a haiku, but it's in reference to something you were discussing above)
TCZ has joined #crystal-lang
alex``` has joined #crystal-lang
TCZ has quit [Quit: Leaving]
<FromGitter> <talbergs> @Timbus as you suggested, by adding a second of sleep in the last `while true` all worked, thanks! I did know that there is only cocurrency on single thread, but I did not think that an empty `while true`will not ever allow a gap for other Fibers to continu work. Meaning, two concurrent empty `while true` loops would not interchange execution between em.
<FromGitter> <talbergs> @asterite thanks, nice to know - by replacing my ```while true ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5b4a0b84b5efcd5aeefc963f]
<FromGitter> <talbergs> interesting thou how.
<crystal-gh> [crystal] faustinoaq opened pull request #6384: Fix reference links to .from_io methods (master...patch-1) https://git.io/fNmoA
<FromGitter> <talbergs> its a `sleep forever` - got it. :)
Raimondi has quit [Read error: Connection reset by peer]
Raimondii has joined #crystal-lang
<FromGitter> <talbergs> @codenoid did you solve your issue?
Raimondii is now known as Raimondi
<crystal-gh> [crystal] faustinoaq closed pull request #6384: Fix reference links to .from_io methods (master...patch-1) https://git.io/fNmoA
alex``` has quit [Ping timeout: 276 seconds]
snsei has quit [Ping timeout: 265 seconds]
<crystal-gh> [crystal] felixbuenemann opened pull request #6385: [WIP] Implement ruby-style Enumerator (master...enumerator) https://git.io/fNmit
snsei has joined #crystal-lang
alex``` has joined #crystal-lang
<FromGitter> <codenoid> not yet
rohitpaulk has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <vladfaust> Has the team considered using https://github.com/discourse/discourse as a better communicating platform?
alex``` has quit [Ping timeout: 276 seconds]
<FromGitter> <simenge> gonne repeat my question from earlier: anyone here familiar with the cltk parser generator library?
<FromGitter> <simenge> or know of a better alternative
<FromGitter> <simenge> I'm having a hell of a time getting something as simple as a space separated list getting working
<FromGitter> <jwoertink> Sorry, I've never heard of that.
<FromGitter> <simenge> what is the go-to parser lib for crystal
<FromGitter> <simenge> I need to parse a complex grammar
<FromGitter> <jwoertink> Isn't there a built in one?
<FromGitter> <simenge> is there? I know the compiler team has one
<FromGitter> <simenge> not sure how suitable it is for general use, or how well documented
<FromGitter> <jwoertink> hmm.. Yeah, looking at it, it might be too specific to crystal
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter> <simenge> having operator precedence as a builtin would be great
<FromGitter> <simenge> cltk has that, but it has other issues
<FromGitter> <Daniel-Worrall> is it better to do compile time array.each or tuple.each on the same content
<FromGitter> <Daniel-Worrall> I was thinking tuple
<FromGitter> <jwoertink> Maybe this could help? https://github.com/ziprandom/cltk
<FromGitter> <simenge> @jwoertink yeah that is a handwritten crystal specific one it looks like
<FromGitter> <simenge> that's the one I'm using rn, and like I said, having some issues
<DissonantGuile> Here you go: https://github.com/pawandubey/pegasus
<FromGitter> <jwoertink> It sounds like this might be an area that needs some love
<DissonantGuile> IT has the benefit of having a cool name
<FromGitter> <jwoertink> Can someone explain what this error means? `Proc(HTTP::Server::Context, Nil) is not a generic type, it's a function`
<FromGitter> <simenge> I always struggle when I need to implement operator precedence for a large number of operators
<FromGitter> <simenge> doing it manually is kind of a bitch
<FromGitter> <simenge> otherwise peg parsing is cool
<DissonantGuile> I prefer PEG for sure
<DissonantGuile> Outside of those two, I can't think of anything
<FromGitter> <simenge> thanks for the input anyway
<FromGitter> <simenge> I'll keep plugging away at it
alex``` has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Using https://github.com/crystal-lang/html_builder/ ⏎ Trying to have a non breaking space in my html `&nbsp;`, but the ampersand is escaped and it becomes `&amp;nbsp;`
<FromGitter> <Daniel-Worrall> and there's no code replacement for the nbsp
<FromGitter> <Daniel-Worrall> since it uses crystal HTML#escape
<FromGitter> <Daniel-Worrall> looks like a bug to me
<FromGitter> <Daniel-Worrall> That's unescaping it
<FromGitter> <Daniel-Worrall> There's no encoding of empty spaces to that code point
<FromGitter> <Daniel-Worrall> so I can't build any html that includes a nbsp
<DissonantGuile> It seems the problem is being solved
<FromGitter> <Daniel-Worrall> Nope, if I use `\u{0000A0}`, it is just a space
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/4ikk
<FromGitter> <Daniel-Worrall> It shouldn't be escaped at all
rohitpaulk has quit [Ping timeout: 244 seconds]
<DissonantGuile> Reasoning is in the conversation of that pull
<FromGitter> <Daniel-Worrall> Well then perhaps the issue lies in the builder in that I don't have a way to use it
<DissonantGuile> Yeah I don't agree with that change, but it makes sense
<FromGitter> <Daniel-Worrall> Eh, I agree
<FromGitter> <Daniel-Worrall> but the way the builder works is that it will always escape any text you give it
<FromGitter> <Daniel-Worrall> unless you use the html method which cannot be used inside as a parameter
<FromGitter> <Daniel-Worrall> so I'm probably going to have to html the entire thing
<FromGitter> <Daniel-Worrall> actually, I was able to do it okay
<FromGitter> <Daniel-Worrall> Yeah, I'm the dummy here
<DissonantGuile> The #html method does exactly the same as the #text function, only without escaping. Maybe you could preparse your test
<FromGitter> <Daniel-Worrall> this was my original code ⏎ `thead { tr { {"Base", "&nbsp;", "Mod"}.each { |string| th{ text string } } } }`
<DissonantGuile> Er pre..processes *text
<FromGitter> <Daniel-Worrall> so I tried to do `html("&nbsp;")` like a dummy
<DissonantGuile> Ah
<FromGitter> <Daniel-Worrall> I have it working with ⏎ `thead { tr { {"Base", "&nbsp;", "Mod"}.each { |string| th{ html string } } } }`
<FromGitter> <Daniel-Worrall> Apologies for the time wasting
<DissonantGuile> Please, time wasting is my personal pastime
<FromGitter> <talbergs> could we improve `spawn` macro, so it accepts block? ⏎ f.e. this may not be written `spawn poll 1.seconds, "./conf.json", &->set_conf` if the `poll` method accepts mandatory block.
<FromGitter> <bew> @talbergs good idea, you can make a pr if you want ;)
<FromGitter> <j8r> I've just done an alternative to JSON::Any, the draft is here https://gist.github.com/j8r/07737bc34cfc4a53e0ddf3051b47f8f4
<FromGitter> <talbergs> or if I can :D I'm really new with crystal. But I may give it a try ;)
<FromGitter> <j8r> The main advantage is to have a dynamic path
<FromGitter> <bew> @j8r that's interesting!
<FromGitter> <soanvig> Hi there. I'm super new to Crystal, but experienced in programming and have nice knowledge about Ruby. ⏎ ⏎ Do You know any IDE/Editor which has nice Crystal support. For everyday work I use VS Code, and there is plugin, but it doesn't help much during writing.
<FromGitter> <j8r> So you can ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b4a549b1c0f906b14531cc1]
<FromGitter> <talbergs> Does that plugn provides linting for you?
<FromGitter> <soanvig> @talbergs not really
<FromGitter> <talbergs> I tried IntelliJ plugin that barely gave some syntax highlight and that's t
<FromGitter> <soanvig> It does however precompile file on save so I get errors on fly.
<FromGitter> <talbergs> Now I use neovim it gives decent linting and some completion
<FromGitter> <soanvig> And has nice syntax highliting. I'm however used to advanced autocompletion rules, and I would like to have some in Crystal, esp I'm new.
<FromGitter> <j8r> you can use VSCode, or Atom
<FromGitter> <j8r> look at https://github.com/crystal-lang-tools/scry , and its channel on gitter
<FromGitter> <talbergs> nice
<FromGitter> <soanvig> I'm using VSCode with plugin of author of one of contributors to Scry, so I belive it's using it.
<FromGitter> <bew> No it's not
<FromGitter> <bew> Scry is experimental and needs to be manually enabled
<FromGitter> <soanvig> Oh
<FromGitter> <soanvig> Gonna check, thanks
<FromGitter> <bew> It's in the wiki iirc
<FromGitter> <bew> Welcome to Crystal btw ;)
<FromGitter> <bew> Also, completion in Crystal is almost at birth stage, don't expect it to work well everywhere
<FromGitter> <soanvig> This is first time I use language which is kinda "new", and lacks support.
<FromGitter> <soanvig> Oh my, I cloned it, and it even cannot compile, because of ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b4a577866c1e833a9e8b6e3]
<FromGitter> <soanvig> Not my best day :)
<FromGitter> <soanvig> Gonna download release
<FromGitter> <bew> Oh right, latest Crystal version is not merged yet, there's a branch that works though
<FromGitter> <soanvig> Nvm, downloaded release.
<FromGitter> <bew> Ok, as you like
<FromGitter> <soanvig> I see you are contributor!
<FromGitter> <bew> Yeah, kindof, I mostly review PRs for Scry atm :)
akaiiro has joined #crystal-lang
<FromGitter> <soanvig> How one enable LSP in VSC? I'm searching through docs but with no success
<FromGitter> <Daniel-Worrall> Use the scry plugin
<FromGitter> <Daniel-Worrall> It's listed as Crystal IDE
<FromGitter> <soanvig> Thanks
akaiiro has quit [Ping timeout: 260 seconds]
<FromGitter> <talbergs> https://gist.github.com/talbergs/c7c5c5b7dd56552363350358f5ba23a2 ⏎ ⏎ spawned Fiber would not update the variable `app_conf` via call to `update_conf`. ⏎ This means I gotta use channels? Or is there some other bug? [https://gitter.im/crystal-lang/crystal?at=5b4a6397641ecc065fa37f88]
<FromGitter> <soanvig> @Daniel-Worrall apparently it's not working. I've provided script with correct path to binary, but any suggestion is not working. I tried to replicate that: ⏎ https://user-images.githubusercontent.com/6118156/37081344-05edea4e-21e1-11e8-8914-d767f8125aad.gif
<FromGitter> <Daniel-Worrall> Assuming Linux
<FromGitter> <Daniel-Worrall> If it's working, you'll see a red/green blob next to the files
<FromGitter> <Daniel-Worrall> which is the live code analysing of whether the code is valid
<FromGitter> <soanvig> Oh, wait a sec
<FromGitter> <Daniel-Worrall> I haven't been able to replicate that gif though
<FromGitter> <soanvig> This may be a reason
<FromGitter> <Daniel-Worrall> ah
<FromGitter> <Daniel-Worrall> you'll notice when it's on though
<FromGitter> <Daniel-Worrall> It'll analyse when the file is open
<FromGitter> <Daniel-Worrall> the rest of command is the path to the scry binary
<FromGitter> <Daniel-Worrall> Both the 2.4 and 2.5 binary work
<FromGitter> <soanvig> 1) 4 and 2.5 binary? Scry has only 0.7.1
<FromGitter> <soanvig> Or you mean Crystal :P
DissonantGuile has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<FromGitter> <Daniel-Worrall> Crystal
<FromGitter> <Daniel-Worrall> master and the 2.5 branch
<FromGitter> <soanvig> I believe the newest scry is bugged, I will try with another version.
<FromGitter> <soanvig> Thanks for help, I go to sleep, bye L)
<FromGitter> <Daniel-Worrall> I've used the newest scry just last week
<FromGitter> <jwoertink> I have this class that includes `HTTP::Handler`, and I want to set the type of a property to `Proc`, but I just learned that HTTP::Handler adds an alias to Proc https://github.com/crystal-lang/crystal/blob/b782738fffb1b9fba98f7aa44f9da11c3da259a1/src/http/server/handler.cr#L32
<FromGitter> <jwoertink> so I end up getting this weird error
<FromGitter> <jwoertink> Anyone know why it aliases Proc here?
<FromGitter> <jwoertink> or how I can use the original Proc?
<FromGitter> <jwoertink> oh, actually, looks like if I just use `::Proc` I'll be ok
<FromGitter> <jwoertink> but that's weird though, right?
moei has quit [Quit: Leaving...]
<FromGitter> <sam0x17> is there like an on_extended block I can define that executes when a class is extended? I know there is something like that but can't find it
<FromGitter> <jwoertink> You mean inherited? `class Something < Parent`
<FromGitter> <bew> @jwoertink yes it looks really weird, maybe a leftover from old times? That alias should be renamed, the programmer reading the code would benefit from that i think!
<FromGitter> <jwoertink> Or with a module?
<FromGitter> <jwoertink> `class Something; extend Thing`
<FromGitter> <jwoertink> Thanks @bew, I'll submit an issue. I actually just crashed the compiler with it, so gotta try to submit anyway
<FromGitter> <bew> @sam0x17 you're talking about the macro hook `inherited`?
<FromGitter> <jwoertink> yeah that thing ^ `macro inherited`
<FromGitter> <talbergs> @jwoertink could you glance at the gist I pasted above, there must be something obvious for mature eye
<FromGitter> <jwoertink> sure. Let me read what's up
<FromGitter> <jwoertink> @talbergs Is that all of your code, or just abstracted bits out? It seems like you're playing with scopes a bit there. Have you tried making `app_conf` an instance variable?
<FromGitter> <talbergs> Yes, that's all the code.
<FromGitter> <talbergs> Not using class or modules there
<FromGitter> <talbergs> The idea there was to spawn a file watcher that updates config object (line 18) on file change, and web server just serves current config object. It seems there has been made a copy and I have scoping problems there.
<FromGitter> <jwoertink> Yeah, in that method, I think the `app_conf` just becomes a local variable only available inside the method. I didn't run anything to test, so I could be wrong about that
<FromGitter> <jwoertink> That's just my guess. I was thinking maybe if it was an instance variable instead, then maybe it would scope outside the method? `@app_conf = get_conf`
akaiiro has joined #crystal-lang
<FromGitter> <talbergs> jeez that must be it! Letme try
<FromGitter> <talbergs> Then linter complains like so: "can't use instance variables at top level"
<FromGitter> <talbergs> @jwoertink ``` ⏎ loc = "3" ⏎ def d ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b4a7e10b5efcd5aeefd7961]
akaiiro has quit [Ping timeout: 268 seconds]
<FromGitter> <talbergs> "Can't infere the type of instance var.." ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ How so? [https://gitter.im/crystal-lang/crystal?at=5b4a824db5efcd5aeefd8045]
moei has joined #crystal-lang
<FromGitter> <Timbus> It only works if the type comes from a class method, not an instance method
<FromGitter> <Timbus> There's a list of rules in the gitbook. My guess would be that, if strm was overridden things would go bad