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
alex`` has quit [Ping timeout: 272 seconds]
akaiiro has quit [Ping timeout: 268 seconds]
<FromGitter> <ninetailschris> Anyone here try active_record.cr?
akaiiro has joined #crystal-lang
<FromGitter> <fridgerator> active_record.cr is not maintained anymore afaik
<FromGitter> <fridgerator> There are other ORM's though
return0e has quit [Ping timeout: 252 seconds]
<FromGitter> <ninetailschris> What is the best your opinion. I just came from ruby sinatra and trying to move to crystal because of performance and being a fan of how it was made.
<FromGitter> <fridgerator> Well if you want something like active record, look at Jennifer.cr or Granite ORM
<FromGitter> <fridgerator> I'm biased though, and I like Crecto, which uses a Repsitory ORM pattern
<FromGitter> <fridgerator> Based off of Ecto (Phoenix framework, Elixir language)
<FromGitter> <fridgerator> Im biased because I created it
<FromGitter> <fridgerator> I would say check them out and see which one you like
<FromGitter> <fridgerator> There are others as well : https://github.com/veelenga/awesome-crystal#ormodm-extensions
<FromGitter> <girng> what's a good alternative to sublime text that isn't vscode that has crystal's formatter on save?
<FromGitter> <girng> i'm having a reallly freaking weird issue on WSL when i'm saving files with WSL. once every often when I save, the formatter works, but then it cuts off HALF of my file and the other code is GONE. I can get it back if I do ctrl+z. however, it happens very randomly
<FromGitter> <girng> i almost like my master server file cause I saved and exited it. luckily i made backups of it though. it's extremely dangerous i want to use a different editor
<FromGitter> <fridgerator> wow
<FromGitter> <fridgerator> you think sublime is doing it?
<FromGitter> <girng> no idea, i just found out cause i went to run my crystal and it gave me a weird compile error. so i looked back at my code and half of it was gone!
<FromGitter> <girng> i luckily did ctrl+z and then re-saved, but my heart dropped
<FromGitter> <girng> it happens every now and then, i just usually do ctrl+z and re-save, but i don't want to accidentally save and then close sublime without checking. i'm scared lol and it's making me OCD because after I save I always scroll to the bottom of file to make sure no code was cut off. it's driving me insane!
<FromGitter> <girng> https://github.com/crystal-lang/crystal/wiki i'm going to look at the editor options listed here
<FromGitter> <bmulvihill> You could try https://github.com/crystal-lang-tools/atom-ide-crystal
<FromGitter> <girng> thanks
Liothen has joined #crystal-lang
moei has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
zorp has quit [Ping timeout: 268 seconds]
akaiiro has quit [Ping timeout: 252 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii has joined #crystal-lang
Raimondii is now known as Raimondi
<FromGitter> <girng> ok i'm using vscode now with `"editor.formatOnSave": true` setting in the user settings. This is epic!!
akaiiro has joined #crystal-lang
_whitelogger has joined #crystal-lang
ua has quit [Ping timeout: 260 seconds]
ua has joined #crystal-lang
<FromGitter> <ninetailschris> Anyone seen this error before? SQLite3::ResultSet#read returned a Int64. A (String | Nil) was expected. (Exception)
akaiiro has quit [Remote host closed the connection]
thews has quit [Ping timeout: 255 seconds]
thews has joined #crystal-lang
return0e has joined #crystal-lang
alex`` has joined #crystal-lang
zorp has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
druonysus has quit [Ping timeout: 260 seconds]
<FromGitter> <diegogub_gitlab> Is the HTTP:Client Fiber safe?
moei has joined #crystal-lang
moei has quit [Read error: Connection reset by peer]
return0xe has joined #crystal-lang
return0e has quit [Ping timeout: 268 seconds]
moei has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.2]
alex`` has joined #crystal-lang
<jokke> are there any shards that parse query params like this: "foo[bar][baz]=1" into { "foo": { "bar": { "baz": 1 } } }
<FromGitter> <Aaron-JM> the default json package? to_json may be what you looking for
<FromGitter> <Aaron-JM> Your*
<jokke> i mean query params
<jokke> url params
<oprypin> jokke, this is a completely made up format, why would there be such a shard
<jokke> it's widely used
<jokke> and rack supports it ootb
<oprypin> ok
<jokke> or maybe sinatra
<jokke> not sure
Groogy has joined #crystal-lang
<Groogy> Yo! o/
<jokke> o/
<FromGitter> <vladfaust> @jokke prism (https://github.com/vladfaust/prism) supports nested params
<FromGitter> <vladfaust> Sorry it doesn't have rich documentation, but lurking through API may be enough for now
<jokke> cool thanks!
<FromGitter> <vladfaust> Yeah, please see https://github.com/vladfaust/prism/blob/master/src/prism/params/parsing.cr#L27 to know how each content type is parsed
<jokke> vladfaust: would you care to extract the parser into a separate shard? :)
<jokke> right now i'm just using router.cr
<jokke> don't really need a whole framework
<FromGitter> <paulcsmith> That is super cool! Have you considered extracting a shard for param parsing?
<jokke> heh
<jokke> yeah i really like that
<FromGitter> <vladfaust> Prism is modular, you don't need to use the framework itself :)
<jokke> ok nice :)
<jokke> you have my star :)
<FromGitter> <paulcsmith> Also I love the logo
<FromGitter> <vladfaust> It's very heartwarming, thanks
<oprypin> it seems that it does not support arbitrary objects/keys but rather needs to be a predefined type, integrated with the framework
<oprypin> nah nevermind, seems fine
<FromGitter> <vladfaust> Types you'd like to parse need to have `.from_param` method indeed
<FromGitter> <paulcsmith> That’s cool that it can be used like that. My only concern is that you need to download all the code for prism to use only the param parser.
<FromGitter> <vladfaust> It's Crystal, the code that's not used is not included into binary, right?
<FromGitter> <paulcsmith> But I also understand that it’s hard to split things out, especially early on. So maybe an idea for the future would be to split that out.
<FromGitter> <paulcsmith> Right yeah so won’t affect compile time, but will need to be downloaded when fetching the code
<FromGitter> <vladfaust> I understand that. Yes, splitting may be a future feature, I already though about that
<FromGitter> <paulcsmith> Either way, very cool! We do something similar in Lucky but it’s not quite as powerful. Doesn’t handle nesting
<FromGitter> <paulcsmith> Another thought. It looks like it makes a params NamedTuple for type safety, but what do you think about making it a class so that you can use dot notation and so the type signature is easier to use if you pass params to other objects?
<FromGitter> <paulcsmith> I’m seriously loving the focus in type-safety in your lib. Nice work
<FromGitter> <paulcsmith> I think it sets a great example
<FromGitter> <paulcsmith> I’d love to work with you at some point to extract something for parsing common types. We do something similar in Lucky but it also handles parsing db values and converting to db values. Seems like this could be shared at some point so lots of apps/shards can get type safety when working with external input
<FromGitter> <lppedd> Hey guys, any news on the JetBrains side for a dedicated plugin?
<FromGitter> <vladfaust> @paulcsmith sounds good! Could you elaborate filing an issue describing of what that external-input-parsing-shard should be, so we could continue the discussion there?
<FromGitter> <paulcsmith> Yep! I’m on the phone so can’t now, but I definitely will!
<FromGitter> <vladfaust> 👍
<jokke> hmm vladfaust: in lib/prism/src/prism/params/definition.cr:127: undefined macro variable 'hash'
<jokke> weird
<jokke> vladfaust: any clues?
<jokke> here's the whole trace: https://p.jokke.space/kkSbM/
<jokke> here's the action: https://p.jokke.space/CRDio/
<jokke> hm the example in the docs doesn't compile either
<jokke> ah with the master branch it seems to be working
<FromGitter> <talbergs> Which `--target`should I specify to build for alpine:latest ?
<FromGitter> <girng> @ninetailschris you doing a game server as well? nice!
<jokke> vladfaust: hm now i get another error: Empty params
<FromGitter> <vladfaust> @jokke: nobody said it would work 🙃 I use Prism in production, however, I'm unable to catch all the edge cases. It hasn't got solid attention yet, so there are only few developers using it in the wild, thererfore it's not as hardly tested as Lucky and it may require you to dig deeper in the code (which is quite simple). Nevertheless I'm here to help. File an issue!
<jokke> do you have a working snippet which uses nested params?
<FromGitter> <vladfaust> Yeah, the one in specs
<jokke> ah good point
<FromGitter> <vladfaust> Yep, the master branch differs from the latest release. Sorry for not pointing that out
<FromGitter> <vladfaust> E.g. `< Prism::Action` isn't valid anymore
<FromGitter> <vladfaust> Because `include` is better
<jokke> ahh my bar
<jokke> *bad
<jokke> yeah
<jokke> i used type foo, Type instead of type foo : Type
<FromGitter> <vladfaust> I use to file all my thoughts in my project (even if noone reads them): https://github.com/vladfaust/prism/issues/33
<FromGitter> <girng> what is prism?
<FromGitter> <ninetailschris> @girng I'm swapping my ruby game to crystal . Trying to get use the differences haha
<FromGitter> <ninetailschris> @fridgerator Ecto is very well made I wanted to give props. Probably the best I've seen.
<FromGitter> <girng> @ninetailschris nice. i ported my nodejs gameserver to crystal. it's been amazing so far
<FromGitter> <j8r> @fridgerator what's the point of `Hash(Symbol, String)` vs `Hash(String, String)` https://github.com/Crecto/crecto/blob/master/spec/schema_spec.cr#L188?
<FromGitter> <j8r> nearly all Crystal ORMs use Symbols, which is meh because very often there are better alternatives
<FromGitter> <sgarfinkel> Is there a grammar (EBNF/BNF/etc) available for Crystal?
<oprypin> sgarfinkel, you mean a description of grammar of crystal language itself? no
<FromGitter> <girng> @oprypin long time no see
DTZUZO has quit [Ping timeout: 252 seconds]
<FromGitter> <sgarfinkel> So is there a spec or something? I'd be interested in looking at it/creating a grammar possibly for some AST parsing purposes.
<FromGitter> <fridgerator> @j8r Coming from ruby using symbols all over the place made sense
<FromGitter> <fridgerator> I started Crecto over 2 years ago, there are definitely improvements that could be made
<oprypin> sgarfinkel, for AST parsing purposes there's crystal's own parser which you can use ...
<FromGitter> <sgarfinkel> It was for parsing in other languages. For instance, parsing Crystal's AST in Java, which is required for Eclipse/IntelliJ plugins. I'd normally create an ANTLR grammar and go from there.
<oprypin> sgarfinkel, normally this has been solved by using a server that gives info about code
<oprypin> or just making a stupid syntax highlighting + indentation specification
<oprypin> see VSCode (iirc) for former, Kate or Pygments for latter
<FromGitter> <sgarfinkel> Scry seems nice, but there are other applications too. Plus a CFG is a great way of expressing a language spec concisely
<FromGitter> <paulcsmith> LuckyRecord uses methods instead of symbols. It also has type safe methods for querying the database and preloading associations. The docs are not very good for using in other projects outside Lucky but it can definitely be done
alex`` has quit [Ping timeout: 272 seconds]
<FromGitter> <paulcsmith> And a nice overview of using it here https://github.com/jwoertink/crystal_orm_test/blob/master/src/orm_test/lucky_record/setup.cr
<FromGitter> <paulcsmith> The main focus was in ease of use, powerful querying with methods and not strings, and type safety for catching bugs and helping debug.
<FromGitter> <paulcsmith> Would love to help if you want to give it a shot. I definitely need to write some docs on using it outside Lucky, but most of the concepts are documented at luckyframework.org in the guides for querying the database and saving with forms
alex`` has joined #crystal-lang
<FromGitter> <paulcsmith> There is an ORM called Clear that has some super powerful querying as well. Postgres only though (same with LuckyRecord)
DTZUZO has joined #crystal-lang
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter> <j8r> There is a room for a "generic" type safe ORM :)
<FromGitter> <vladfaust> Actually I've been thinking of one, @j8r!
<FromGitter> <vladfaust> Working with any adapter, be it `DB` or any NoSQL database
<FromGitter> <vladfaust> Like `crystal-db` but `crystal-orm`
akaiiro has quit [Remote host closed the connection]
<FromGitter> <j8r> 💯
<FromGitter> <fridgerator> You wouldn't use crystal-db ?
<FromGitter> <j8r> `crystal-db` isn't an high level ORM
<FromGitter> <fridgerator> right, its used by other ORMs
<FromGitter> <fridgerator> I guess I dont know what you mean by "generic"
<FromGitter> <j8r> there is `kiwi` in `crystal-community` for NoSQL
<FromGitter> <zbaylin> hey everyone. I am either being really stupid, or there is a bug in Crystal ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ the `if activation_check` block evaluates no matter what, even if `activation_check` is false. am I missing something super obvious? [https://gitter.im/crystal-lang/crystal?at=5b81b1f4ff445156163992d5]
<FromGitter> <j8r> I mean, no tied to a specific framework or ruby inspired. A neutral organization with a reusable ORM with Crystal idioms
<FromGitter> <fridgerator> I think there's already more crystal ORM's than for ruby
<FromGitter> <j8r> haha yes there are a lot in Crystal, but I'm still finding a good Crystalish one 😄
<FromGitter> <j8r> for sqlite3, mysql particularly
<FromGitter> <j8r> that's because everyone launch its own ORM for its projects :|
<FromGitter> <j8r> @zbaylin https://carc.in/#/r/4tfb Can't reproduce it, what's the type of `activation_check`?
<FromGitter> <zbaylin> a bool
<FromGitter> <zbaylin> the `pp activation_check` line prints `false`
<FromGitter> <zbaylin> ah I think I figured it out
<FromGitter> <zbaylin> `CONFIG["require_activation"]` is a YAML::Any
<FromGitter> <zbaylin> which makes me think it's only checking if the value is not nil
<FromGitter> <talbergs> Hello.
<FromGitter> <zbaylin> however, there is no `YAML::Any#as_bool` method
<FromGitter> <j8r> I've made a PR for https://github.com/crystal-lang/crystal/pull/6556
<FromGitter> <zbaylin> nice. One step ahead of me.
<FromGitter> <zbaylin> for now I am using `#raw`
<FromGitter> <talbergs> Is that common, that I build an binary, then move it to other os - then it says, that it cann't run it, because `./app: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory`
<FromGitter> <j8r> like the error said - the lib isn't present
<FromGitter> <talbergs> Can I build somehow all the shared libraries into?
<FromGitter> <j8r> @talbergs you can build statically, it's purpose it to bundle all libs in the binary. Very practical if you want to move your binary around
<FromGitter> <j8r> Personally I use https://hub.docker.com/r/jrei/crystal-alpine/
<FromGitter> <talbergs> ooh thanks I wondered what the "statical" means
<FromGitter> <j8r> by default `crystal build` use shared libraries of the OS. If you move the binary, you have to have the same libraries with the same versions
<FromGitter> <talbergs> thanks @j8r that image maybe misses some lib - it will not build `kemal` app , saying: ```
<FromGitter> <talbergs> besides `openssl openssl-dev` it says it need something more in alpine. ⏎ A demo app did build flawlessly. Ex. usage ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b81c396a491f459179e8389]
<FromGitter> <j8r> It's likely a version problem between Crystal and kemal
<FromGitter> <j8r> Kemal should be 0.24.0, and Crystal 0.26.0
alex`` has quit [Ping timeout: 252 seconds]
<FromGitter> <talbergs> yes, that was the case, thank you!
<FromGitter> <girng> i've never had a problem with --static tbh. i use ```
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b81d63358a3797aa3b7af39]
hightower3 has quit [Ping timeout: 252 seconds]
<FromGitter> <j8r> glibc was known to have a bad support for static linking, but now its partially fixed. It may work on Debian with glibc. Nevertheless, Alpine with musl is more reliable and will produce smaller binaries
Groogy has quit [Read error: Connection reset by peer]
<FromGitter> <j8r> @girng you use `hardware`, I have worked 😁
thews has quit [Excess Flood]
thews has joined #crystal-lang
<FromGitter> <girng> annd i love it :D
<FromGitter> <girng> "Use it for anything that has to be rigorous, reliable, or secure?" why he say this??
Groogy has joined #crystal-lang