<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>
<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>
<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>
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>
<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
<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>
<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>
<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>
<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 😁