<FromGitter>
<asterite> Yeah, nilable fields should be skipped by NamedTuple but that's not the case right now
<FromGitter>
<asterite> Please submit a feature request issue, thank you!
<FromGitter>
<tenebrousedge> 👀
<FromGitter>
<asterite> For now use a struct or class with json mapping or Serializable
<FromGitter>
<fenicks> Ok, for now I'll do that with json mapping and hook my database driver because it allow crystal data type or JSON:Any to perfom query. ⏎ I'll look at Serializable too because I don't know how it works ;-). ⏎ Thanks.
DTZUZU has quit [Quit: WeeChat 2.2]
DTZUZU has joined #crystal-lang
<FromGitter>
<sam0x17> anyone familiar with `kemal-spec` know how to have multiple requests preserve their session / cookie jar between requests?
<FromGitter>
<sam0x17> looks like I can pass in a `HTTP::Headers`, but not sure how to get the one from the previous request
<FromGitter>
<sam0x17> @sdogruyol ^
<FromGitter>
<sam0x17> sorry `spec-kemal` not `kemal-spec`
<FromGitter>
<sam0x17> (this is for an API so everything is JSON)
<FromGitter>
<Blacksmoke16> mm JSON API
<FromGitter>
<sam0x17> yeah its pretty tasty
<FromGitter>
<Blacksmoke16> hows kemal working out?
<FromGitter>
<sam0x17> taking an ancient rails app, already converted everything to a progressive web app running in S3 and connecting to rails app just as API server, now cutting rails out of the loop entirely using an up.sh / kemal based lambda API
<FromGitter>
<sam0x17> its great, I always end up coming back to it
<FromGitter>
<Blacksmoke16> is it a simple API or?
<FromGitter>
<sam0x17> so basically converting an 800 line "api controller" to organized crystal code
<FromGitter>
<sam0x17> ^
<FromGitter>
<sam0x17> I'm super happy with myself for never breaking up that controller on the rails side
<FromGitter>
<sam0x17> makes it so easy to port
<FromGitter>
<Blacksmoke16> xD
<FromGitter>
<sam0x17> so yeah, lool
<FromGitter>
<Blacksmoke16> have you looked at Athena at all? would appreciate some feedback from someone familiar with APIs
<FromGitter>
<sam0x17> the one cumbersome thing is there isn't very good built in instrumentation for "returning early" from within middleware (in kemal)
<FromGitter>
<sam0x17> oh yeah I forgot that's a thing
<FromGitter>
<sam0x17> I bet its perfect /facepalm
<FromGitter>
<Blacksmoke16> thats my goal 😄
<FromGitter>
<Blacksmoke16> could you just not call the next handler?
<FromGitter>
<sam0x17> it looks amazing
<FromGitter>
<sam0x17> yeah right now I just raise my error message and then have an error 500 handler that renders the error message
<FromGitter>
<Blacksmoke16> that works too :P
<FromGitter>
<sam0x17> but what you said is probably what I'm supposed to do xD
<FromGitter>
<Blacksmoke16> currently rewriting my serialization lib, much much better implementation
<FromGitter>
<sam0x17> it looks really nice, love the use of annotations
<FromGitter>
<sam0x17> I have yet to play with those
<FromGitter>
<sam0x17> I'm too deep in my hacked together setup at this point, but will definitely consider for future projects
<FromGitter>
<sam0x17> but yeah, things that have been pain points for me so far in general with my various approaches ⏎ ⏎ 1) middleware that returns early is tricky ⏎ 2) all the ORMs are too lazy to have a working CLI and/or have db:create and db:drop commands ⏎ 3) saying `.to_json` at the end of everything is annoying ... [https://gitter.im/crystal-lang/crystal?at=5d561f929507182477e79800]
<FromGitter>
<Blacksmoke16> i.e. imagine you set the `/post` endpoint to use `list` group, while the `/post/:id` uses `detail` group
<FromGitter>
<sam0x17> ahhh ok thats pretty cool
<FromGitter>
<Blacksmoke16> which would look something like
<FromGitter>
<Blacksmoke16> plan is to also support custom exclusion strategies, so could also make your own
<FromGitter>
<sam0x17> yeah that in particular is super cool
<FromGitter>
<Blacksmoke16> say for like ACL stuff or preventing properties from being updated on PUT but allowed to be set in a POST
<FromGitter>
<Blacksmoke16> `@[IgnoreOnUpdate]` or something
<FromGitter>
<Blacksmoke16> ill keep you posted, no pun intended xD
<FromGitter>
<sam0x17> hah
ht_ has joined #crystal-lang
ht_ has quit [Read error: Connection reset by peer]
<FromGitter>
<absolutejam_gitlab> Could use it akin to how Flask works
<FromGitter>
<absolutejam_gitlab> or click
<FromGitter>
<absolutejam_gitlab> (Python)
<FromGitter>
<absolutejam_gitlab> By prefixing methods with a route/method
<FromGitter>
<absolutejam_gitlab> Is there a Crystal equivalent of `go get`?
<FromGitter>
<absolutejam_gitlab> maybe an addition to `shards`?
devil_tux has joined #crystal-lang
chemist69 has joined #crystal-lang
absolutejam has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter>
<shdown> What’s the “Crystal way” to define all comparison ops based on `<=>`?
shdown has joined #crystal-lang
<shdown>
What’s the “Crystal way” to define all comparison ops based on `<=>`? Is there a standard macro for it or something?
shdown has quit [Remote host closed the connection]
shdown has joined #crystal-lang
<FromGitter>
<yxhuvud> shdown: see `Sortable`
<FromGitter>
<shdown> @yxhuvud `Comparable`? OK, but why doesn’t it define `!=`?
<FromGitter>
<asterite> I think that's defined on Object as the opposite of ==
shdown has quit [Remote host closed the connection]
<FromGitter>
<shdown> @asterite OK, thanks!
<FromGitter>
<yxhuvud> Yes, it definitely invokes `<=>` in any case.
duane has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
absolutejam has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz>
I'm playing with some really weird (and probably stupid) code, and (suprise!) it doesn't work! Anyone know why: https://play.crystal-lang.org/#/r/7euw
<Jenz>
-?
<Jenz>
Seems the value is not set, in line 9
devil_tu1 has joined #crystal-lang
devil_tux has quit [Ping timeout: 268 seconds]
<FromGitter>
<Blacksmoke16> something something passed by copy?
lucasb has joined #crystal-lang
<Jenz>
But how? I am modifying an ivar directly in the initializer
<Jenz>
Then @bar[c] would be a copy, and that'd be very weird would it not?
<Jenz>
How the hell would I set @bar[c][r] then?
<FromGitter>
<Blacksmoke16> :shrug: im not super familiar with this
<Jenz>
Ah but you're right, thanks; StaticArray is a struct (the whole point of it) and as the nested one also is so, the fetch is by copy...
<Jenz>
Seems wholly unpractical to work with nested StaticArrays then
devil_tu1 has quit [Ping timeout: 245 seconds]
<FromGitter>
<tenebrousedge> why is `uninitialized` being used?
<FromGitter>
<absolutejam_gitlab> any way I can get crystal working on Arch again?
<FromGitter>
<absolutejam_gitlab> 1) 1 isn't in repos so I#m trying to build `crystal-git` and it fails on the openssl spec
<FromGitter>
<absolutejam_gitlab> oh, there's a tar.gz
<FromGitter>
<absolutejam_gitlab> I'll check that
Jenz has quit [Ping timeout: 245 seconds]
<FromGitter>
<absolutejam_gitlab> well that was a tar extract gone badly
<FromGitter>
<absolutejam_gitlab> overwritten `/lib` and `/bin` lawl
<FromGitter>
<j8r> mps I was able to build crystal and tests for 0.30.0
<mps_>
j8r: on aarch64?
<FromGitter>
<j8r> yes, I'm currently rebuilding it to be sure. ⏎ Several notes: I was using `./bin/crystal build -D preview_overflow -D compiler_rt -o .build/all_spec spec/all_spec.cr; .buid/all_spec` and it was when using `git bisect`
<FromGitter>
<j8r> I try with `make && make spec`
<FromGitter>
<j8r> with `make clean` before
<mps_>
this is without any patch to source?
<FromGitter>
<j8r> yes
<FromGitter>
<j8r> I am compiling it again. I may have errors this time
<mps_>
good work! hope you will find cause why it doesn't work
<FromGitter>
<j8r> I confirm, it succeeded
<FromGitter>
<j8r> Last time I was trying against master. and you, it was 0.30.0 or 0.30.1?
<mps_>
I tried both, 0.30.0 and 0.30.1
<mps_>
both failed with same errors
<mps_>
so, adding '-D preview_overflow' is solution
<FromGitter>
<j8r> for me `make spec` do `./bin/crystal build -D preview_overflow -D compiler_rt -o .build/all_spec spec/all_spec.cr`
<FromGitter>
<j8r> I'm on a machine with 16GB RAM also, instead of 8GB
<mps_>
ok, will try with a great hope
<mps_>
iirc, '-D compiler_rt' is default
ht_ has joined #crystal-lang
<mps_>
no luck, failed again with same errors
<FromGitter>
<j8r> note I am using llvm5
<mps_>
aha, so
<FromGitter>
<j8r> for me, what works: 0.30.0 LLVM5 aarch64 16GB RAM
<mps_>
so have to backport llvm5
<FromGitter>
<j8r> I try it again back at home. Crystal shall work on LLVM8
<mps_>
it works with llvm8 on x86_64
<FromGitter>
<j8r> 1) 30.1 works too
<FromGitter>
<asterite> 1) 30.0 is flawed, please try to use 0.30.1
<FromGitter>
<asterite> 1) 30.0 should not be used, it has a bug with libevent and another bug with LLVM
<FromGitter>
<j8r> 1) 30.1 LLVM5 aarch64 works, LLVM8 not
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<oprypin>
lol nice markdown parser
<oprypin>
if you were wondering why everyone started writing "1) 30.1" - actually is "0.30.1"
<oprypin>
geez even the message "30.1 isn't in repos" has been turned into "1) 1 isn't in repos"
woodruffw has quit [Ping timeout: 245 seconds]
woodruffw has joined #crystal-lang
lucasb has joined #crystal-lang
<FromGitter>
<Blacksmoke16> ruh roh `Error: BUG: CrSerializer::Assertions::IsBlankAssertion(String | Nil) has no types`
<FromGitter>
<sam0x17> so why no `.to_sym` for `String`?
<FromGitter>
<sam0x17> when you can go `:blah.to_s`?
<FromGitter>
<watzon> @sam0x17 because symbols are constants
<FromGitter>
<watzon> known at compile time
<FromGitter>
<sam0x17> ah ok
<FromGitter>
<sam0x17> would be cool if that worked if the string happens to be a symbol that has been compiled
<FromGitter>
<sam0x17> and throws an error otherwise
<FromGitter>
<sam0x17> I might implement that
<FromGitter>
<sam0x17> because that's true 100% of the time for my use cases
<FromGitter>
<tenebrousedge> what is your use case?
<FromGitter>
<Blacksmoke16> most of times enums should be used instead of symbols
<FromGitter>
<watzon> ^
<FromGitter>
<Blacksmoke16> can use the symbol to autocast into an enum instance
<FromGitter>
<tenebrousedge> Enums are good
<FromGitter>
<sam0x17> basically database stuff
<FromGitter>
<sam0x17> and yeah, enum would be good
<FromGitter>
<watzon> The symbol autocast is one of my favorite Crystal features tbh. I don't think a lot of people realize that it even exists.
<FromGitter>
<sam0x17> example?
<FromGitter>
<watzon> Basically allows you to have an enum as a value, say `def foo(bar : Foo::Bar::Baz)` where `Foo::Bar::Baz` is an enum, and instead of having to use that full enum namespace when you invoke the method you can just use a symbol, so `foo(:baz)`
<FromGitter>
<sam0x17> 0_0
<FromGitter>
<sam0x17> love it
<FromGitter>
<watzon> It really makes things a lot simpler syntactically
<FromGitter>
<j8r> there is `DLLVM_ENABLE_ASSERTIONS=OFF`
<FromGitter>
<bcardiff> then it's not. :-) `LLVM_ENABLE_ASSERTIONS=ON` is what you want
<FromGitter>
<bcardiff> a release build can took 1h. a debug build will be much slower on runtime. choose it you are going to save the build and use it later
<FromGitter>
<j8r> and on qemu everything is already 3x slower :(
<FromGitter>
<j8r> for the time being mps_, we can either use only llvm5, or have a condition depending of the arch
<mps_>
j8r: when I tried 0.30.0 and 0.30.1 it doesn't build with llvm5 nor llvm6
<mps_>
didn't tried with llvm7, it is buggy to much
<mps_>
will try later (when find some time) to backport llvm5 and build 0.30.1 to see will that work
<FromGitter>
<j8r> backport?
<FromGitter>
<j8r> llvm5 is still on edge
<mps_>
uhm, my bad, llvm5 was moved to unmaintained by mistake but returned back few days ago, I forgot that mess
<mps_>
git short log '2019-08-11] bb51a7beb5 unmaintained/llvm5: move from community'
<mps_>
and '[2019-08-11] 4948c3c3f2 community/llvm5: move from unmaintained'
<FromGitter>
<watzon> Damn I wish I had 128GB of RAM
<FromGitter>
<watzon> I might finally be able to run Chrome
<FromGitter>
<j8r> mps_ 🎉
<mps_>
watzon: lol
<FromGitter>
<watzon> 😉
<FromGitter>
<j8r> you use qemu-kvm mps_??
<mps_>
lets try 'specs'
<mps_>
no, lxc container
<mps_>
on real arm64 hardware
<FromGitter>
<j8r> nice
<FromGitter>
<j8r> what is it, yours/
<FromGitter>
<j8r> ?
<mps_>
no, alpine infrastructure
<mps_>
packet.com donated, iirc
<FromGitter>
<j8r> great :D
<mps_>
'make spec', now have to wait some time
<mps_>
j8r: you are so great in your persistence
<mps_>
'make spec' passed link phase and now working on specs :) didn't crashed
<FromGitter>
<j8r> thanks for you time too :)
<mps_>
I hope good news will be in about half an hour, in meantime a glass of red wine ;-)
<FromGitter>
<kingsleyh> Hey - any issues with Crystal 0.30.1 on Alpine Linux? My crystal process on my docker instance dies with an Illegal Instruction
<FromGitter>
<kingsleyh> Just since upgrading
<FromGitter>
<kingsleyh> From 0.29.0
<mps_>
kingsleyh: x86_64?
<mps_>
j8r: still here? all passed! now building from clean environment to final check will it pass on official builders
<FromGitter>
<j8r> mps_ nice :)
<FromGitter>
<j8r> @kingsleyh how did you compile?
<FromGitter>
<j8r> I like the percentage progress in CMake
<FromGitter>
<j8r> mps_ that's so good you take time on Crystal - despite not being really an user of the language
<FromGitter>
<j8r> ...why?
<mps_>
you are making interview for press? :D
<mps_>
just kidding
<mps_>
I plan to use it seriously when it stabilize
<mps_>
API/ABI etc
<FromGitter>
<j8r> for production projects?
<mps_>
yes
<mps_>
and it is interesting to follow evolution of the relatively young lang which is not supported by big corp.
<mps_>
I prefer software made by devoted people
<mps_>
maybe you heard saying "amateurs made Noah ark and professionals made titanic"
<FromGitter>
<j8r> agree, good sentence
<mps_>
I tried to adopt golang for my $dayjob projects but after about year and a half I stopped
<mps_>
and had a hope for rust but it now becoming to heavy for development
<mps_>
and you? what are your reasons for such 'love' for crystal?
duane has joined #crystal-lang
<FromGitter>
<j8r> haha, love, kinda
<FromGitter>
<kingsleyh> I used the alpine Linux crystal docker instance from github
<FromGitter>
<kingsleyh> And just - shards build —release
<FromGitter>
<j8r> @kingsleyh what image?
<FromGitter>
<kingsleyh> Then start up the binary produced and then after about 30 secs it core dumps
<FromGitter>
<kingsleyh> I run the docker on Ubuntu and when I run direct on the underlying Ubuntu I have problems
<FromGitter>
<kingsleyh> Have no problems sorry direct
<FromGitter>
<kingsleyh> On the underlying Ubuntu it works fine
<mps_>
j8r: here is late, I hope you will be tomorrow here so we can continue to work in fixing 0.30.1 for Alpine
<FromGitter>
<kingsleyh> It has LLVM 4 also
<FromGitter>
<j8r> mps_ see you
<FromGitter>
<j8r> @kingsleyh if you use the same binary on different OSes, better to compile statically
<mps_>
good night to all
<FromGitter>
<kingsleyh> I don’t - I compile it in the Dockerfile
<FromGitter>
<j8r> good
<FromGitter>
<j8r> so, don't know
<FromGitter>
<kingsleyh> The only difference is switching up to 0.30.1 so must be related to that I guess
<FromGitter>
<kingsleyh> Anyway I’m going to create my own image
<FromGitter>
<kingsleyh> And try that
<FromGitter>
<j8r> you can try with alpine - lol
<FromGitter>
<j8r> good opportunity to have a multistage build
<FromGitter>
<j8r> compile statically on alpine, then but the binary on an image `from scratch`
<FromGitter>
<renich> Guys, having issues with a YAML.mapping class. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I need a function `get_value( key_name )` or something like that. Could someone give me some guidance? [https://gitter.im/crystal-lang/crystal?at=5d573e70bfd2887f53010aa4]
<FromGitter>
<Blacksmoke16> did i solve something like this a while ago?
<FromGitter>
<renich> Some components might be missing sometimes, though.
<FromGitter>
<renich> The command-line utility (which I wrote to try and practice crystal a bit more) is supposed to parse thousands of csv files like these. Then, I can just concatenate (minus the header file) and import into a spreadsheet.