ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<PriceMight> are there any plans to add liburing to crystal?
<PriceMight> a lot of benchmarks show that it is quite more performant than stuff like epoll and kqueue
<PriceMight> (for async IO)
Dreamer3 has joined #crystal-lang
PriceMight has quit [Quit: Connection closed]
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
<FromGitter> <didactic-drunk> PriceMight: `[1, 2, 3].parallel.run { |n| puts n }.wait` with my shard (https://github.com/didactic-drunk/concurrent.cr)
<FromGitter> <naqvis> @didactic-drunk That's an awesome work 👍
ua has quit [Ping timeout: 246 seconds]
_ht has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter> <erdnaxeli:cervoi.se> Nice!
johnny101 has quit [Ping timeout: 240 seconds]
johnny101 has joined #crystal-lang
<FromGitter> <confact> I think I am tired but I seem to not find any Array.rand method? I want it to random pick a value in the array.
<FromGitter> <confact> I was tired, found `sample` now. ^^
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
<yxhuvud> pricemight: it will be a long while before uring can be expected to exist in a good enough way on the kernel versions crystal support.
<yxhuvud> also it is not obvious that the core team want the additional maintenance burden of doing a special solution by themselves instead of relying on libevent.
<yxhuvud> That said, I'm fooling around a little with it in https://github.com/yxhuvud/nested_scheduler , but it is not in a working state yet.
<yxhuvud> the main draw as I see it is not slightly higher performance for networking but that it supports async operations for file io as well.
richbridger has quit [Remote host closed the connection]
richbridger has joined #crystal-lang
olbat is now known as Olbat
<FromGitter> <riffraff169> is there a way to debug what a macro is doing?
<FromGitter> <riffraff169> my macro runs 3 times, and 2 times it gets the data, and 1 time the data is empty, even though it should have something
<FromGitter> <riffraff169> the only difference is the data that is failing has an enum, and the others dont
<FromGitter> <riffraff169> but the compilation doesnt fail, just when i run the test code to print out the data, it is empty
<FromGitter> <riffraff169> my macro: ```
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894aaeda3e853b33da7c32]
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894abc2c5b9d392f399d41]
<FromGitter> <riffraff169> thats better
<FromGitter> <riffraff169> `make_data(STYLES,Style,"data/styles.yml")`
<FromGitter> <riffraff169> that works
<FromGitter> <riffraff169> this doesnt:
<FromGitter> <riffraff169> `make_data(ACTIVITIES,Activity,"data/activity.yml")`
<FromGitter> <riffraff169> example output of success and failure
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894b16b38a713b2fb44e9b]
<FromGitter> <riffraff169> if i could get some debug output of actual macro stage, i could troubleshoot why `ACTIVITIES` `Activity()` parts are empty, but `STYLES` `Style()` has data
<FromGitter> <naqvis> did you try adding `{{debug}}` ?
<FromGitter> <riffraff169> where would i add that...is that in the documentation somewhere?
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894c43c1a9210b3c26ded0]
<FromGitter> <riffraff169> aha! thanks, let me try that
<FromGitter> <naqvis> https://crystal-lang.org/api/1.0.0/Crystal/Macros.html#debug(format=true):Nop-instance-method
<FromGitter> <riffraff169> hmmmm....thats interesting...debug shows it, but still not in my output...weird
<FromGitter> <naqvis> are you experiencing macro issue? or things (yaml) are not getting parsed correctly?
<FromGitter> <naqvis> what happened when you invoke? `Hash(String,Activity).from_yaml(File.read("data/activity.yml")`
<FromGitter> <riffraff169> let me test that...i believe it had worked before, but its possible some code/data changes made it no longer work
<FromGitter> <riffraff169> yeah, that is empty....which is weird, like i said, because `{{debug}}` shows that data as being read
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894ea6bdc0bc32e622bf24]
<FromGitter> <riffraff169> so maybe that just means that the macro read the data, but not that the from_yaml worked...hmmm, mismatch maybe?
<FromGitter> <riffraff169> here is my `Activity`:
<FromGitter> <naqvis> you should look into `Activity`
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894f1cbdc0bc32e622c09d]
<FromGitter> <riffraff169> and 1 entry from the yaml
<FromGitter> <riffraff169> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60894f33be35363915961d28]
<FromGitter> <riffraff169> anyway, thanks, ill troubleshoot further
<FromGitter> <naqvis> sure thing
<FromGitter> <riffraff169> is it a problem if a struct field is named `type`, or should i have it be a different name?
<FromGitter> <riffraff169> ha...missing `getter` before the fields
<FromGitter> <naqvis> 👍
<FromGitter> <naqvis> also crystal convention is underscore name variables
<FromGitter> <naqvis> so better to use `@[YAML::Field(key: "minActivity")]` .....
<FromGitter> <riffraff169> ok...what does that do?
<FromGitter> <naqvis> mapping between your ivar name and value inside yaml
<FromGitter> <naqvis> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6089525a471bee582e1cea22]
<FromGitter> <riffraff169> ah...ok
<FromGitter> <naqvis> from/to will follow the annotation key value (if present)
<FromGitter> <riffraff169> im doing data conversion (basically copying data from java to crystal), so im writing the yaml by hand to begin with...so i can just change the fields to have underscores
<FromGitter> <naqvis> if there are multiple yaml files, you better write a simple script to read yaml and generate crystal code for you
<FromGitter> <naqvis> but if very few, then it won't hurt doing that manually
<FromGitter> <riffraff169> yeah, no, no yaml at all....hardcoded as enums in java code...
<FromGitter> <riffraff169> which is fine for my crystal program because it is static data, doesnt change...but loading in from yaml in build makes it easy
<FromGitter> <riffraff169> so i do have to manually create the yaml files anyway
mipmip has joined #crystal-lang
<FromGitter> <riffraff169> so it appears that `def initialize(@name : String)` is equivalent (maybe) to `getter name : String; def initialize(name : String); @name = name; end` ??
<FromGitter> <Blacksmoke16> yes, but minus the `getter`
<FromGitter> <Blacksmoke16> as it just assigns the ivar, not providing a getter to access it outside of the type
<FromGitter> <riffraff169> so if i want to be able to access it, i would have to add `getter name` also...so the only thing it does it enable you to initialize it without having a statement inside the method
<FromGitter> <Blacksmoke16> right
<FromGitter> <riffraff169> ok, thanks
Dreamer3 has quit [Quit: Leaving...]
<FromGitter> <rsk700> Hello, what is the purpose of /lib folder in new "crystal init" project? I started using, because it allows absolute paths in `require`, but find out it is by default in gitignore
<FromGitter> <Blacksmoke16> external dependencies, e.g. other shards
<FromGitter> <Blacksmoke16> i.e. not source code
<FromGitter> <rsk700> is it possible to use absolute `require` for my code, which is in /src? or only relative import can be used inside project
<FromGitter> <Blacksmoke16> > By default the require path is the location of the standard library that comes with the compiler, and the "lib" directory relative to the current working directory (given by pwd in a Unix shell). These are the only places that are looked up. ⏎ ⏎ So no, doesn't look like it. I suppose you *could* modify the require path, but thats prob a bad idea as then it wouldnt work for others
<FromGitter> <rsk700> ok, thanks, I was hoping there is proper way
oprypin has quit [Remote host closed the connection]
oprypin has joined #crystal-lang
<FromGitter> <djberg96> is there something like `IO.foreach` in Crystal? Or is it at the instance method only?
<FromGitter> <Blacksmoke16> what would that do?
<straight-shoota> File.each_line
<straight-shoota> or IO#each_line
<FromGitter> <confact> How do I handle this error: ⏎ ⏎ ```Unhandled exception: Missing hash key: "ceb" (KeyError)``` ⏎ ⏎ I guess it comes inside Crystal somewhere as I don't have any key called ceb in my code. [https://gitter.im/crystal-lang/crystal?at=60897d502c5b9d392f3a2c1f]
<straight-shoota> context?
<FromGitter> <confact> Never mind, I was able to get down to what the error came from, a Cadmium shard.
<FromGitter> <confact> It didn't like this array of "words": ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ haha :D [https://gitter.im/crystal-lang/crystal?at=60897ee00e19524c642e683a]
mipmip has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
woodruffw has quit [Ping timeout: 252 seconds]
woodruffw has joined #crystal-lang
woodruffw has quit [Ping timeout: 265 seconds]
Nekka has quit [Ping timeout: 260 seconds]
Nekka has joined #crystal-lang
woodruffw has joined #crystal-lang
mipmip has quit [Ping timeout: 268 seconds]
woodruffw has quit [Ping timeout: 240 seconds]
mipmip has joined #crystal-lang
woodruffw has joined #crystal-lang
oddp has joined #crystal-lang
woodruffw has quit [Ping timeout: 240 seconds]
_ht has quit [Remote host closed the connection]
woodruffw has joined #crystal-lang
woodruffw has quit [Ping timeout: 240 seconds]
mipmip has quit [Ping timeout: 260 seconds]
duane has quit [Ping timeout: 265 seconds]
duane has joined #crystal-lang
repo has quit [Quit: WeeChat 2.9]
mipmip has joined #crystal-lang
repo has joined #crystal-lang
mipmip has quit [Ping timeout: 252 seconds]
oddp has quit [Quit: quit]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 268 seconds]
mipmip has joined #crystal-lang
mipmip has quit [Ping timeout: 265 seconds]
yespal has joined #crystal-lang
woodruffw has joined #crystal-lang