RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
Raimondi has quit [Ping timeout: 240 seconds]
non-aristotelian has quit [Quit: non-aristotelian]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
Raimondi has joined #crystal-lang
scott_tams has joined #crystal-lang
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron- has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> @anamba yes, it doesn't scale. Synapse, the reference server is written in Python. They have also written a new one which is called Dendritte, but not ready yet. Also sadly, it requires Kafka 💀
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
laaron has quit [Remote host closed the connection]
azuri5 has quit [Quit: azuri5]
<FromGitter> <proyb6> Didn't aware Matrix has UpCloud as a sponsor? I wish they would sponsor Crystal but they didn't have devs doing Crystal stuff
<FromGitter> <anamba> yeah that's why I was thinking, if one of us made a Crystal client and it got popular enough, it would make Crystal more popular as well
<FromGitter> <kingsleyh> Matrix nearly died last year as they ran out of funds but luckily several blockchain ICO gave them some money and then they managed to find a sponsor
<FromGitter> <kingsleyh> Riot uses Matrix as well
<FromGitter> <kingsleyh> However all the chat clients are not very nice to use either
<FromGitter> <Willyboar> I agree w/ @anamba .
ashirase has quit [Ping timeout: 250 seconds]
laaron has joined #crystal-lang
ashirase has joined #crystal-lang
<FromGitter> <kingsleyh> Some great usages of Crystal can make all the difference - the kind of thing Ruby on Rails did for Ruby
<FromGitter> <Willyboar> exactly
<FromGitter> <Willyboar> i strongly believe that web dev is a crucial part of a langu
<FromGitter> <j8r> I think reproducing RoR in Crystal won't be successful
<FromGitter> <Willyboar> of course not
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
<FromGitter> <j8r> For me the only web dev (front wise) Crystal can have success is with WASM
<FromGitter> <j8r> but Crystal has a GC compared to Rust :(
<FromGitter> <Willyboar> yes rust is nice
<FromGitter> <Willyboar> but i get myself tired when i gave it a try
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> rust is too complex :|
<FromGitter> <Willyboar> i agree
<FromGitter> <Willyboar> Crystal target group must be rubyists, new web devs and web designers jumping to full stack
<FromGitter> <j8r> even newbies :)
<FromGitter> <Willyboar> especially them
<FromGitter> <j8r> For devops Crystal is also nice, but there are still LibC bindings missing :/
<FromGitter> <j8r> static linking to a single self-contained binary is a great feature
<FromGitter> <pynixwang> crystal may be an alternative of golang.
<FromGitter> <j8r> yes.
<FromGitter> <pynixwang> golang syntax is ugly.
<FromGitter> <j8r> For system programming its better than Golang because it interoperate better with C (no FFI overhead, simple bindings)
<FromGitter> <Willyboar> crystal needs tutorials - casts - articles
<yxhuvud> well, part of the reason bindings are easier is that the GC is currently a conservative GC. That is not something that is set in stone and could change.
<FromGitter> <proyb6> @pynixwang Golang is made for system programming, Crystal can be alternative only when more libraries is appear but Golang like Ruby are built without using LLVM for fast compilation
<FromGitter> <proyb6> While RoR 6 is coming early next year
<FromGitter> <straight-shoota> Does anyone have a idea how to neatly convert (raw) YAML into JSON?
<FromGitter> <straight-shoota> I don't think you can tell `YAML::Builder` to emit JSON schema
<yxhuvud> I'm not certain yaml in general converts neatly to json. The opposite is trivially true as valid json is already valid yaml.
<FromGitter> <straight-shoota> Yes, JSON can't represent any YAML. But I have a YAML document that is JSON compliant and what to convert it to JSON for storing it in a database. Postgres can't read YAML directly, only JSON.
<FromGitter> <j8r> YAML is a superset of JSON, so its logically not possible out of the box to convert it to JSON
<FromGitter> <j8r> ...without shrinking it
laaron- has quit [Remote host closed the connection]
<FromGitter> <straight-shoota> @j8r It's entirely possible when the YAML uses only JSON-compatible features. It's essentially JSON written in standard YAML syntax
laaron has joined #crystal-lang
<FromGitter> <straight-shoota> If it was written in YAML with JSON syntax, it would be a valid document in both.
<FromGitter> <j8r> yes of course
<FromGitter> <j8r> but this is why there is no `to_json`
<FromGitter> <j8r> unless there is a way to have a restriction to ensure the interoperability of the document with JSON
<FromGitter> <straight-shoota> There doesn't need to be any restriction.
<FromGitter> <straight-shoota> It would be fine to just raise when trying to store something as JSON which isn't compatible.
<FromGitter> <j8r> i think it's better to have a YAML subset
<FromGitter> <straight-shoota> what do you mean?
<FromGitter> <j8r> Instead of raising when `to_json`, raising when parsing the YAML
<FromGitter> <j8r> when there is a feature unknown in json
<FromGitter> <straight-shoota> Ah, okay. Reading JSON in YAML syntax instead of writing YAML in JSON syntax.
<FromGitter> <straight-shoota> Yeah, that would be good, too.
<FromGitter> <j8r> yep
<FromGitter> <straight-shoota> Although, parsing is generally harder than emitting^^
<FromGitter> <j8r> yes
<FromGitter> <j8r> You use YAML::Any?
<FromGitter> <straight-shoota> I don't care
<FromGitter> <straight-shoota> YAML comes from a string
<FromGitter> <j8r> with mapping/serializable... it will be more complex without rewriting a whole parse (or with forward_missing_to)
<FromGitter> <straight-shoota> but mapping/serialize requires a fixed schema
<FromGitter> <j8r> your solution is far simpler
<FromGitter> <j8r> and even be in the stdlib
<FromGitter> <straight-shoota> but not flexible
<FromGitter> <j8r> There is no `JSON::Any.to_yaml` :o
<FromGitter> <straight-shoota> I'm looking for `YAML::Any#to_json` anyway :P
<FromGitter> <j8r> Oh it require a builder
<FromGitter> <straight-shoota> I have written a `YAML::JSONBuilder` which inherits `YAML::Nodes::Builder` and delegates to `JSON::Builder`. But it's got some rough edges
<FromGitter> <straight-shoota> It works almost. But in the YAML API numbers are emitted as strings and there is no difference between a number and an unquoted string :/
<FromGitter> <straight-shoota> That's really a pain. Now the JSON builder needs to verify if a string value is a number
<FromGitter> <straight-shoota> In Ruby it's simple `YAML.parse(yaml).to_json` 😢
<scott_tams> yeah but that's because ruby is dynamic. It's a little different when there's strictness
<FromGitter> <j8r> it could be done, it isn't just there in `YAML::Any`
<FromGitter> <j8r> mps: do you know how to https://github.com/nih-at/libzip/issues/76 with https://git.alpinelinux.org/cgit/aports/tree/community/libzip/APKBUILD ? A solution I see i creating a new `libzip-static`
<FromGitter> <j8r> like sqlite https://git.alpinelinux.org/cgit/aports/tree/main/sqlite/APKBUILD , but with a cmake build inside
<FromGitter> <straight-shoota> yeah, dynamic types makes it a little bit easier to implement, but it's not actually that hard to achieve
<FromGitter> <j8r> mps: and I can create a `_build()` function to shared the flags like in php https://git.alpinelinux.org/cgit/aports/tree/community/php7/APKBUILD
<FromGitter> <straight-shoota> This makes me wish we had a generalized serialization toolkit like serde
<FromGitter> <j8r> Agree
<FromGitter> <j8r> I've already said previously not to have YAML/JSON whatver serialization mapping in stdlib
<FromGitter> <j8r> it's better to have them in a dedicated organization
<FromGitter> <j8r> that accepts other formats like TOML, XML etc and ensure an consistent API across them
<FromGitter> <straight-shoota> Organization between stdlib/shard is mostly irrelevant. It's entirely feasible to have a core framework plus a few popular formats in stdlib.
<FromGitter> <j8r> not between, having a single organization that hosts the spec
<FromGitter> <j8r> and some implementations - like serde
<FromGitter> <j8r> of course implementations can be in the stdlib, like now, but IMHO it's worse than having them in an single Org
<FromGitter> <j8r> people will start thinking there is "a standard way" for mapping - there is not. ⏎ this yields to a state we are now: `JSON.mapping` vs `JSON::Serializable`
<FromGitter> <j8r> vs `JSON::NewWayOfMapping` in the future?
<FromGitter> <straight-shoota> No, I mean to have a core and format implementations for that framework.
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> Oh. yes
<FromGitter> <j8r> underlying its preferable not in stdlib, but that's fine in other people/orgs repos
<FromGitter> <j8r> This way the spec can evolve freely and make breaking changes (if they want to)
laaron has joined #crystal-lang
<FromGitter> <straight-shoota> That's not necessarily a good thing ;)
<FromGitter> <j8r> not false, but that's the state of the Crystal ecosystem - exiting times :P
<FromGitter> <straight-shoota> But yes, developing outside of stdlib allows an independent release schedule, which means feature enhancements can be shipped earlier.
<FromGitter> <j8r> Haha I mean exciting time, not exiting times :X
<FromGitter> <j8r> (I don't want to rage-quit Crystal, there is no reason to 😄 )
<mps> j8r[g]: I'm busy now with daily work, will look at the issue (your question) in a few hours
<FromGitter> <j8r> mps no problem 👍
laaron has quit [Remote host closed the connection]
<FromGitter> <parruda> Hey guys, have you had any problems using `LibC.setgid`?
<FromGitter> <parruda> setuid works fine, but I can’t get `setgid` to actually change the process gid
<FromGitter> <parruda> When I run the following program as root, the output is `1000,0`
<FromGitter> <parruda> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c26380dab910e7d3ae68ec1]
<FromGitter> <parruda> I am using crystal 0.27.0
<yxhuvud> straight-shoota: independent release schedules are possible even for stuff that is included in stdlib. One way to accomplish that is to bundle some default shards into crystal installation, similar to how ruby bundle a bunch of gems on install. It would of course raise other issues, like requiring shard to allow systemwide installations etc.
<FromGitter> <straight-shoota> Yes, Yxhuvud that's probably a path I'd prefer for some stdlib libraries. But I wouldn't consider shards that come bundled with the installation as part of the standard library.
<yxhuvud> I'd consider everyting that is expected to be installed by default stdlib. And everything that is required by default core.
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<yxhuvud> Hmm. I wonder if it would be possible to get a priority queue and/or some heap implemenation into stdlib. (and it is *not only* experiences from aoc speaking :P)
<FromGitter> <j8r> @parruda All I know is `GidT` or `UidT`, not `Int`. Look also at https://github.com/crystal-lang/crystal/pull/5627
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <parruda> @j8r thanks
<FromGitter> <nothratal> Hi folks, recently I decided to give crystal a try. I really like Ruby, but I prefer type safety and the performance of course :D
<FromGitter> <nothratal> Is there already a IDE/Editor+Plugins supporting things like intellisense? So autocompletion on methods and types and chaining methods and so on
<FromGitter> <nothratal> Currently I run an editor with a bit syntax highlighting
<FromGitter> <j8r> @nothratal Welcome! look at https://gitter.im/crystal-scry/Lobby :)
laaron has quit [Remote host closed the connection]
<FromGitter> <kevinelliott> @nothratal Look into using crystal-lang extension for VSCode. https://marketplace.visualstudio.com/items?itemName=faustinoaq.crystal-lang
Raimondi has joined #crystal-lang
<scott_tams> I use the plugin for atom, it's nice as well
<scott_tams> There's also a basic Vim plugin
<FromGitter> <kevinelliott> Yeah it all comes down to what editor you prefer, really.
<FromGitter> <kevinelliott> vscode is the first product from Microsoft (other than Xbox) that I’ve thoroughly enjoyed since Windows XP.
<FromGitter> <Willyboar> Sublime text also has a plugin
Raimondi has quit [Ping timeout: 240 seconds]
non-aristotelian has joined #crystal-lang
<mps> j8r: looked at your question, you want to build libzip-static package, if I understand?
<mps> problem is CMakeLists.txt have flip/flop switch to build shared or static, not both at the same time (build). maybe hack CMakeLists.txt and see if it could be overridden
<mps> or to build in two pass, first as it is, and then change build flags and build static version
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c26717b92cf4d22420b664f]
laaron has joined #crystal-lang
<FromGitter> <greenbigfrog> @kevinelliott read the changelog for breaking changes :)
<FromGitter> <kevinelliott> Oh, thanks @greenbigfrog
<FromGitter> <kevinelliott> This is from a shard, which I assume is not ready for 0.25.1.
<FromGitter> <kevinelliott> I’ll roll back to a previous crystal ver.
<FromGitter> <greenbigfrog> 1) 25.1? Why not use 0.27.0 and update the shard? You only need to change it to `Time.unix_ms` IIRC
<FromGitter> <kevinelliott> Yeah, sure, I’ll consider it. It’s not my shard but would be fun to help.
<FromGitter> <greenbigfrog> oh. `to_unix_ms` is 0.27.0 already
<FromGitter> <greenbigfrog> so you're the one behind 😏
<FromGitter> <kevinelliott> Ahh.
<FromGitter> <greenbigfrog> just update to 0.27.0
<FromGitter> <kevinelliott> Cool, doing now. I didn’t even know 0.27 was out until a few minutes ago. Used `crenv` to install 0.25.1 today, as it was the latest that it showed in the remote available.
<FromGitter> <kevinelliott> Wonder why it doesn’t have 0.26.x nor 0.27.x?
<FromGitter> <greenbigfrog> You can subscribe on github to releases for the repo to stay up to date on releases
<FromGitter> <kevinelliott> Seems we need some better remote data for the crystal community… crystal release and shard version data (via JSON API or similar)
<FromGitter> <kevinelliott> Yeah definitely.
<FromGitter> <kevinelliott> I misunderstood `crenv` … i thought if it didn’t see the remote releases in the list, then it can’t install it.
<FromGitter> <kevinelliott> If you do `crenv install -l` it will show you a list of what versions you can install. But you can specify versions outside of that list and it will still install.
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <bararchy> Congrats @strigh
<FromGitter> <bararchy> @straight-shoota for joining the core team 🎉
<FromGitter> <kevinelliott> Congrats!
<FromGitter> <parruda> Hey guys, I am excited to say I just deployed Crystal support for FaaStRuby! I am updating the CLI now to allow `—runtime crystal` and should be publishing it later today! It is funny to compare a “hello world” in Ruby (~0.9ms) vs Crystal (~0.002ms). https://api.tor1.faastruby.io/paulo/cr-hello-world?time=true
<FromGitter> <asterite> Nice!! 🎉
robacarp has quit [Quit: disk full, brb]
<FromGitter> <anamba> dang... i've been trying to get sidekiq and sidekiq.cr working together, but keep encountering strange issues. only just now realized that it's been abandoned by the author in favor of faktory (a new language-independent version). i guess that's the way forward then.
<FromGitter> <anamba> and someone already wrote a crystal worker, nice https://github.com/calebuharrison/faktory.cr will try it out, hopefully still working (looks like it hasn't been touched in a while)
Renich has joined #crystal-lang
<FromGitter> <greenbigfrog> @anamba keep me updated how it goes please :) Was planning on setting something like this up myself sometime
Raimondi has joined #crystal-lang
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
Renich has quit [Ping timeout: 268 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <greenbigfrog> Shouldn't `require "some_folder/some_sub_file" also work for shards added via path?
<FromGitter> <greenbigfrog> wait. I can't `require "some_folder"` as well. what am I doing wrong this time...
<FromGitter> <greenbigfrog> ok. so `shards install` works. ⏎ the path points to a folder with the content `/src/sth/foo.cr` ⏎ And now I try to `require "sth/foo"`, but it isn't finding it. ⏎ what am I doing wrong? [https://gitter.im/crystal-lang/crystal?at=5c269911ab910e7d3ae92bfd]
<FromGitter> <greenbigfrog> nvm... obviously building in docker won't copy the paths...
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
<FromGitter> <drosehn> wrt `setgid`: ⏎ :point_up: December 28, 2018 9:48 AM (https://gitter.im/crystal-lang/crystal?at=5c2637d30b7fc97caab19154) ⏎ ⏎ I believe you need to call `setgid` before calling `setuid`. Also note that depending on what you're doing, you might want to be calling `setegid` and `seteuid`. [https://gitter.im/crystal-lang/crystal?at=5c26a7a4babbc178b2f1f61b]
<FromGitter> <drosehn> Let me add that I have a crystal program where I use `setgid` and `setuid`, and it's working correctly.
<FromGitter> <drosehn> @parruda , I do the calls in this order: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5c26ab4993cce97d3bb163e7]
<FromGitter> <drosehn> bah.
laaron- has joined #crystal-lang
<FromGitter> <parruda> @drosehn your are absolutely right
<FromGitter> <parruda> I realized that a couple hours ago :(
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c26ab6df6166a302785229e]
<FromGitter> <drosehn> Okay.
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> mps Thanks. I've asked to the maintainer guy, he told me that too
<FromGitter> <j8r> I'll do that, 2passes, 2 packages
<FromGitter> <j8r> This is a new lib used for PHP7.3 – need it to compile it statically :)
<FromGitter> <j8r> On the other hand compiling Python statically is hard, can't get pip inside so f***ed :@
<FromGitter> <j8r> That's why an aspect I hate with Python, too much dependent of the underlying platform
<FromGitter> <j8r> Node.js is the complete opposite
<mps> j8r: I could post you my changed APKBUILD which builds static version
<mps> anyway, for crystal APKBUILD there is 'snapshot' function which build static version of crystal, and it could give some idea how to make static libzip
<FromGitter> <straight-shoota> @bew thanks =)
<FromGitter> <straight-shoota> @j8r Darn. It's actually quite simple to convert YAML to JSON: ⏎ ⏎ ```struct YAML::Any ⏎ delegate to_json, to: raw ⏎ end ⏎ YAML.parse(yaml).to_json``` [https://gitter.im/crystal-lang/crystal?at=5c26b4d66649aa1f82e70362]
<FromGitter> <straight-shoota> All types `YAML::Any` wraps implement `#to_json`. Except `Slice(UInt8)`, which calls for a bit nasty workaround. But that's not a huge issue.
<scott_tams> @straight-shoota oh wow that's nice
<FromGitter> <straight-shoota> I think I'll finish it up and suggest a patch to stdlib. Also the other way around.