ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.0 | 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
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <sam0x17> is there a way I can use Process.run with a shell script? right now its saying file does not exist but its a shell script in my PATH and works when invoked from the command line
fyber has quit [Ping timeout: 268 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
fyber has joined #crystal-lang
<FromGitter> <sam0x17> figured it out -- crystal doesn't automatically resolve things in PATH for this purpose, but if you auto expand what you pass to Process.run with `command -v (my command)` it then works
ukd1 has joined #crystal-lang
sagax has quit [Remote host closed the connection]
early has quit [Quit: Leaving]
early has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
early has quit [Ping timeout: 245 seconds]
early has joined #crystal-lang
_whitelogger has joined #crystal-lang
ht_ has joined #crystal-lang
go|dfish has joined #crystal-lang
ukd1 has quit [Ping timeout: 258 seconds]
ht_ has quit [Remote host closed the connection]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <andrius> Are named tuples ordered in a way how data were given? Can I expect that `{f5: 1, f3: 4, ... f0: xxx}.keys` will always return f5, f3... f0? same question about hash
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <naqvis> @andrius yes, they both preserve the order of insertion
<FromGitter> <naqvis> though very contrived test case but it does shows that keys order is preserved ⏎ ⏎ ```pp Hash{"a" => 1,"b" => 2,"c" => 3,"d" => 4}.keys ⏎ pp ({a: 1, b: 2, c: 3, d: 4}).keys``` [https://gitter.im/crystal-lang/crystal?at=5d4bcce2beba830fff5572c3]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
devil_tux has joined #crystal-lang
sorcus has joined #crystal-lang
devil_tux has quit [Ping timeout: 258 seconds]
<FromGitter> <bararchy> Is there some built-in method to parse a string\IO as `HTTP::Headers` ?
_whitelogger has joined #crystal-lang
devil_tux has joined #crystal-lang
<FromGitter> <rogerwelin_gitlab> hmm, any idea what I'm doing wrong here? (want to supply default value as empty array) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d4bec8dd03a7c63e6edd5b8]
<FromGitter> <rogerwelin_gitlab> nevermind, saw my error now!
<FromGitter> <j8r> @rogerwelin_gitlab I recommend using `Array(String)` instead, the `of` syntax has some issues
sagax has joined #crystal-lang
<FromGitter> <rogerwelin_gitlab> @j8r good point, I actually prefer that syntax better for describing types
devil_tux has quit [Ping timeout: 244 seconds]
devil_tux has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <straight-shoota> Actually `[] of String` is not a type. It's equivalent to `Array(String).new`. For a type, you always need to use `Array(String)`.
laaron has joined #crystal-lang
devil_tux has quit [Ping timeout: 248 seconds]
laaron has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
<FromGitter> <asterite> andrius: for named tuple it's not guaranteed
teardown has quit [Ping timeout: 245 seconds]
<FromGitter> <naqvis> Thanks @asterite for confirmation. I tried to surf the documentation but couldn’t find such details.
alex`` has quit [Quit: WeeChat 2.5]
alex`` has joined #crystal-lang
<jokke> heya
<jokke> wasn't there a blog post about writing crystal extensions for ruby
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <petr-fischer> Hello! Is there any release plan of bugfixed 0.30.x version (issue #8044)? Tanks!
lucasb has joined #crystal-lang
<jokke> Val: thanks!
<jokke> Val: how is it outdated?
<FromGitter> <bararchy> @asterite thanks for taking the time helping with the Header thingy, I know it might be a low priority as headers are supposed to be case incensative, but it wreck havoc on our ML model which is used to seeing things a certain way
duane has quit [Ping timeout: 272 seconds]
snapcase has quit [Quit: Lost terminal]
snapcase has joined #crystal-lang
snapcase has quit [Quit: leaving]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> couldnt just make the model downcase everything or something?
duane has joined #crystal-lang
<FromGitter> <asterite> @barachy sorry for breaking things :-S
<FromGitter> <asterite> andrius: I was wrong, you can rely on the order :-)
<jokke> is there a way to define a varadic function pointer for c bindings?
<jokke> (as a type)
<jokke> something like `type Func = (Int32, ...) -> Int32
<jokke> something like `type Func = (Int32, ...) -> Int32`
<jokke> oh apparently
<jokke> Function(*Int32, Int32)
<FromGitter> <naqvis> jokke ⏎ ⏎ ```lib X ⏎ fun variadic(value : Int32, ...) : Int32 ⏎ end ⏎ ⏎ X.variadic(1, 2, 3, 4)``` [https://gitter.im/crystal-lang/crystal?at=5d4c357b7d56bc608019e6fb]
<jokke> yeah no
<jokke> i mean defining a type
<FromGitter> <asterite> no way
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
snapcase has joined #crystal-lang
ht_ has joined #crystal-lang
<jokke> oh wait what
<jokke> hm
<jokke> in the crystal official docs: Function types (Function(Int32, Int32), which can also be written as Int32 -> Int32)
<FromGitter> <andrius> #I have source data with names between <> or [<>] as a string. I do want to match all the records, but getting only first one. Could I get it done with regex only? (here it works http://www.crystular.org/) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d4c392a1dadc42a1134bdf7]
<FromGitter> <tenebrousedge> match all but get only the first one?
<FromGitter> <andrius> well, there is only one catch group. I have tried to replicate it, dont work
<FromGitter> <tenebrousedge> you're probably looking for `String#scan`
<FromGitter> <andrius> ```# => Regex::MatchData("<variablename>" 1:"<variablename>" 2:nil 3:nil 4:nil)``````
<FromGitter> <tenebrousedge> but if you only want the first one, why capture the rest?
<jokke> hm is it somehow possible to "switch" to another scope from a macro?
<jokke> i'm experimenting with exposing c functions so i need to define `fun`s in the global scope
<jokke> but i only know which `fun`s to generate in the included macro
rohitpaulk has joined #crystal-lang
<jokke> asterite?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Nekka has quit [Read error: Connection reset by peer]
Nekka has joined #crystal-lang
Nekka has quit [Client Quit]
Nekka has joined #crystal-lang
Nekka has quit [Remote host closed the connection]
Nekka has joined #crystal-lang
<jokke> hmm
<jokke> it seems macro finished can't be nested in macro included.
<jokke> is this a bug or by design
<jokke> i mean. it can be nested, but it's expanded directly it seems
<jokke> ah ok i have to escape the macros
<FromGitter> <Blacksmoke16> yea
<jokke> Blacksmoke16: about the scope switching: not possible?
rohitpaulk has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> er no i mean about nested finished macro in included
<jokke> yeah
<jokke> i got that
<jokke> i though you might know about the scope switching too
<FromGitter> <greenbigfrog> So, TIL that docker doesn't read log from STDOUT, but some other place (from the process with PID 1(?)) ⏎ <https://blog.eq8.eu/til/ruby-logs-and-puts-not-shown-in-docker-container-logs.html> ⏎ Somehow my mosquito worker isn't affected from this, but my website (kemal) is. ⏎ As far as I can tell, I've got them configured the same way. ⏎ You can find the dockerfiles at
<FromGitter> <Blacksmoke16> mm, you got an example of what you're tryingto do jokke?
<FromGitter> <greenbigfrog> (gonna be afk for a bit, just wanted to leave this here. Otherwise I would've fergotten this till I'm back)
<FromGitter> <Blacksmoke16> id look into how you're logging in each
<jokke> Blackmoke16: i'm trying to define `fun`s from an included hook
<jokke> but that obviously doesn't work because of it being in the scope of the including type
<FromGitter> <Blacksmoke16> vs the lib?
<jokke> no not a lib fun but a fun with a body
<FromGitter> <tenebrousedge> @greenbigfrog from the docs (https://docs.docker.com/config/containers/logging/): ⏎ ⏎ > The official httpd driver changes the httpd application’s configuration to write its normal output directly to /proc/self/fd/1 (which is STDOUT) and its errors to /proc/self/fd/2 (which is STDERR). See the Dockerfile.
<FromGitter> <tenebrousedge> you could have the log location set by an ENV var
<FromGitter> <Blacksmoke16> hmm sorry not sure i follow jokke
ukd1 has joined #crystal-lang
<FromGitter> <wontruefree> I am looking to create a "react" like application
<FromGitter> <tenebrousedge> D:
<FromGitter> <wontruefree> is there a reactive like shard for crystal
<FromGitter> <wontruefree> I want to build a ncurses app in crystal but was hoping to make it react like
ukd1 has quit [Ping timeout: 245 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
ukd1 has joined #crystal-lang
laaron has joined #crystal-lang
ukd1 has quit [Ping timeout: 246 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
ukd1 has joined #crystal-lang
<FromGitter> <greenbigfrog> @tenebrousedge I already got that info (of redirecting to `/proc/self/fd/1`) from the article I linked. but I'm more interested in why it works for one and not the other. ⏎ Both use `Logger.new(STDOUT)` underneath
<FromGitter> <tenebrousedge> are they built on the same image?
<FromGitter> <greenbigfrog> Yes. Built with `crystallang/crystal:0.29.0` and run in `debian:stretch-slim`
duane has quit [Ping timeout: 268 seconds]
<FromGitter> <tenebrousedge> one of these assumptions is wrong: the calling code is the same, or the file descriptor being written to is the same
duane has joined #crystal-lang
<FromGitter> <greenbigfrog> mind elaborating wym?
<FromGitter> <tenebrousedge> theoretically, the logging code is supposed to be writing to the STDOUT (file descriptor) that docker is listening to. Assuming that you're not running into non-deterministic behavior, then writing the same information to the same file descriptor should produce the same result each time
<FromGitter> <tenebrousedge> so if the observation is that the results differ, one of the starting assumptions must be wrong
<FromGitter> <tenebrousedge> either there's some code intercepting the call, or otherwise changing that code
<FromGitter> <tenebrousedge> or the logger is pointed at some other file descriptor
<FromGitter> <tenebrousedge> I would probably use `docker run -it` and a small test program and see what file descriptor crystal thinks that STDOUT is
<FromGitter> <tenebrousedge> and generally speaking, being able to take the logging location as an ENV var isn't a bad thing
<FromGitter> <greenbigfrog> ```pp STDOUT``` [https://gitter.im/crystal-lang/crystal?at=5d4c6dc71dadc42a11367b7d]
<FromGitter> <greenbigfrog> STDOUT is the same in both AFAICT
<FromGitter> <watzon> @wontruefree by "reactive" do you mean like all the RX packages that exist in different languages?
<FromGitter> <tenebrousedge> @greenbigfrog and that matches what the main app thinks STDOUT is?
<FromGitter> <greenbigfrog> Wdym? That's the same binary run in the 2 differently behaving containers. (or more like the code runs differently then I think it does.)
<FromGitter> <tenebrousedge> well you're logging in your web app, yeah?
<FromGitter> <tenebrousedge> so the question is whether the web app behaves the same as the test binary
<FromGitter> <tenebrousedge> if so... 😦
<FromGitter> <greenbigfrog> Just the default kemal logging (which I can't see.) I think I might be able to see STDERR though IIRC
<FromGitter> <greenbigfrog> (s/default/standard/)
teardown has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
alex`` has quit [Ping timeout: 246 seconds]
alex`` has joined #crystal-lang
<FromGitter> <greenbigfrog> So I should just use `Logger.new(IO::FileDescriptor.new(1))` instead of `Logger.new(STDOUT)`?
<FromGitter> <greenbigfrog> @tenebrousedge boop
<FromGitter> <tenebrousedge> does it do the right thing?
<FromGitter> <cllty> is crystal still single threaded?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Blacksmoke16> but MT is in progress
<FromGitter> <cllty> it was in progress 2yrs back when I asked here
<FromGitter> <Blacksmoke16> :shrug: deff closer now than 2 years
<rkeene> I like the shared-nothing approach Tcl takes to threads
<FromGitter> <watzon> From what I understand certain PRs haven't been getting merged because they're wanting to wait for MT to be finished, which means it's gotta be pretty close
<FromGitter> <greenbigfrog> ```code paste, see link``` ⏎ ⏎ The `puts` never appears... ⏎ I guess I got a working solution though [https://gitter.im/crystal-lang/crystal?at=5d4c7b54c87a0963e7375165]
<FromGitter> <Blacksmoke16> what happens if you do `@@logger = Logger.new STDOUT`
<FromGitter> <greenbigfrog> Nothing probably (99% sure)
<FromGitter> <greenbigfrog> WTF
<FromGitter> <greenbigfrog> I'm getting all messages...
<FromGitter> <greenbigfrog> (all output)
<FromGitter> <tenebrousedge> ....
<FromGitter> <tenebrousedge> what was different from before?
<FromGitter> <greenbigfrog> after setting `@@logger = Logger.new STDOUT`
<FromGitter> <greenbigfrog> not sure wtf is going on
<FromGitter> <tenebrousedge> right, but before I think you said you were using `Logger.new(STDOUT)` ?
<FromGitter> <greenbigfrog> If I remove the customloghandler, no output at all (as previously)
<FromGitter> <greenbigfrog> No. that's what kemal is doing under the surface by default.
<FromGitter> <greenbigfrog> ```code paste, see link``` ⏎ ⏎ If I do this, I get all output (even `puts`) [https://gitter.im/crystal-lang/crystal?at=5d4c7d29bfd2887f53b3fd20]
<FromGitter> <greenbigfrog> ```Kemal.config.logger = Kemal::LogHandler.new(IO::FileDescriptor.new(1))``` ⏎ ⏎ I'll get no output whatsoever [https://gitter.im/crystal-lang/crystal?at=5d4c7dc0c87a0963e73761fd]
duane has quit [Ping timeout: 272 seconds]
duane has joined #crystal-lang
<FromGitter> <watzon> @greenbigfrog what happens with `IO::FileDescriptor.new(1, blocking: true)`
<FromGitter> <watzon> Idk if it will make a difference having the `blocking` option as true
<FromGitter> <greenbigfrog> this kemal logging stuff is messed up (or at least the documentation in the guide is`
<FromGitter> <greenbigfrog> adding `blocking` doesn't change anything
blassin has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <watzon> Hmm that's intereating
gangstacat has joined #crystal-lang
<FromGitter> <greenbigfrog> I'm not getting output using something like pp or puts (that uses STDOUT) but as soon as I add/use a `Logger.new(STDOUT)` in a custom log handler I'll get all stdout output
<FromGitter> <greenbigfrog> wtf
blassin has joined #crystal-lang
<FromGitter> <Blacksmoke16> dunno
<FromGitter> <greenbigfrog> would be nice to know if the error is on my side, or not...
<FromGitter> <greenbigfrog> Lemme know if anyone has any idea the slightest, I think I'll just have to sleep over it
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
sorcus has quit [Ping timeout: 252 seconds]
ht_ has quit [Remote host closed the connection]
<FromGitter> <rmarronnier> Hey all, do you know if shards can include `git submodules` ? I created a shard that includes one and `shards install` fetches the main repo with the submodule folder without any content in it. Example : https://github.com/rmarronnier/fastText-crystal
<FromGitter> <straight-shoota> @rmarronnier No, shards does not support submodules. It expects each shard to be fully in it's own repository.
<FromGitter> <straight-shoota> If you want to use a different development strategy, that's completely fine, you just need a separate repo (or branch) as distribution channel for shards then.
<FromGitter> <rmarronnier> Thanks @straight-shoota Just happened to see : https://github.com/crystal-lang/shards/issues/205 :-)
Nekka_ has joined #crystal-lang
<FromGitter> <rmarronnier> Ok, I understand. I'll do that.
<FromGitter> <straight-shoota> Yeah, that's a bit short mouthed though :D
<FromGitter> <straight-shoota> crystal-lang/shards#238 is more elaborate
<FromGitter> <rmarronnier> Wow, now it makes more sense.
ukd1 has quit [Ping timeout: 246 seconds]
<FromGitter> <dscottboggs_gitlab> Is there any way to do this? https://carc.in/#/r/7dmf
Nekka has quit [Quit: zzz]
Nekka_ is now known as Nekka
<FromGitter> <dscottboggs_gitlab> I want to eliminate the `nil` values and the `| Nil` type from an array's `T`
ukd1 has joined #crystal-lang
<FromGitter> <straight-shoota> `Array#compact` (https://crystal-lang.org/api/0.30.0/Array.html#compact-instance-method)
<FromGitter> <dscottboggs_gitlab> Oh, that's convenient.
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ukd1 has quit [Ping timeout: 244 seconds]
ukd1 has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
ukd1 has quit [Ping timeout: 272 seconds]
ukd1 has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]