<FromGitter>
<straight-shoota> because the receiver is UInt8
<FromGitter>
<straight-shoota> There is #6223 which will make `+` raise in case of an overflow, so the result won't be `216_u8` but an arithmethic exception
<FromGitter>
<straight-shoota> But you still have to make sure to use appropriate types when performing arithmetic operations
<FromGitter>
<Grabli66> Ok. Integer types in crystal is like a minefield, cause of overflow. :)
<jokke>
any recommendations for a shard for some hypermedia specification?
<FromGitter>
<straight-shoota> Combining different integer types is a minefield. That's not Crystal's fault.
<jokke>
like HAL or JSON-API
hightower3 has quit [Ping timeout: 240 seconds]
hightower3 has joined #crystal-lang
erblite has joined #crystal-lang
alex`` has joined #crystal-lang
<crystal-gh>
[crystal] MakeNowJust opened pull request #6407: Remove TODO in spec/std/object_spec.cr (master...fix/remove-todo-in-object-spec) https://git.io/fNGiL
alex`` has quit [Ping timeout: 260 seconds]
yaewa has quit [Quit: Leaving...]
alex`` has joined #crystal-lang
<crystal-gh>
[crystal] r00ster91 opened pull request #6408: Do TODO in spec/compiler/parser/parser_spec.cr (master...patch-2) https://git.io/fNGMy
moei has joined #crystal-lang
duane has joined #crystal-lang
<FromGitter>
<asterite> The reason is a += b should work, so the type is the type of the left hand side.
<vegai>
Grabli66: you can use the Big* types if you don't want overflows
<FromGitter>
<asterite> Generics inheritance doesn't work well, please don't use it
<FromGitter>
<Grabli66> But i need a generic field "value". How i can replace it?
<FromGitter>
<Grabli66> Ok. I can replace it with generic module :)
<FromGitter>
<j8r> @Blacksmoke16 there are merged methods using a macro, and new methods to deal with dynamic JSON/YAML path
rohitpaulk has joined #crystal-lang
<FromGitter>
<Blacksmoke16> gotcha
vegai has left #crystal-lang [#crystal-lang]
<FromGitter>
<j8r> need them because of manipulation dynamic documents with dynamic keys
rohitpaulk has quit [Ping timeout: 244 seconds]
rohitpaulk has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
hightower3 has quit [Ping timeout: 256 seconds]
<jokke>
i just found quicktype
<jokke>
would be cool to add a crystal language output
<jokke>
there's already a ruby one
<jokke>
could be pretty straightforward to port
akaiiro has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter>
<straight-shoota> jokke, it's really interesting how much code quicktype generates for different langauges :D
<jokke>
yeah :D
<jokke>
should be very little code for crystal thanks to JSON::Serializer awesomeness
<FromGitter>
<straight-shoota> yes
<FromGitter>
<straight-shoota> although we're not yet completely settled on the exact API regarding constructors, JSON::Any, multiple serializers etc.
<jokke>
straight-shoota: regarding json parsing. i'm really missing something like a "discriminator" field definition which would allow choosing the class based on the value of that field
<FromGitter>
<straight-shoota> and of course it makes a difference if a language was created long before one would think about having JSON serialization by default
<jokke>
yeah sure
<jokke>
but the golang code is also pretty lengthy
<FromGitter>
<straight-shoota> you mean like a polymorphic attribute?
<jokke>
yeah
<FromGitter>
<straight-shoota> a simple converter should do it... =)
<jokke>
i know it's already possible in a way using union types but this requires them to have differing keys
<jokke>
hmm
<jokke>
actually i'm not sure if this is possible at all because i would have to make assumptions on the order of the keys
<jokke>
or i would have to use JSON::Serializer::Unmapped and then run SomeType.from_json(generic_type.to_json) :/
hightower3 has quit [Ping timeout: 245 seconds]
erblite has quit [Ping timeout: 276 seconds]
<FromGitter>
<straight-shoota> yes, you can't expect guaranteed order of elements
<FromGitter>
<straight-shoota> but an array should work: `["SomeType", { foo: 'bar', foobar: 'baz' }]`
<jokke>
hm yeah that should do it
<jokke>
another question: do you know of any easy way to inherit a class and make all json serializable attributes nilable in that subclass?
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
wontruefree has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 1.9]
DTZUZU has joined #crystal-lang
<FromGitter>
<straight-shoota> hm, no
erblite has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
carsonbaker has joined #crystal-lang
wontruefree has quit [Quit: bye]
rohitpaulk has quit [Ping timeout: 264 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 240 seconds]
duane has quit [Ping timeout: 276 seconds]
<FromGitter>
<sam0x17> gcf.cr, my tool for deploying serverless crystal code to Google Cloud Functions is now functional and working for http-trigger-based functions: https://github.com/sam0x17/gcf.cr
<FromGitter>
<sam0x17> it includes a crystal API that maps to all of the redirect/data sending/file sending/logging features normally available from a js-based cloud function
<FromGitter>
<sdogruyol> Congrats @sam0x17 π
<FromGitter>
<sam0x17> thx!
<FromGitter>
<sam0x17> I imagine it could be ported to lambda as well, but I have less experience with that platform
duane has joined #crystal-lang
wontruefree has joined #crystal-lang
carsonbaker has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
erblite has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Read error: Connection reset by peer]
akaiiro has joined #crystal-lang
carsonbaker has joined #crystal-lang
alex`` has quit [Read error: Connection reset by peer]