RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
Kixune has joined #crystal-lang
Kixune1 has joined #crystal-lang
Kixune has quit [Ping timeout: 250 seconds]
Kixune1 has quit [Read error: Connection reset by peer]
Kixune has joined #crystal-lang
Kixune1 has joined #crystal-lang
Kixune has quit [Ping timeout: 250 seconds]
Kixune1 is now known as Kixune
lucasb has quit [Quit: Connection closed for inactivity]
Kixune has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
ashirase has quit [Ping timeout: 255 seconds]
ashirase has joined #crystal-lang
fifr has quit [Ping timeout: 252 seconds]
fifr has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
gangstacat has quit [Remote host closed the connection]
gangstacat has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
marmotini_ has joined #crystal-lang
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 250 seconds]
lucasb has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 246 seconds]
marmotini has quit [Ping timeout: 250 seconds]
beepdog has quit [Quit: lol]
Jenz has joined #crystal-lang
beepdog has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
Raimondi has quit [Ping timeout: 258 seconds]
Raimondii has joined #crystal-lang
Raimondii has quit [Read error: Connection reset by peer]
Raimondi^1 has joined #crystal-lang
Raimondi^1 is now known as Raimondi
faitswulff has joined #crystal-lang
faitswulff has quit [Remote host closed the connection]
hoffentlichja has quit [Read error: Connection reset by peer]
hoffentlichja has joined #crystal-lang
<Jenz> Why does this fail?: https://carc.in/#/r/6l99
FromGitter has joined #crystal-lang
<FromGitter> <j8r> I don't know yet if it's better to have annotations standardized in the `Object#from`, or let the `MyFormat.serialize` dealing with
<FromGitter> <j8r> standardization vs flexibility
<FromGitter> <Blacksmoke16> hm
rob264 has joined #crystal-lang
<FromGitter> <j8r> I'd say having standard annotations, then others that are passed as arguments
<FromGitter> <Blacksmoke16> im assuming for it to use the custom args they would have to override the serialize method to tell it how to utilize the custom args?
<FromGitter> <j8r> no necessarily, there is a `**serialization_args` then having a macro inside
<FromGitter> <Blacksmoke16> a macro inside? that could be implemented by the user to define the custom logic?
<FromGitter> <Blacksmoke16> i see how extra args could be passed in, but how would it know what to do with them?
<FromGitter> <j8r> nvm yes, you could have a custom serializer/deserializer
<FromGitter> <j8r> yes
<FromGitter> <Blacksmoke16> i think ideally this would be a shard of its own so that its easier to add feature sto
<FromGitter> <Blacksmoke16> vs part of stdlib
<FromGitter> <Blacksmoke16> i always had an idea but its not super easy to implement atm
<FromGitter> <Blacksmoke16> where you give an ivar a path, then on deserialize would set that property to the value at the end of that path
<FromGitter> <j8r> the concept has its place on the stdlib, this would prevent having custom annotation like `YAML::Field` or `JSON::Field`
<FromGitter> <j8r> then extending it can of course be in a shard
<FromGitter> <Blacksmoke16> i.e. unify them into one
<FromGitter> <j8r> yes, this what it does
<FromGitter> <Blacksmoke16> not sure its a big deal but then you would lose being able to target a specific type?
<FromGitter> <Blacksmoke16> i.e. ignore this property on to_json but not on to_yaml
* Jenz O_o
<FromGitter> <Jens0512> Oh, now it's working
<FromGitter> <j8r> For example you can deserialize from json, and serialize to YAML easily
<FromGitter> <j8r> without any `include`
<Jenz> Anyone know why this fails?: https://carc.in/#/r/6l99
<FromGitter> <vladfaust> I like https://serde.rs/. Would be great to move specific type serialization logic out of an object
Jenz has quit [Ping timeout: 246 seconds]
<FromGitter> <j8r> I'm not sure if my approach will work, I'll keep experimenting and will see
Jenz has joined #crystal-lang
<FromGitter> <vladfaust> BTW, *serialization* is object into format, and *deserialization* is from format to object
* Jenz O_o
<z64> i don't think something like serde in crystal can work (in a concise way) because our generics aren't powerful enough.
laaron- has joined #crystal-lang
<z64> and i don't think polluting Object is reasonable
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <Blacksmoke16> id have to see more fleshed out alternatives, but im quite a fan of the current include mechanic
<FromGitter> <Blacksmoke16> pretty sure the mapping doesnt allow for inheritance
<z64> `MyFormat.serialize(foo, io)` / `MyFormat.deserialize(io) : Foo` is the cleanest thing - and in fact already exists as `IO#read_bytes(T, endian)`/`#write_bytes(t, endian)` - but people don't want to type that much it seems :P
<FromGitter> <Blacksmoke16> :p
<FromGitter> <Blacksmoke16> *effort*
<FromGitter> <Blacksmoke16> was looking into how minification happens on JS. is pretty neat how some of it works
<FromGitter> <Blacksmoke16> true/false gets converted to like `!0/0`
<FromGitter> <Blacksmoke16> gotta save them extra characters
<FromGitter> <vladfaust> @z64, how's that? https://carc.in/#/r/6lhg
<z64> yes, now you implement `#to_io`, and you use the format argument to encode to a specific format
<FromGitter> <vladfaust> That's harder than including a module
<FromGitter> <vladfaust> @j8r did it in his forum post I guess
<z64> not the point, i'm not talking (yet) about magic; this cleanly seperates serialization logic. you could have some macro that generates a formatter for your type
<z64> basically, you could have something that generates this: https://carc.in/#/r/6lhx ; this is more similar to, on topic, what rust serde does (...)
<z64> consider you want to have a generic formatter JSON. `def self.encode(obj : Foo)` becomes `def self.encode(obj : T) forall T` - which i realize the issue with that, but bear with me. consider also, `def self.decode(io)`.. when you have multiple objects, in crystal, the return of this now becomes a union of all serializable types
<z64> you "solve" this by generating `{% if T == Foo %} .. code that returns Foo {% end %}`
DmitryBochkarev has quit [Ping timeout: 272 seconds]
<z64> to me this would be perfect; there is no type tree / method pollution, or relying on `include` just to trigger some macros after the final type pass, etc.
<z64> but we can't generate this because, as i mentioned previously, our generics aren't powerful enough. rust is capable of doing these specializations for any type, which we can't do
<z64> https://github.com/crystal-lang/crystal/issues/7274 (Annotation#types) might help
<FromGitter> <Jens0512> I think our generics has huge potential, i.e. they're quite flawed ATM, but I don't think there is much that is missing (from a semantic standpoint) before they'll be huge
<FromGitter> <Jens0512> I'm an idiot though
<FromGitter> <Jens0512> In many ways, as everyone are
Jenz has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.2/toplevel.html#assert_responds_to%28var%2Cmethod%29-macro TIL
<FromGitter> <Blacksmoke16> this would make a nice addition to `Spec`
<FromGitter> <PlayLights_twitter> Hello everyone :) Im experiencing something weird, Do you know why openSSL on decrypt randomly throws `EVP_CipherFinal_ex: Unknown or no error (OpenSSL :: Cipher :: Error)`
Jenz has joined #crystal-lang
Jenz has quit [Quit: leaving]
mps has quit [Quit: leaving]
moei has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> ☝️ March 27, 2019 4:45 PM (https://gitter.im/crystal-lang/crystal?at=5c9be0f81f98a87112ae9a4c) nice :)
<FromGitter> <dscottboggs_gitlab> So, what editors do you guys use/prefer?
<FromGitter> <Blacksmoke16> sublime atm
<FromGitter> <dscottboggs_gitlab> I've been using Atom since before I started using Crystal, but I kinda find the plugins lacking. ⏎ ⏎ I should just fix the plugins for it :/
<FromGitter> <Blacksmoke16> sounds like a plan :P
<FromGitter> <Blacksmoke16> sublime is nice as it auto formats on sa ve
<FromGitter> <dscottboggs_gitlab> that and ameba integration are what I'm kinda wishing atom had now
<FromGitter> <dscottboggs_gitlab> I do like the experience in vim a lot, but I don't like working on large, multi-file projects in vim.
<FromGitter> <dscottboggs_gitlab> I mean, in atom, the syntax highlighting isn't even complete. I went to fix it one time, but it was like thousands of lines of coffeescript and I just noped out.
<FromGitter> <dscottboggs_gitlab> (thanks ruby devs)
<FromGitter> <Blacksmoke16> xD
<FromGitter> <Blacksmoke16> i want to work on the jetbrains plugins
<FromGitter> <Blacksmoke16> for like ctrl+click and stuff but meh
<FromGitter> <Blacksmoke16> hold on
<FromGitter> <Blacksmoke16> why doesnt this work
<FromGitter> <Blacksmoke16> wait but it did
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9c0bcddfcacf510aae6a9f]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9c0bdf7160b42285263dd1]
<FromGitter> <Blacksmoke16> this doesnt affect the response body
<FromGitter> <dscottboggs_gitlab> flush it
<FromGitter> <Blacksmoke16> do what?
<FromGitter> <dscottboggs_gitlab> I ran into that too
<FromGitter> <dscottboggs_gitlab> `response.flush`
<FromGitter> <dscottboggs_gitlab> after printing to it
<FromGitter> <Blacksmoke16> didnt do anything
<FromGitter> <dscottboggs_gitlab> shit
<FromGitter> <dscottboggs_gitlab> that's some nice syntax, though, using `throw` for returning HTTP "exceptions"
<FromGitter> <Blacksmoke16> but i can go to the bottom and do `get_response.print "foo"` and i get `"foo"` in the response
<FromGitter> <Blacksmoke16> thanks man
<FromGitter> <Blacksmoke16> yea manco isnt getting expanded or something
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9c0d07b6711251983bb623]
<FromGitter> <Blacksmoke16> i added `pp response` in the macro and it doesnt print
<FromGitter> <Blacksmoke16> oh fml
<FromGitter> <Blacksmoke16> apparently you can override a macro :P
<FromGitter> <dscottboggs_gitlab> oh shit yeah, that's an artifact of the way the compiler works I think
<FromGitter> <Blacksmoke16> yea works now :S
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/athena/blob/master/docs/routing.md#exception-handling is how everything is wired up btw
<FromGitter> <Blacksmoke16> quite happy with how it turned out
<FromGitter> <dscottboggs_gitlab> I've been thinking about that lately, it's kinda interesting. Making `require`s work the way they do and allowing reopening of constructs across files kinda exposes how the compiler works in a neat way. Especially once you understand that later defined AST-nodes overwrite previously-defined ones
<FromGitter> <Blacksmoke16> or lead to bugs :P