RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <drosehn> Are there some crystal-provided constants for the compile-time and compile-date of your program? (not BUILD_DATE, which is the date the compiler was built).
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
cyberarm has quit [Read error: Connection reset by peer]
cyberarm has joined #crystal-lang
radagast has quit [Quit: radagast]
oprypin has quit [Read error: Connection reset by peer]
FromGitter has quit [Ping timeout: 272 seconds]
vivus has quit [Read error: Connection reset by peer]
oprypin has joined #crystal-lang
FromGitter has joined #crystal-lang
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
relyks has joined #crystal-lang
<relyks> are there any plans to add auto-completion to crystal?
<relyks> for ide support?
snsei has quit [Ping timeout: 252 seconds]
<relyks> just found this
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
daemonwrangler has joined #crystal-lang
braidn_ has quit [Ping timeout: 248 seconds]
wmoxam has quit [Ping timeout: 248 seconds]
chrisarcand has quit [Ping timeout: 248 seconds]
chrisarcand has joined #crystal-lang
wmoxam has joined #crystal-lang
<FromGitter> <potz> > Are there some crystal-provided constants for the compile-time and compile-date of your program? (not BUILD_DATE, which is the date the compiler was built). ⏎ ⏎ I don't know the answer to your exact question, but was just playing around with macros and apparently you can do something like this: ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5a4460100163b02810867f23]
g3funk has joined #crystal-lang
wmoxam has quit [Ping timeout: 248 seconds]
wmoxam has joined #crystal-lang
relyks has quit [Quit: relyks]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <drosehn> Hmm, yes, something like that would work. I've moved on from the program where I wanted that, but that would get the job done and would give me some flexibility in the exact format of time. I'll remember this for when I get back to that program.
<FromGitter> <drosehn> Thanks for that suggestion.
<FromGitter> <potz> cool, you're welcome.
<FromGitter> <potz> I wonder if there's a way to just run `Time.now` inside the macro, probably a better idea.
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 272 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <drosehn> The macro language is it's own little separate language. What it knows how to do is documented at https://crystal-lang.org/api/Crystal/Macros.html . You could maybe use `run()` instead of `system()`, because it looks like `run()` compiles and runs the file you specify. But in this case that's more trouble than it's worth, because it means you'd need a separate source file which had nothing but a command to
<FromGitter> ... print out `Time.now`.
<FromGitter> <drosehn> Although using the `run()` command in the macro language might work better when writing something which is meant to be compiled on multiple platforms. But for what I'm doing, it's fine to use `now_as_int = {{system %q(date +%s)}}`
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] bcardiff closed pull request #5458: Fix missing Dir#each to be an Enumerable (release/0.24...fix/dir_each) https://git.io/vb5uj
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
mjago` has joined #crystal-lang
mjago has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#12cc7f2 (release/0.24 - Fix missing Dir#each to be an Enumerable (#5458)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/322445191
rohitpaulk has joined #crystal-lang
faustinoaq has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
<faustinoaq> relyks, check https://github.com/TechMagister/cracker
<txdv> looks nice
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
baweaver has left #crystal-lang ["Off to do something that looks important"]
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]
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]
alex`` has joined #crystal-lang
sz0 has joined #crystal-lang
<FromGitter> <bararchy> When real multi-threading will happen, it could be cool to have ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a44aa3de43a7a150cb31577]
<FromGitter> <bararchy> or some way to wait for all fibers to "release"
rohitpaulk has joined #crystal-lang
aroaminggeek has quit [Quit: Textual IRC Client: www.textualapp.com]
rohitpaulk has quit [Ping timeout: 252 seconds]
mark_66 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<FromGitter> <straight-shoota> @bararchy This doesn't depend on multi-threading, waiting for a set of fibers to complete is also useful if they are "only" concurrent.
<FromGitter> <straight-shoota> And there is actually a macro for that: `parallel`
<FromGitter> <bararchy> @straight-shoota Interesting, there is no api docs reagrding this macro, looking at the code it seems it create a Channel per job, and execute each in a spawn while waiting for all to finish right?
<FromGitter> <bararchy> is there a simple example of how this actually works?
<FromGitter> <bararchy> do I feed it an Array(Proc) ?
<FromGitter> <bararchy> Or better (easier?) is there a spec for it?
<FromGitter> <straight-shoota> I don't know much about it besides looking at the code myself
<FromGitter> <straight-shoota> But it is specced in spec/std/concurrent_spec.cr
<FromGitter> <straight-shoota> It's a macro, so just feed it plain expressions, no procs involved.
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <bararchy> I see, ok
<FromGitter> <bararchy> any idea how I can use it for something like ⏎ ⏎ https://github.com/NeuraLegion/shainet/blob/master/src/shainet/network.cr#L160-L162
rohitpaulk has joined #crystal-lang
mjago` has quit [Quit: ERC (IRC client for Emacs 25.1.1)]
jsn- has quit [Ping timeout: 260 seconds]
jsn- has joined #crystal-lang
jnyw has joined #crystal-lang
<FromGitter> <straight-shoota> no, `parallel` is for running several distinct tasks where each is defined differently and you might want individual return values. Your code is essentially running the same task distributed over multiple fibers.
<FromGitter> <straight-shoota> there should probably be a macro for that, too. Or rather a method because there is no macro involved.
<FromGitter> <straight-shoota> Could be implemented very similar: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a44ce8cba39a53f1aae3bcf]
<FromGitter> <straight-shoota> Of course this can be improved upon
<FromGitter> <bararchy> Cool! thanks :)
<jokke> anyone at the 34c3?
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 268 seconds]
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
<FromGitter> <straight-shoota> somebody asked yesterday, don't remember who it was
<FromGitter> <straight-shoota> ah it was @ziprandom
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
jnyw has quit [Quit: WeeChat 2.0.1]
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <mjago> What a plonker! I spend 3 hours writing bindings for FFTW and @firejox has beaten me to it by 3 months 😊
ua has quit [Ping timeout: 248 seconds]
ua has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
linuksz has joined #crystal-lang
<linuksz> How can I get the user and group ID of the current process?
<FromGitter> <Wulfklaue> pgid will "Returns the process group identifier of the current process".
<linuksz> Oh, I mean the UID and GID of the process owner.
rohitpaulk has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
<FromGitter> <drosehn> Hmm.
<FromGitter> <drosehn> I have a program which gets the UID, EUID, GID, and EGUID of the *current* running process, if that's what you mean.
<FromGitter> <drosehn> It isn't implemented in the `Process` class yet, but it was easy to figure out what was needed to implement them.
<linuksz> @drosehn, yes, I also need the euid of the process.
<FromGitter> <drosehn> Okay, let's see if I can pull out just the lines that you'd need for that.
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a451486e43a7a150cb5289a]
marius has joined #crystal-lang
<FromGitter> <drosehn> Put those lines early in your source file, and then you should be able to use `Process.uid`, etc.
<FromGitter> <drosehn> if your source file is a `module`, then put these before the `module Whatever` line.
marius has quit [Quit: marius]
mark_66 has quit [Remote host closed the connection]
<linuksz> @drosehn, thanks.
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
linuksz has quit [Quit: WeeChat 2.0.1]
rohitpaulk has quit [Ping timeout: 256 seconds]
vivus has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
rohitpaulk has joined #crystal-lang
<FromGitter> <potz> @drosehn agreed. So it's my understanding that `run()` always needs the macro code in a separate file? I was hoping there would be some sort of `quote`/`unquote` a la Elixir somewhere.
snsei has quit [Remote host closed the connection]
<FromGitter> <drosehn> Not only does `run()` need a separate file, but the documentation notes that the compiler may cache the result of the last time it compiled that file.
snsei has joined #crystal-lang
<FromGitter> <potz> I see.. definitely not good for timestamping then
<FromGitter> <drosehn> for your amusement, this seems to work okay:
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a452e7003838b2f2a473213]
<FromGitter> <drosehn> I haven't done much testing on that, and it was written while I was half asleep, but it seems to work.
<FromGitter> <potz> ```code paste, see link``` ⏎ ⏎ Very cool! I love this language. [https://gitter.im/crystal-lang/crystal?at=5a452f205355812e5728a053]
<FromGitter> <potz> So *FILE* is always compile-time, obviously...
<FromGitter> <potz> I mean `__FILE__`
<FromGitter> <drosehn> yes.
<FromGitter> <potz> Well thinking a bit more, even if the macro-file that is run by `run` is cached, if you provide a method on it that just returns `Time.now`, it would still work right.
<FromGitter> <potz> I mean, it caches the compiled code, but executing it would always yield the current time
<FromGitter> <potz> I suppose if you have a lot of macro-related helpers it's not a big deal to have a separate file, might even be a good practice
<FromGitter> <potz> I'm finding all this fascinating. Just started messing around with crystal 2 days ago.
snsei has quit [Ping timeout: 265 seconds]
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <drosehn> Well, I'm still half-asleep, so I'm not sure if it would work right.
<FromGitter> <drosehn> ... and I need to concentrate my half-asleep brain on a different project right now, but thanks again for the idea about using `system()`.
<FromGitter> <potz> lol ok. I wish you a good `sleep 8.hours` at some point in the future
<FromGitter> <drosehn> Probably not for another 12 hours!
<FromGitter> <potz> Just FYI this seem to work: ⏎ ⏎ main.cr: ⏎ ⏎ ```puts Time.now.epoch_ms``` [https://gitter.im/crystal-lang/crystal?at=5a4537a9b48e8c3566765476]
<FromGitter> <bararchy> Is there a way to do something like .each(200) where you get chunks of data in the size of 200 or lower?
<FromGitter> <potz> still cumbersome to have to output to STDOUT then parse it back, but it's more portable than the system call.
<oprypin> bararchy, https://crystal-lang.org/api/0.23.1/Enumerable.html#each_slice%28count%3AInt%2Creuse%3Dfalse%2C%26block%29-instance-method
<FromGitter> <jwaldrip> are there instructions to build the crystal docker image locally?
<FromGitter> <jwaldrip> doing a `docker build .` fails.
<FromGitter> <bararchy> oprypin thanks
<FromGitter> <larubujo> just {{ `date`.stringify }} for compile-time date
<FromGitter> <potz> @larubujo not sure I did it right, but I got: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a45401dc072deaf0b10dd9c]
<FromGitter> <potz> @larubujo Oh I see what you mean.... ``date`` (with backticks), being equivalent to system("date"). The gitter interface transformed your original message.
<livcd> few questions :-)
<livcd> 1) what is the most stable and/or featerful DB driver available for Crystal ?
<FromGitter> <marksiemers> If you look at the links from that page, for sqlite, mysql, and postgres, those are the most stable drivers.
<FromGitter> <marksiemers> For features, are you looking for an ORM, or particular features from the driver?
<livcd> marksiemers: my q is kinda generic and more about "which one would you use in production all things considered (like Crystal not being 1.0 yet and so on)
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Ven`` has joined #crystal-lang
<FromGitter> <bararchy> I posted to the google group, and copy-pasting here for those not in the Crystal group
<FromGitter> <bararchy> Hi All, ⏎ ⏎ As you might have heard (or not) we released our WIP neural network SHAInet to github under the MIT license. ⏎ The network is planed to be a full toolkit allowing users to train, use, and re-use multiple interesting architectures all in pure Crystal (no C bindings) ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5a455715e43a7a150cb6601f]
gloscombe has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.0.1]
rohitpaulk has quit [Ping timeout: 248 seconds]
marius has joined #crystal-lang
Ven`` has quit [Ping timeout: 240 seconds]
Ven`` has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
TIMEBONEZ has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
TIMEBONEZ has joined #crystal-lang
gloscombe has quit [Ping timeout: 272 seconds]
gloscombe has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <vpereira> Hi, I'm playing with crystal and concurrency
<FromGitter> <vpereira> and I have a question
<FromGitter> <vpereira> I wrote a simple pet script https://gist.github.com/vpereira/7956983838074df43200b5eea3e03cea
<FromGitter> <vpereira> oh gitter is nice :)
<FromGitter> <vpereira> so its works. However Imagine that I want to remove the "sleep 5"
<FromGitter> <vpereira> how can I ensure, to close the channel just after both fibers ended?
<RX14> @vpereira count the fibers you spawn (2), receive 2 times, then close the channel
<RX14> if you don't know how many times each fiber will send in a channel, create another "completion" channel which each fiber sends nil down once it's done
<RX14> once each fiber has sent something down the completion channel, you know it's all done and you can cleanup
<RX14> but in this case your completion channel can be the same as your "data" channel
<FromGitter> <vpereira> RX14. thank you. Count isnt an option. I actually tried the control channel but the code looked too complex. lets see
snsei has quit [Remote host closed the connection]
<RX14> @vpereira we really need to have some higher-level concurrency primitives
<RX14> I don't know if there are any shards which do that
<FromGitter> <vpereira> RX14 I'm searching all day for that. No success :/
jnyw has joined #crystal-lang
<RX14> you can get everything done with fibers and channels of course
<RX14> it's just a little lengthy
<RX14> you should probably create a "wait group" abstraction of something
<RX14> or*
<FromGitter> <vpereira> yes, maybe.. Do you know any shrad which works heavily with channels and fibers? I would like to study some code and get some ideas of how to solve those problems
<RX14> no, sorry I don't
<RX14> @vpereira looks like you need to create this shard
<RX14> i'm sure the community would be happy for it
<RX14> and i'd love to include some of this in the stdlib
<FromGitter> <vpereira> RX14: lol I'm an average ruby developer but a mediocre go developer. I'm still trying to get my feet wet with crystal ;)
<RX14> i'm sure whatever you create will be far better than nothing
<RX14> if you're reaching for it there's a need
<FromGitter> <vpereira> until now I couldnt find a difference between "calling a Fiber.yield" after my spawn blocks and not calling it
<FromGitter> <fridgerator> @bararchy thats great!
<FromGitter> <fridgerator> @vpereira I've heard https://github.com/jwaldrip/promise.cr makes good uses of fibers and channels
<oprypin> in case you're missing callback hell
Papierkorb has joined #crystal-lang
Papierkorb has left #crystal-lang ["Konversation terminated!"]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]