<FromGitter>
<galvertez> if i already serialized the result, then when i serialize the response containing the result, it escapes the already serialized json
<FromGitter>
<bew> @codenoid note: you can't catch sigkill, and why do you need to catch them?
<FromGitter>
<bew> @galvertez if you don't need to store it, you don't really need to know the type
<FromGitter>
<codenoid> to call at_exit,
<FromGitter>
<galvertez> the reason `Response(T)` is a generic is because clientside, `T` can be anything with a `JSON.mapping`, so the type needs to be serializable by json. ⏎ i am using `JSON::Any` on serverside, specifically because i agree with you, i don't care about the type. i just need it to exist long enough to be placed inside a response and then serialized.
<FromGitter>
<galvertez> this is not the problem i'm having though. a user of this shard will want to write rpc methods (rpc methods being distinct from crystal methods) and the rpc will need to be able to key off of `request.name` to decide what to do. those instructions need to be stored somewhere, so a `{} of String => JSON::Any -> JSON::Any` is necessary.
<FromGitter>
<bew> not perfect, but it can lead you to something ;)
<FromGitter>
<bew> and there's no macro ;)
<FromGitter>
<galvertez> ok but that's already a closed object
<FromGitter>
<bew> you can add the necessary fields line 27
<FromGitter>
<galvertez> the `result` key belongs to the `Response` object. and i do not want it to be serialized inside the proc. because then when i serialize the response, it will re-serialize an already serialized json
<FromGitter>
<galvertez> mmm
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 260 seconds]
<FromGitter>
<galvertez> yeah actually the more i think about it the more i think i can make that work
<FromGitter>
<galvertez> so then the proc would actually return a fully serialized response, rather than wishy-washy JSON::Any result object
pabs has quit [Ping timeout: 240 seconds]
<FromGitter>
<galvertez> and it would accept the whole request rather than just the params. then the user defines an inner proc which can be more flexible type-wise
<FromGitter>
<galvertez> thanks @bew for the consideration
<FromGitter>
<galvertez> i don't think we ever got on the same page but you definitely got me thinking of alternatives
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
pabs has joined #crystal-lang
<FromGitter>
<bew> you got it :) glad I could help!!
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
<FromGitter>
<galvertez> yep, got it working. and without a macro after all
<FromGitter>
<galvertez> i somehow got stuck on the idea that the `Response` didn't need to be serialized right away. everything's much easier when the return type is always a `String`
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ is now known as p0p0pr37
<FromGitter>
<bew> Hehe, nice ;)
Nathanaelle has quit [Ping timeout: 260 seconds]
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37_ is now known as p0p0pr37
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 260 seconds]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
<FromGitter>
<fgimian> this allows you to write a custom handler for different tags in YAML which processes the data and replaces it with something else
<FromGitter>
<fgimian> if you've ever used AWS CloudFormation, you'll know all about Intrinsic Functions which also use this approach
<FromGitter>
<fgimian> However, I'm having a few challenges (see the TODOs); any help is greatly appreciated
<FromGitter>
<fgimian> Please note that this is being developed directly against Crystal master branch (which has different behaviour to the 0.24.2 release)
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
Nathanaelle has joined #crystal-lang
alex`` has quit [Ping timeout: 276 seconds]
<FromGitter>
<fgimian> I've just solved the first problem after much tinkering
<FromGitter>
<Grabli66> I dont want nil in new array
<FromGitter>
<aisrael> `.compact_map()`?
<FromGitter>
<Grabli66> Thanks. It works
<FromGitter>
<Grabli66> And why, in the name of God, it returns new array, not a enumerable? :)
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
<FromGitter>
<yxhuvud> Because it is an Enumerable and Enumerable methods tend to compute the result. Iterable support compact_map too, so use that if you don't want the intermediaries
<crystal-gh>
[crystal] asterite closed pull request #6128: Fix: detect error when trying to use unbound generic type in instance var (master...bug/5383-unbound-generic-type) https://git.io/vhI3p
<FromGitter>
<manveru> so... i was asking the other day how to make an array like `Array(String | Int32)` but that doesn't fail compilation just because it's `["hi"]` and not `["hi", 1]`, does anyone know a solution to that?
<oprypin>
manveru, so what, you want to make it fail compilation?
<FromGitter>
<j8r> @manveru you will quickly learn to avoid as much as possible union type - they are harder to handle 😄
<oprypin>
so, first of all, above you'll see an issue about removing recursive aliases. but they do work. i just still don't quite get what you're trying to achieve
<FromGitter>
<yxhuvud> @manveru either Array(String | Int32).new or ["foo"] of String | Int32
<oprypin>
probably mainly because on mobile and gitter shows 10 characters of code width-wise
<FromGitter>
<manveru> heh
<FromGitter>
<yxhuvud> also aliases doesn't handle generic arguments very well
<FromGitter>
<manveru> well, my version compiles fine, and it works well, it's just a bit annoying
<oprypin>
definitely should just be Array(Array(String | TableRowLink))
<oprypin>
then see yxhuvud's advice
<oprypin>
or just make that class support the case of string and all unions are gone
<FromGitter>
<manveru> TableRowLink is an alias for NamedTuple(text: String, href: String)
snsei has joined #crystal-lang
<oprypin>
should have been a struct
<FromGitter>
<drujensen> What about creating a class or structure for TableRowLink
<FromGitter>
<drujensen> lol
<oprypin>
and instead of String you use a TableRowLink without a link. and uh rename it to not contain 'link' in the name
<FromGitter>
<drujensen> nilable
<oprypin>
i just had a sudden realization
<oprypin>
are unions always code smells just like namedtuples?
<FromGitter>
<drujensen> hhmm
<FromGitter>
<drujensen> I use them from db queries where I don’t know the type being returned and allow for multiple types. DB::Types for example
<FromGitter>
<drujensen> how would you recommend doing that?
<FromGitter>
<drujensen> also great for duck typing
<FromGitter>
<drujensen> but in theory I could create a base class
<oprypin>
well alright, "just like namedtuples" means it's fine for passing things in and out of methods, but perhaps not for storage
<FromGitter>
<manveru> what's wrong with named tuples?
<oprypin>
their only designed purpose is to store keyword arguments of methods, and for every other case there are better alternatives.
DTZUZO has joined #crystal-lang
<FromGitter>
<drujensen> Each data structure has a purpose and clean code will always define its classes/structures to represent that data. Using a `NamedTuple` in many cases does not reflect the purpose of the data being stored. It is better to define a class or structure with a well defined name that reflects that data. `Dog(name: String, age:Int)` instead of `NamedTuple(name:String, age:Int)`
<oprypin>
that, and `dog[:age]` is annoying
<FromGitter>
<drujensen> haha, true
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter>
<fridgerator> I have a strange issue that I haven't been able to figure out. My sqlite specs fail in travis, I cant replicate locally in OSX or Ubuntu.
<FromGitter>
<fridgerator> some kind of weird race condition?
<FromGitter>
<S-YOU> How about puts without interpolations like `#{}` or even LibC.printf("test\n")?
<FromGitter>
<S-YOU> #{} involve string builder, and puts itself involve FileDescriptor, which related to Fiber and may be even Stack Switching..
csk157 has quit [Ping timeout: 252 seconds]
<FromGitter>
<S-YOU> Or may be database didn't flush fast enough on that file system and Repo.all(User) could give some time to it.
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
Nathanaelle has joined #crystal-lang
<crystal-gh>
[crystal] bcardiff opened pull request #6141: Fix #6136. Remove no longer used Dockerfile (master...fix/dockerfile) https://git.io/vhYKT
alex`` has joined #crystal-lang
faustinoaq has joined #crystal-lang
faustinoaq has quit [Ping timeout: 252 seconds]
<FromGitter>
<fridgerator> I'll have to try using different puts methods. The hardest part is I can't replicate locally 😅
Nathanaelle has quit [Ping timeout: 245 seconds]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
<FromGitter>
<r00ster91> Hello i'm trying to use Crystal on Windows. I followed the steps on https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows. ⏎ When i'm cloning the Crystal repository and then doing this in it: `bin/crystal build --cross-compile --target x86_64-pc-windows-msvc hello_world.cr` then i'm getting a big error. Here's a part of the error: ⏎ ⏎ ```while requiring "c/dlfcn": can't find file 'c/dlfcn'```
<RX14>
I broke it when I changed File::Stat to File::Info
<RX14>
on friday I have my last exam
<RX14>
and after that I will be aple to work on windows again
<RX14>
then we'll have two people working on windows over the summer
<FromGitter>
<r00ster91> thats nice
<FromGitter>
<fridgerator> isn't bcardiff full time crystal now?
<RX14>
yes
<FromGitter>
<fridgerator> awesome
<RX14>
thats the second person
<FromGitter>
<fridgerator> fantastic
<RX14>
today he's picked up my work for the 0.25.0 chanelog
<RX14>
after we get 0.25.0 out the door we should be getting progress
<crystal-gh>
[crystal] RX14 closed pull request #6141: Fix #6136. Remove no longer used Dockerfile (master...fix/dockerfile) https://git.io/vhYKT
<FromGitter>
<fridgerator> Sounds like windows support is the priority?
<RX14>
for me
<RX14>
for bcardiff he'll be working on various things
<FromGitter>
<Grabli66> Nobody works on parallelism? 😟
<FromGitter>
<r00ster91> well rx14 made a parallelism shard
<RX14>
"various things" could well include parallelism
<RX14>
I don't know it's status
<FromGitter>
<fridgerator> I can already run servers in parallel thanks to SO_REUSE_PORT so I dont need it, but I understand its importance for other types of tasks
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 245 seconds]
Nathanaelle has joined #crystal-lang
Ven`` has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Ven` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Nik736 has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<crystal-gh>
[crystal] chris-huxtable opened pull request #6142: Fixes documentation of Char.hex? (master...char-documentation) https://git.io/vhY5I
snsei has quit [Remote host closed the connection]
Nathanaelle has quit [Read error: Connection reset by peer]
<FromGitter>
<fridgerator> hahaha
Nathanaelle has joined #crystal-lang
<FromGitter>
<skippi> On the api docs, is there a difference between `# =>` and `# ==` when showing the result of an example?
<RX14>
it should always be # =>
<RX14>
where did you see the # == ?
<FromGitter>
<skippi> I first saw it in on the `Char` docs, but decided to clone the repo and search where it occured. These are the files: ⏎ ⏎ 1) src/char.cr ⏎ 2) src/int.cr ⏎ 3) src/string.cr ... [https://gitter.im/crystal-lang/crystal?at=5b0c6b83b6eece791dbdc0d2]
<FromGitter>
<skippi> If it's an inconsistency worth fixing, I can probably send in a PR.
<FromGitter>
<skippi> Oh, I guess while we're still on this topic, does `#=>` and `# =>` mean the same thing? ⏎ ⏎ ```foo = 10 ⏎ foo #=> 10 ⏎ foo # => 10``` ⏎ ⏎ Sorry if I'm asking a lot of questions. Working on a project that involves finding out what kind of example documentation is/should be allowed. [https://gitter.im/crystal-lang/crystal?at=5b0c6df993dc78791c918060]
<Yxhuvud>
@bararchy: it is a bit strange that the only update since february is to the readme though.
<FromGitter>
<bew> `# =>` is the right one @skippi
marrow16180 has joined #crystal-lang
<marrow16180>
Hi
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
marrow16180 has quit [Quit: Leaving]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
sz0 has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 245 seconds]
greengriminal has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
<faustinoaq>
marrow16180, Hi :)
greengriminal has quit [Quit: This computer has gone to sleep]