olbat[m] has quit [Read error: Connection reset by peer]
beepdog has quit [Remote host closed the connection]
beepdog has joined #crystal-lang
<FromGitter>
<didactic-drunk> Can different formats specify different converters? For example JSON doesn't have a universal time type and requires application specific serialization. YAML has a native datetime type.does support times and.
<FromGitter>
<Blacksmoke16> Could still use property specific converters
<FromGitter>
<Blacksmoke16> To control how a specific property gets serialized
alex``` has quit [Ping timeout: 246 seconds]
alex``` has joined #crystal-lang
commavir has quit [Remote host closed the connection]
commavir has joined #crystal-lang
return0e has quit [Remote host closed the connection]
alex``` has quit [Ping timeout: 250 seconds]
alex``` has joined #crystal-lang
olbat[m] has joined #crystal-lang
return0e has joined #crystal-lang
chemist69 has quit [Ping timeout: 250 seconds]
chemist69 has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 244 seconds]
ht_ has joined #crystal-lang
sorcus has quit [Ping timeout: 264 seconds]
ht_ has quit [Remote host closed the connection]
flaviodesousa has joined #crystal-lang
absolutejam has joined #crystal-lang
<FromGitter>
<didactic-drunk> Is there a supported `memset` like function for `Bytes`? `#clear` doesn't seem to exist.
<FromGitter>
<confact> does anyone have an example of reading files and parse them? Tried to find tutorial or something in the reference but couldn't find it. I might have searched on wrong names though.
<FromGitter>
<mavu> @confact If you are looking for a tutorial, you can probably search for one written in ruby, I think the File interface is practially identical.
<FromGitter>
<confact> @mavu ah okay. I am a ruby developer and tried to find File in the reference document but couldn't. But then I will just test with some File.open and such.
<FromGitter>
<confact> @mavu Ah! that was what I was looking for. Thanks a lot!
<FromGitter>
<mavu> You're welcome
absolutejam has quit [Ping timeout: 245 seconds]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 244 seconds]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
<FromGitter>
<Blacksmoke16> @j8r isnt that pretty much the same as `user.serialize :json`?
<FromGitter>
<Blacksmoke16> but i guess its removing the enum in order to pass the module to use
<FromGitter>
<j8r> @Blacksmoke16 No, because it's an enum. Passing a type will is more flexible
<FromGitter>
<j8r> the type doesn't have to be in an enum
absolutejam has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
alex``` has quit [Quit: WeeChat 2.5]
chemist69 has joined #crystal-lang
<FromGitter>
<naqvis> @didactic-drunk you can use `#to_unsafe.clear(count)` to reset `Slice`.
<FromGitter>
<Blacksmoke16> @j8r true true, and i suppose if you pass some random module it wouldnt compile since there wouldnt be the correct method on it
absolutejam has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> i could go with that as well
<FromGitter>
<Blacksmoke16> partially, at this point about 3 diff libs haha
<FromGitter>
<Blacksmoke16> taking some points i like from each
<FromGitter>
<Blacksmoke16> the major diff will be each "serializer" will just build its output string via an array of structs, vs going off of the actual object
<FromGitter>
<Blacksmoke16> i.e. the common options can be shared vs needing `YAML::Field`, and `JSON::Field` with the same initial configuration duplicated for each format
<FromGitter>
<Blacksmoke16> ill share something later on this week once i get something showable
<FromGitter>
<j8r> 💯 with you
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<j8r> One time I wanted to do it, but I was on other topics :/
<FromGitter>
<Blacksmoke16> ill keep you posted
absolutejam has quit [Ping timeout: 264 seconds]
absolutejam has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter>
<j8r> anyone here interested of using Drone CI for a Crystal project?
absolutejam has quit [Ping timeout: 245 seconds]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
ht_ has joined #crystal-lang
<FromGitter>
<j8r> Would you create an organization? I suppose it will become a Serialization framework, like Serde
<FromGitter>
<Blacksmoke16> possibly once it gets mature enough
duane has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<j8r> will it be a mono repo, or one repo per format?
<FromGitter>
<j8r> maybe one for the stdlib, and then separate repos for said TOML, CON, whatever
<FromGitter>
<Blacksmoke16> im not sure yet, havent thought that far ahead
<FromGitter>
<Blacksmoke16> plan is to get a prototype to kinda show off what im thinking would be most ideal then go from there
<FromGitter>
<j8r> that's a good start
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 245 seconds]
<FromGitter>
<nsuchy> @j8r I prefer GitLab CI tbh
alex`` has joined #crystal-lang
<FromGitter>
<Blacksmoke16> indeed, should be pretty slick
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<j8r> @nsuchy GitLab CI only works on GitLab, no?
<FromGitter>
<Blacksmoke16> would also be some `Context` class that is optional to `#serialize` that would be used for runtime values, like groups/versioning etc
<alex``>
how to set the type of "observers"
<alex``>
in module Observable
<alex``>
getter observers : [] of Observer
<alex``>
but got a syntax error
<alex``>
(Observer is an abstract class)
<FromGitter>
<watzon> alex: what's the error?
<alex``>
unexpected token
<alex``>
observer.cr:6:22: error:expecting token 'CONST', not '[]'
<FromGitter>
<watzon> Ohhh I see what you're doing
<FromGitter>
<watzon> `getter observers = [] of Observer`
<FromGitter>
<watzon> That's what you need
<alex``>
oh
<FromGitter>
<watzon> Or if you want to type it as well
<FromGitter>
<watzon> `getter observers : Array(Observer) = [] of Observer`
<alex``>
btw will it work using implemented class?
<alex``>
class Foo < Observer
<alex``>
Can I put foo in observers?
<FromGitter>
<watzon> Yeah that's the whole point of abstract classes tbh
<FromGitter>
<watzon> Any correctly extended abstract class will be allowed in the observers array
<FromGitter>
<Blacksmoke16> should be emergency imo
<FromGitter>
<Blacksmoke16> is what it is in the rfc
<FromGitter>
<Blacksmoke16> for syslog at least
<FromGitter>
<didactic-drunk> "Informational" is also in the RFC. I'm not taking sides only pointing out that common use in many loggers shorten the names. warn vs warning is also common.
<FromGitter>
<didactic-drunk> "warn" is what crystal uses.
<FromGitter>
<Blacksmoke16> true
<FromGitter>
<didactic-drunk> I'm making a PR with whatever you decide as a proposal for crystal's logger. I suspect @asterite, @jhass or @straight-shoota also have opinions.
<alex``>
If I get it right, without passing param to `include ModuleName`, we have to put an hard reference to the type, and with a param, it makes a reference to a type, generic
<alex``>
L13 and 14
<FromGitter>
<watzon> Yeah almost any container type should have a generic data type, `Observable(T)` is right
<alex``>
isn't better to initialize in getter?
<alex``>
getter observers = [] of T
<FromGitter>
<watzon> @didactic-drunk I'm with you on the shorter names, it's why I have things the way they are
<alex``>
instead of
<FromGitter>
<j8r> @Blacksmoke16 not sure about `Array(Metadata)`
<alex``>
`@observers ||= [] of T`
<FromGitter>
<watzon> alex: not necessarily
<alex``>
what is the benefices to add this code in add_observer?
<FromGitter>
<Blacksmoke16> @j8r what about it?
<FromGitter>
<j8r> Why array specifically?
<FromGitter>
<Blacksmoke16> is possible some properties would be excluded, thus needed to be removed from the array
<FromGitter>
<Blacksmoke16> i suppose you could use a tuple, but would have to create a new one with those removed since you cant directly edit it
<FromGitter>
<Blacksmoke16> er you cant dynamically create a tuple so it has to be an array
<FromGitter>
<j8r> I think this array can be avoided
<FromGitter>
<Blacksmoke16> what would you propose instead?
<FromGitter>
<j8r> using a block
<FromGitter>
<j8r> I kinda like the idea of `Metadata`, that's a proper interface
<FromGitter>
<Blacksmoke16> how would the block work?
<FromGitter>
<Blacksmoke16> yea exactly, are uncoupling the object and the data that needs serialized
<FromGitter>
<j8r> We have to look how Serde do, too
<FromGitter>
<j8r> You don't like annotations anymore 😄 ?
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<Blacksmoke16> that examples implements two
<FromGitter>
<j8r> I mean. why not doing how `Serializable` does?
<FromGitter>
<Blacksmoke16> for types like that it would work like `.to_json` currently does im thinking
<FromGitter>
<Blacksmoke16> but again, its a bit early :p
<FromGitter>
<j8r> what was the issue with my implem?
<FromGitter>
<Blacksmoke16> nothing in particular
<FromGitter>
<Blacksmoke16> just messing around with some new ideas
<FromGitter>
<HCLarsen> Hey guys, I just got a Invalid memory access (signal 11) at address 0x4 error when running my code. Is that a compiler issue, or is there a mistake in my code?
<FromGitter>
<HCLarsen> Nope, not doing any of that.
<FromGitter>
<j8r> @Blacksmoke16 👌
<FromGitter>
<Blacksmoke16> mainly wanted to play with having some way to define custom annotations that could be used
<FromGitter>
<Blacksmoke16> as a way to exclude some properties at runtime
<FromGitter>
<Blacksmoke16> as well as more flexibility over what/how each property gets serialized
ht_ has quit [Quit: ht_]
<FromGitter>
<ezrast_gitlab> @HCLarsen Most of my segfaults come from leaning on the type system too hard, particularly mixing generic types and inheritance which is known to be broken.
<FromGitter>
<tenebrousedge> @HCLarsen can you isolate it to a recent change? git bisect maybe?
<FromGitter>
<Blacksmoke16> or just comment stuff out/delete stuff till it goes away, then slowly undo :p
<FromGitter>
<Blacksmoke16> to get a minimal example
<FromGitter>
<HCLarsen> @ezrast_gitlab not doing any generic types with this code. I'm working on the code that I changed when this started, just trying to nail down exactly where/what happened to cause it.
<FromGitter>
<HCLarsen> I'm trying to use puts statements to determine exactly where the segfault is happening.
<FromGitter>
<tenebrousedge> is it segfaulting at runtime or compile time?
coderobe has quit [Read error: Connection reset by peer]
DeBot has quit [Quit: Crystal IRC]
asterite has quit [Quit: Bye]
jhass has quit [Quit: Bye]
coderobe has joined #crystal-lang
<FromGitter>
<HCLarsen> @tenebrousedge runtime.
<FromGitter>
<watzon> @HCLarsen I got that very recently
<FromGitter>
<watzon> Huge pain in the ass to figure out
<FromGitter>
<watzon> In my case I'm pretty sure it was actually a compiler bug though
<FromGitter>
<HCLarsen> @watzon did you create an issue on Github for it?
<FromGitter>
<watzon> Not yet, I need to make a small reproducable sample
<FromGitter>
<watzon> I'm working on it
<FromGitter>
<HCLarsen> Ok. I'm also trying to isolate what's causing it for me.
<FromGitter>
<watzon> In my case it was basically this: ⏎ The compiler allowed me to put procs with the signature `Proc(Foo, Foo)` into an array with the signature `Array(Proc(Foo, Nil))`. Then when I called the procs the runtime thew a fit because the output wasn't the expected `Nil`.
<FromGitter>
<HCLarsen> Oh. I'm using Procs as well. Maybe I'll narrow my search to that.